Hi.
I am using AdvStringGrid.
When the MergeCells function is used together with the HideColumns function, it becomes abnormal operation.
Using BDS2007 on Windows 7.
A detailed code is as follows.
1.AdvStringGrid is initialized.
procedure TForm1.FormCreate(Sender: TObject);
var
i: Integer;
j: Integer;
begin
AdvStringGrid1.RowCount := 6;
AdvStringGrid1.ColCount := 6;
for i := 0 to 5 do
begin
for j := 0 to 5 do
begin
AdvStringGrid1.Ints[i, j] := i;
end;
end;
end;
2.The cell is merged.
procedure TForm1.Button1Click(Sender: TObject);
begin
AdvStringGrid1.MergeCells(1, 0, 2, 1);
end;
3.The cell is HideColumns.
procedure TForm1.Button2Click(Sender: TObject);
begin
AdvStringGrid1.HideColumns(1, 2);
end;
A different cell is merged.
Is it a bug?
It is currently a limitation of cell merging that it can’t be combined with column hiding this way.
A workaround for this problem is to first unmerge (split) the merged cells and then apply the HideColumns function.