掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
StringGridセル結合後のセル間ボーダーラインについて (ID:10007)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
あまりにも幼稚なプログラミングであげるのに勇気がいりますが、 出来ればセル結合を関数化したいと思っています。 procedure TForm1.FormCreate(Sender: TObject); begin Count:=0; StringGrid1.Cells[1,0]:='得 点'; StringGrid1.Cells[2,0]:='得 点'; StringGrid1.Cells[3,0]:='得 点'; StringGrid1.Cells[4,0]:='得 点'; StringGrid1.Cells[5,0]:='得 点'; end; procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); begin with StringGrid1 do begin DefaultDrawing:=true; if ARow = 0 then begin DefaultDrawing:=false; case ACol of 1 : Rect.Right := Rect.Right + ColWidths[2]; 2 : Rect.Left := Rect.Left - ColWidths[1]; end; case ACol of 2 : Rect.Right := Rect.Right + ColWidths[3]; 3 : Rect.Left := Rect.Left - ColWidths[2]; end; case ACol of 3 : Rect.Right := Rect.Right + ColWidths[4]; 4 : Rect.Left := Rect.Left - ColWidths[3]; end; case ACol of 4 : Rect.Right := Rect.Right + ColWidths[5]; 5 : Rect.Left := Rect.Left - ColWidths[4]; end; Canvas.Brush.Color := clBtnFace; Canvas.FillRect(Rect); //StringGrid1.Cells[1,0]、StringGrid1.Cells[2,0]には //前もって同じ文字列を入れてある。 DrawText(Canvas.Handle, PChar(Cells[ACol, ARow]), -1, Rect, DT_SINGLELINE or DT_VCENTER or DT_CENTER); end; end; end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.