掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
StringGridセルの結合で・・・ (ID:17246)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
結合の仕方は違いますが、うまくいっている例です。 参考になれば・・・ procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); begin with TStringGrid(Sender) do begin if ((ACol < 6) and (gdFixed in State) and (ARow < 2)) then begin case ARow of 0 : Rect.Bottom := Rect.Bottom + RowHeights[1]; 1 : Rect.Top := Rect.Top - (RowHeights[0] + 1); end; Canvas.Brush.Color := clBtnFace; Canvas.Font.Color := clBlack; Canvas.FillRect(Rect); DrawEdge(Canvas.Handle, Rect, BDR_RAISEDINNER, BF_RECT); DrawText(Canvas.Handle, PChar(Cells[ACol, ARow]), -1, Rect, DT_SINGLELINE or DT_CENTER or DT_VCENTER); end else begin Canvas.Font.Color := clBlack; if gdFixed in State then begin Canvas.Brush.Color := clBtnFace; Canvas.FillRect(Rect); DrawEdge(Canvas.Handle, Rect, BDR_RAISEDINNER, BF_RECT); end else begin Canvas.Brush.Color := clWindow; Canvas.FillRect(Rect); end; DrawText(Canvas.Handle, PChar(Cells[ACol, ARow]), -1, Rect, DT_SINGLELINE or DT_CENTER or DT_VCENTER); end; if gdFocused in State then Canvas.DrawFocusRect(Rect); end; end; procedure TForm1.Button1Click(Sender: TObject); var C, R: Word; begin for R := 0 to Pred(StringGrid1.RowCount) do begin for C := 0 to Pred(StringGrid1.ColCount) do begin StringGrid1.Cells[C, R] := inttostr(C) + ' , ' + inttostr(R); end; end; end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.