2012-09-29 50 views
0

如何在Delphi 7中使用風格化表格? 例如:Delphi 7 - TDBGrid風格

enter image description here

+0

你舉的例子是不是一個真正的 '風格' 更多的是 '定製'。一種方式在這裏:http://delphi.about.com/od/usedbvcl/l/aa031699.htm – philnext

+0

philnext,no。不僅是顏色。 – newpdv

回答

5

如果你的意思是你想爲主題的TDBGrid組件,您可以使用從傑里米朝鮮和Andreas Hausladen的Themed DBGrid runtime replacement

+0

對Delphi 7和Windows 7沒有影響。 – newpdv

+1

您是否將'TXPManifest'組件添加到您的應用程序中? – RRUZ

+1

哦,謝謝!很好! – newpdv

1

我寫的,併爲你測試德爾福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