设定StringGrid的属性
DefaultDrawing :=False; //不用系统默认风格 选择自己画
1、列合并
在 DataDrawCell 过程添加如下代码:
var
s:string;
d:TStringGrid;
begin
d:=TStringGrid(sender);
s:=d.Cells[ACol,ARow];
d.Canvas.Font.Assign(d.Font);//制定字体
with d.Canvas do
begin
Brush.Color := clWindow; //制定单元格颜色
if gdFixed in State then
Brush.Color := d.FixedColor;
Font.Color := clWindowText;
//下面是设定合并列 合并标题栏 和第四行
if ((acol=1) or (acol=3)) and ((ARow=0) or (ARow=4))then
rect.Right:=rect.Right+rect.Right-rect.Left;
if ((acol=2) or (acol=4)) and ((ARow=