Hi,
I am using advanced string grid to show multiline cells without word wrap; currently I can get autosizing for cell width to work, but height does not work properly, not tall enough - neither autoSizeRows/Columns nor autoSizeCells help.
A quick test setup works as follows: open a new form, place an AdvStringGrid and 2 buttons, one for autosize column/row test and one for autosize Cell. Code like below - anyone have an idea how to get the height right?
unit FORM_Test;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, AdvGlowButton, Grids, AdvObj, BaseGrid, AdvGrid;
type
TASG_Form = class(TForm)
ASGrid: TAdvStringGrid;
AGBTN_ColRow: TAdvGlowButton;
AGBTN_Cell: TAdvGlowButton;
procedure AGBTN_ColRowClick(Sender: TObject);
procedure AGBTN_CellClick(Sender: TObject);
private
{ Private-Deklarationen }
procedure FillCells;
public
{ Public-Deklarationen }
end;
var
ASG_Form: TASG_Form;
implementation
{$R *.dfm}
procedure TASG_Form.FillCells;
begin
with ASGrid do begin
MultilineCells := true;
WordWrap := false;
ClearAll;
ColCount := 3;
RowCount := 3;
Cells[0,0] := 'consetetur sadipscing elitr LAST WORDS';
Cells[1,1] := 'sanctus est consetetur sadipscing' + sLineBreak
+ 'consetetur sadipscing elitr' + sLineBreak
+ 'invidunt ut labore et dolore magna LAST WORDS';
Cells[2,2] := 'consetetur sadipscing elitr' + sLineBreak
+ 'sanctus est' + sLineBreak
+ 'clita kasd gubergren' + sLineBreak
+ 'consetetur sadipscing' + sLineBreak
+ 'lorem ipsum dolor sit amet' + sLineBreak
+ 'invidunt et LAST WORDS';
end;
end;
procedure TASG_Form.AGBTN_ColRowClick(Sender: TObject);
begin
FillCells;
ASGrid.AutoSizeColumns (true);
ASGrid.AutoSizeRows (true);
end;
procedure TASG_Form.AGBTN_CellClick(Sender: TObject);
begin
FillCells;
ASGrid.AutoSizeCells(true, 5, 0);
end;
end.
Thanks for your help!