掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
TStringGrid の OnDrawCell とソートを連動させるには (ID:149900)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
こんばんは。 OnDrawCellイベントのコードは以下のような感じです。 ***************** procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var Point:TPoint;//文字列の表示座標 i,j,nTosu,Code:integer; begin with StringGrid1.Canvas do begin//StringGrid1.Canvasの初期化 Brush.Color := clWhite; Font.Color := clBlack; Font.Size:=9; Font.Style:=[]; if gdSelected in State then Brush.Color:=clLime; end; with stringgrid1 do begin if((ARow= 0) and (ACol=1)) then with Canvas do begin font.color:=clred; brush.Color:=clwhite; end; if((ARow= 1) and (ACol=1)) then with Canvas do begin font.color:=clblue; brush.Color:=clblack; end; if((ARow= 2) and (ACol=1)) then with Canvas do begin font.color:=clyellow; brush.Color:=clgreen; end; if((ARow= 3) and (ACol=1)) then with Canvas do begin font.color:=claqua; brush.Color:=clblack; end; end; Point.x := Rect.Left; Point.y := Rect.Top; StringGrid1.Canvas.TextRect(Rect, Point.x, Point.y, StringGrid1.Cells[ACol,ARow]); end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.