掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
StringGridセル結合後のセル間ボーダーラインについて (ID:10011)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
物わかりが悪くて何回もすみません。コードの意味がよく分からなかったのですが、下記でうまくセンタリングもかかりました。 セル結合を1つのセル毎に結合していました。結合したいセルの左で右範囲を指定し、右で左範囲を指定すればよいのですね。 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]+Colwidths[3]+Colwidths[4]; //2列目の描画 5 : Rect.Left := Rect.Left - ColWidths[4]- ColWidths[3]- ColWidths[2]- ColWidths[1]; 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.