Delphi 7 - TDBGrid style

痴心易碎 提交于 2020-01-06 08:10:39

问题


How to use stylized table in Delphi 7? For example:


回答1:


If you mean which you want themed the TDbGrid component, you can use the Themed DBGrid runtime replacement from Jeremy North's and Andreas Hausladen.




回答2:


I wrote and tested for you this example on Delphi 7 and Windows 8.1

Use Event DrawColumnCell to change color or something else.

procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
  try
    if Column.FieldName = 'FIRST_NAME' then
      DBGrid1.Canvas.Brush.Color := clGreen;
  finally
    DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
  end;
end;

Download full example: file



来源:https://stackoverflow.com/questions/12652955/delphi-7-tdbgrid-style

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!