掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
XE2のStringGridで二重に表示されるのは? (ID:41347)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
>https://www.petitmonte.com/bbs/answers?question_id=7366 こっちの答えににもなるだけど TStringGrid = class(vcl.Grids.TStringGrid); procedure TForm2.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var X,Y,SH,SW :Integer; ARect: TRect; FOnDrawCell: TDrawCellEvent; S: String; C: TColor; begin FOnDrawCell := StringGrid1.OnDrawCell; StringGrid1.OnDrawCell := nil; if StyleServices.Enabled then Rect.Left := Rect.Left - 4; //背景再描画 if gdFixed in State then C := StringGrid1.FixedColor else C := StringGrid1.Color; StringGrid1.DrawCellBackground(Rect,C,State,ACol,ARow); //テキスト再描画 S := StringGrid1.Cells[ACol,ARow]; SW := StringGrid1.Canvas.TextWidth(S); SH := StringGrid1.Canvas.TextHeight(S); X := Rect.Left + ((Rect.Right - Rect.Left) - SW) div 2; Y := Rect.Top + ((Rect.Bottom - Rect.Top) - SH) div 2; if StyleServices.Enabled then begin ARect := System.Classes.Rect(X-6,Rect.Top,Rect.Right,Rect.Bottom); end else begin ARect := System.Classes.Rect(X-2,Y-2,Rect.Right,Rect.Bottom); end; StringGrid1.DrawCell(ACol,ARow,ARect,State); StringGrid1.OnDrawCell := FOnDrawCell; end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.