掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
DBGridの背景色に一行置きに色をつけるには? (ID:28691)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
そしての部分は DBGridEx の OnDrawColumnCell イベントです。 オブジェクトインスペクタのイベントの OnDrawColumnCell をダブルクリックすると procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin end; と自動的に作成されるので、ここを procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); var C : TColor; begin if (SaveRow mod 2) = 0 then C := clRed else C := clBlue; DBGridEx1.Canvas.Brush.Color := C; DBGridEx1.DefaultDrawColumnCell(Rect,DataCol,Column,State); end; というふうに書き換えてください。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.