I think what you mean is the FONT to be formatted the same on all lines.
for that, you don't use a true type font.
Use a raster type font. try the SYSTEM font..
> [...] I want that text in this TMemo is align vertically.
What do you mean by that?
Groetjes,
Maarten Wiltink
****************************
* *
* My text *
* *
****************************
I have solved this problem changing value to margin top in function of
lenght of text (if one, two or more row). But i have hoped in a better
solution.
Thanks again.
Cooper.
Here's one which counts the lines for you.
var
TextHt, MemoLines, TextLines, TopLines, i : integer;
begin
TextHt := -1 * Memo1.Font.Height;
MemoLines := (Memo1.Height - 2) div TextHt;
Memo1.Lines.BeginUpdate;
Memo1.Text := '';
Memo1.Text := MyText;
TextLines := Memo1.Lines.Count;
TopLines := (MemoLines - TextLines) div 2;
for i := 1 to TopLines - 1 do
Memo1.Lines.Insert(0,' ');
Memo1.Lines.EndUpdate;
end;
> But i have hoped in a better
> solution.
You could draw on the Form's surface on TForm.Canvas, or on a
TIMmage.Canvas on the form. Set .Canvas.Brush.Color & use FillRect to
draw the background. Then DrawText() with DT_CALCRECT to get the
rectangle containing the text & then placing that on the background
with another DrawText() call.
DrawText() is a windows API - look in Win32 Help.
Alan Lloyd
Thanks very much :) i try.
>>>> [...] I want that text in this TMemo is align vertically.
>>>
>>> What do you mean by that?
>>
>> for example try with a simple design:
>>
>> ****************************
>> * *
>> * My text *
>> * *
>> ****************************
>>
>> I have solved this problem changing value to margin top in function of
>> lenght of text (if one, two or more row). But i have hoped in a better
>> solution.
>
> Have you tried using TAB characters in the strings?
Vertical tabs?
Groetjes,
Maarten Wiltink