Recent

Author Topic: Font draw in customdraw in dbgid  (Read 713 times)

mikutu

  • New Member
  • *
  • Posts: 16
Font draw in customdraw in dbgid
« on: September 10, 2024, 10:28:00 am »
if set color in DBGrid1DrawColumnCell and call DefaultDrawColumnCell font draw another if not use custom draw. In picture attach up - standart draw, down - custom draw.

Code: Pascal  [Select][+][-]
  1. procedure TfrmMain.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  2.   DataCol: Integer; Column: TColumn; State: TGridDrawState);
  3. var
  4.   x, y: integer;
  5.   isSelect: boolean;
  6. begin
  7.   isSelect := ((gdFocused in State) or (gdSelected in State));
  8.   if (not isSelect) then begin
  9.     TDBGrid(Sender).Canvas.Font.Color := $00C04020;
  10.     TDBGrid(Sender).DefaultDrawColumnCell(Rect, DataCol, Column, State);
  11.   end;
  12. end;
  13.  

jamie

  • Hero Member
  • *****
  • Posts: 6579
Re: Font draw in customdraw in dbgid
« Reply #1 on: September 10, 2024, 11:00:54 pm »
Use "OnPrepairCanvas" to set the font and colors prior to painting.
The only true wisdom is knowing you know nothing

mikutu

  • New Member
  • *
  • Posts: 16
Re: Font draw in customdraw in dbgid
« Reply #2 on: September 12, 2024, 08:02:02 am »
thank you, it's work

 

TinyPortal © 2005-2018