[Lazarus] Fit TFrom's width so that it's caption isn't cut off?

Avishai avishai.gore at gmail.com
Sun Nov 17 18:11:19 CET 2013


I wish I knew the answer to your questions but I don't.  I was only
thinking that with the Text.Width you might be able to figure out an
answer.  I don't see how you could do it without that information, but
maybe there is better way.

On Sun, Nov 17, 2013 at 7:04 PM, Bart <bartjunk64 at gmail.com> wrote:
> On 11/17/13, Avishai <avishai.gore at gmail.com> wrote:
>
>> function GetTextHeight(ACtrl: TControl): Integer;
>> var
>>   C: TBitMap;
>> begin
>>   Result:= -1;
>>   C := TBitmap.Create;
>>   try
>>     C.Canvas.Font.Assign(ACtrl.Font);
>>     Result:= C.Canvas.TextHeight('TextHeight');
>>   finally
>>     C.Free;
>>   end;
>> end;
>>
>
> Is the canvas of the area where the caption is drawn the same as
> TForm's canvas, and is the font the same? I have no idea.
> And it does not take the bordericons into account.
>
> Bart
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



-- 
Shalom,
Avishai
avishai.gore at gmail.com
אבישי גוֹר




More information about the Lazarus mailing list