【问题标题】:Delphi 7 - TDBGrid styleDelphi 7 - TDBGrid 风格
【发布时间】:2012-09-29 13:08:57
【问题描述】:

如何在 Delphi 7 中使用程式化表格? 例如:

【问题讨论】:

标签: delphi tdbgrid


【解决方案1】:

如果您想以 TDbGrid 组件为主题,您可以使用 Jeremy North 和 Andreas Hausladen 的 Themed DBGrid runtime replacement

【讨论】:

  • 对 Delphi 7 和 Windows 7 无效。
  • 您是否将TXPManifest 组件添加到您的应用程序中?
【解决方案2】:

我在 Delphi 7 和 Windows 8.1 上为您编写并测试了这个示例

使用事件 DrawColumnCell 来改变颜色或其他东西。

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;

下载完整示例: file

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多