Home > Back-end >  Delphi xe6 DBgrid bold record selected ghosting afterwards
Delphi xe6 DBgrid bold record selected ghosting afterwards

Time:09-25

My program DBgrid in bold text selected record from time to tome ghosting, please masters help you see, the younger brother in this thank you first, the code is as follows:

Procedure Tf_shudian_zhipin_ziliaojia. DBGrid1DrawColumnCell (
Sender: TObject; Const the Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
Var
Dbgrid: TDBGrid;
The begin
Dbgrid:=(Sender as TDBGrid);
With dbgrid. The DataSource. The DataSet do
The begin
If query1. Fieldbyname (' ziliaojiaceshu) asinteger=0 then
Dbgrid. Canvas. The Font style:=[fsbold];//eligible records as bold
If query1. Fieldbyname (' chuliriqi) asstring<> "' then
Dbgrid. Canvas. The Font color:=clblue;
end;

If the Column. The Alignment=taRightJustify then
DBGrid. DefaultDrawColumnCell (the Rect, DataCol, Column, State)
Else if the Column. The Alignment=taCenter then
DBGrid. DefaultDrawColumnCell (the Rect, DataCol, Column, State)
The else
DBGrid. DefaultDrawColumnCell (the Rect, DataCol, the Column, the State);
end;

CodePudding user response:



Online, such as the great god for help

CodePudding user response:

I can't see the ghost

CodePudding user response:


Yeah, for those who have not chosen your records and see that the selected rows from the second word began to use double!

CodePudding user response:

Before calling DefaultDrawColumnCell add: the Rect. Offset (+ 1, 0)

CodePudding user response:

1, resetting the DBGrid font, select "tahoma"
2, set up the system of window display module,

Should be the font on the display, the secondary display, font problems,
  • Related