[Gambas-user] Control widths, fonts, desktop scales, strings and a bad memory

Tony Morehen tmorehen at ajm-software.com
Mon Sep 3 15:26:31 CEST 2018


AutoResize affects both the width and the height of a control. This 
makes it very useful when you are trying to fit a control to match an 
image.  However, this can mess up the vertical alignment of other 
controls such as textboxes.  Perhaps we could add an RestrictAutoResize 
property (restrict to Width, Height, Both, defaulting to both)

On 2018-09-03 4:35 a.m., Benoît Minisini wrote:
> Le 03/09/2018 à 09:42, Me a écrit :
>> In the back of my mind there is a tiny hope that some time ago 
>> someone had a way to (approximately) work out whether..
>> "Will this string fit into the current control width?"
>>
>> Anyone out there with a good memory?
>>
>> tia
>> b
>>
>>
>
> You can't, because you can't know where a control draws its text, how 
> it draws it, and if it has a border, inner padding, and so on.
>
> Some controls have an AutoResize property to deal with that for you.
>
> Otherwise you must use the Control.Font.TextWidth() method and add 
> some approximate padding.
>
> Regards,
>



More information about the User mailing list