dbgrid

DBGrid - How to set an individual background color?

时光毁灭记忆、已成空白 提交于 2021-02-09 09:26:25
问题 I am using Delphi 10.2.3 and want to change the background color of a DBgrid. For example I have a text column and an integer column. Depending on the text I want to change the color of the integer cell (in the same row) if the value is non-zero. I got some ideas from how to color DBGrid special cell? So I know how to change the color of a cell in OnDrawColumnCell. I can change the background of the text. But I still didn't figure out how to change the color of another cell. Certainly it is

DBGrid - How to set an individual background color?

旧巷老猫 提交于 2021-02-09 09:23:52
问题 I am using Delphi 10.2.3 and want to change the background color of a DBgrid. For example I have a text column and an integer column. Depending on the text I want to change the color of the integer cell (in the same row) if the value is non-zero. I got some ideas from how to color DBGrid special cell? So I know how to change the color of a cell in OnDrawColumnCell. I can change the background of the text. But I still didn't figure out how to change the color of another cell. Certainly it is

DBGrid - How to set an individual background color?

时间秒杀一切 提交于 2021-02-09 09:23:47
问题 I am using Delphi 10.2.3 and want to change the background color of a DBgrid. For example I have a text column and an integer column. Depending on the text I want to change the color of the integer cell (in the same row) if the value is non-zero. I got some ideas from how to color DBGrid special cell? So I know how to change the color of a cell in OnDrawColumnCell. I can change the background of the text. But I still didn't figure out how to change the color of another cell. Certainly it is

In Delphi, How can I change the color of grid lines in a TDBGrid?

☆樱花仙子☆ 提交于 2021-01-27 06:48:39
问题 I am using a TDBGrid component in a Delphi application, when I change rows colors the grid lines became unclear or almost invisible. So, can any one show us how to change the color of the grid lines? I mean: how to change the color of cells borders(see next picture) The cells borders 回答1: Are you looking for procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const [Ref] Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); Var R: TRect; begin R:= Rect; with DBGrid1

In Delphi, How can I change the color of grid lines in a TDBGrid?

妖精的绣舞 提交于 2021-01-27 06:46:24
问题 I am using a TDBGrid component in a Delphi application, when I change rows colors the grid lines became unclear or almost invisible. So, can any one show us how to change the color of the grid lines? I mean: how to change the color of cells borders(see next picture) The cells borders 回答1: Are you looking for procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const [Ref] Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); Var R: TRect; begin R:= Rect; with DBGrid1

How to refresh dbgrid without close and open dataset in delphi?

半城伤御伤魂 提交于 2020-01-02 02:48:07
问题 I need to refresh dbgrid constantly, in real time. Close and open dataset works fine, but blink the dbgrid. What can I do to avoid this? I'd like a solution like Ajax, that update only the necessary. Thanks 回答1: Have you tried to use Disable- & EnableControls ? DataSet.DisableControls; try DataSet.Close; DataSet.Open; finally DataSet.EnableControls; end; Furthermore, it should be possible to just call DataSet.Refresh instead of closing and opening to get the same result. 回答2: I use this in my

How to find the actual width of grid component with scrollbar in Delphi

元气小坏坏 提交于 2019-12-29 08:08:10
问题 I have a grid component (DBGrid) which has lots of columns on it. Because of large number of columns, a scrollbar was created, and thus some part of grid remains hidden. I need to find out what is the real width of DBGrid, including the part which is not shown due to scroll bar. But Width property gives only the width of the component itself. Anybody has any idea? 回答1: Perhaps this may be helpful. It is part of a class helper for TDBGrid that auto sizes the last column, so that the grid has

Delete and refresh a record in DBgrid where u maintain the same position

喜欢而已 提交于 2019-12-25 05:25:33
问题 I have a small database I'm using dbgo, I have a DBgrid displaying my records, I need to know how to delete a record and refresh the database where the index arrow stays in the same position or at least go to the next? but currently my index arrow jump to start form the beginning each time I refresh ! 回答1: Just keep and reset Recno var I:Integer; ....... I := Ads.Recno; Ads.Delete; Ads.Recno := I; an example implementation for usage with DBNavigator could be Procedure DeleteAndKeepRecno(Ads:

DBGrid stop current Row moving

天涯浪子 提交于 2019-12-25 03:48:23
问题 Using d5, TDBGrid, SQLite3 and ZEOS. Database has 2000 items, one Column is an "Active" as Boolean, a second Column is "ItemName" as Text, and IndexFiledNames is "ItemName' OnDblclick toggles "Active" On/Off and all works as expected for the Data . Active changes from True to False and back again. But, if I double-click on the last visible Row of the DBGrid, to toggle the Active state -- after the toggle, the DBGrid moves that item Row to the vertical center Row-position of the grid. This is

Tlistview - There is any component like Tlistview but with DB access?

↘锁芯ラ 提交于 2019-12-24 22:47:39
问题 I've been trying to make a creative thing to avoid the dbgrids , and i've found the Tlistview (using the one from alphaskins , tslistview ), and seems to be a nice way! The problem is, I don't want to code the event onclick on every tlistview to position a record/dataset according to the item I selected on the tlistview .. and I'm doing it with the tlistview item's caption .. and there could be records with the same names Here is one of the codes I want to avoid: with q_find_process do begin