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

Gianluigi bagonergi at gmail.com
Mon Sep 3 11:28:26 CEST 2018


Il giorno lun 3 set 2018 alle ore 09:43 Me <adamnt42 at gmail.com> ha scritto:

> 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
>

Do you mean something like this?

Private $sString As String = "Will this string fit into the current control
width?"

Public Sub Form_Open()

  TextBox1.Text = $sString

End

Public Sub Form_Resize()

  Dim iWBox As Integer

  iWBox = TextBox1.W

  With TextBox1
    While .Font.TextWidth($sString) + 16 > iWBox
      .Font.Size -= 0.1
    Wend
  End With

End

Regards
Gianluigi


>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20180903/728d7618/attachment-0001.html>


More information about the User mailing list