> You can use Graphics.MeasureString to get a size. You'll need to maybe use a
> fudge factor to account for the buttons and the icons.
[quoted text clipped - 28 lines]
> >
> > How can I do this? Thank you!
Thanks for all the help. This is what worked for me:
Dim formTitle As String = frmWizardTitle
Dim textFont As New Font("Trebuchet MS", 10, FontStyle.Bold,
GraphicsUnit.Point)
Dim textSize As New SizeF
Dim textFormat As New StringFormat
Dim charactersFitted As Integer
Dim linesFilled As Integer
' See how many characters will fit into the form's title
' 100 is approximately how much space in the form's title are taken
by the icon and the Minimize, Maximize, and Close buttons
textSize = e.Graphics.MeasureString(formTitle, textFont, _
New SizeF(Me.Width - 100, 10), _
textFormat, charactersFitted, linesFilled)
If charactersFitted < Len(frmWizardTitle) Then
Me.Text = Mid(formTitle, 1, charactersFitted - 1) & "...)"
End If
ThunderMusic - 29 Nov 2006 18:18 GMT
hi,
will it still work if I use Large fonts? If I change the font in my Windows
preferences, will work too? I don't know what you want to do with your
application, but I think those 2 questions should be worth looking at...
the answer to both questions here is 'no'... because you use a font with a
given name instead of getting the font from the user's preferences... ;)
it's not a big deal because most users won't change these settings.
Actually, most users don't even know they can change these settings, but for
those who know, it would be kind to think about them too... ;)
I hope it helps
ThunderMusic
> Thanks for all the help. This is what worked for me:
>
[quoted text clipped - 16 lines]
> Me.Text = Mid(formTitle, 1, charactersFitted - 1) & "...)"
> End If