I was wondering if someone has any ideas on creating a table / columns with
the RichEdit componet e.g.
Server Name OS HDD Space
Moose Win NT 4.0gb
Basically I'm having trouble lining up the detail with the column heading.
Any help would be appreciated.
Cheers
Stuart
Set tabstops and separate the items with tabs (#9 character) to align them to
the tabstops. The Paragraph.Tab property is somewhat broken, so better use
the API directly to set the tabstops.
The following method sets tabstops every 5 average character positions, based
on the current paragraphs font.
Uses richedit;
procedure TForm1.Button2Click(Sender: TObject);
Const
tabs : Array [0..5] of Integer = (5,10,15,20,25,30);
teststring = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
Var
pf: TParaFormat;
i : Integer;
charwidth : Integer;
begin
FillChar( pf, sizeof(pf), 0);
pf.cbSize := Sizeof( pf );
pf.dwmask := PFM_TABSTOPS;
pf.cTabCount := 6;
Canvas.Font.Assign( richedit1.SelAttributes );
charwidth := (Canvas.TextWidth( teststring ) * 1440)
div
(Screen.PixelsPerInch * Length(teststring));
// average charwidth in twips
For i:= 0 To High( tabs ) Do
pf.rgxTabs[i] := tabs[i] * charwidth;
If richedit1.perform( EM_SETPARAFORMAT, 0, Integer( @pf )) = 0
Then ShowMessage('Failed');
end;
Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.
Cheers
Stuart
"Peter Below (TeamB)" <10011...@compuXXserve.com> wrote in message
news:VA.00007b0...@antispam.compuserve.com...