掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
StringGrid上での色の指定をするには (ID:218)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
1,2のサンプルです。 セルの内容の描画も必要ですが、ここではしていません。 適宜修正してください。 # 先頭の空白に、全角空白を使っています。 procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); begin if gdFixed in State then begin // 固定セル Exit; end else if gdSelected in State then begin // 選択中 StringGrid1.Canvas.Brush.Color := clYellow; StringGrid1.Canvas.FillRect(Rect); StringGrid1.Canvas.Pen.Color := clRed; StringGrid1.Canvas.Rectangle(Rect); INC(Rect.Left); INC(Rect.Top); DEC(Rect.Right); DEC(Rect.Bottom); StringGrid1.Canvas.Rectangle(Rect); end else begin // 非選択中 StringGrid1.Canvas.Brush.Color := clWindow; StringGrid1.Canvas.FillRect(Rect); end; end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.