C
Christopher W. Douglas
I am developing an application in VB.NET using Visual Studio 2003. I have a
dialog box where the title may be somewhat long, so I want to resize the
window to fit the entire title. I already know to use CreateGraphics to
measure the length of the string, so my code is something like this (from
the Load event):
objGraphics = CreateGraphics()
objFont = System.Windows.Forms.SystemInformation ??????
intTextLength = cint(objGraphics.MeasureString(Text, objFont).Width)
if intTextLength > Width Then
Width = intTextLength
end if
The problem is, I can't find a simple way to get the Font size of the title
bar of the window. I already Googled for "active title bar" and found a
reference to "System.Windows.Forms.SystemInformation", but none of the
properties there seem to apply. I would think this is a straightforward
thing, to get the current user's settings for Title Bar font size, but it
eludes me. Any help would be appreciated.
dialog box where the title may be somewhat long, so I want to resize the
window to fit the entire title. I already know to use CreateGraphics to
measure the length of the string, so my code is something like this (from
the Load event):
objGraphics = CreateGraphics()
objFont = System.Windows.Forms.SystemInformation ??????
intTextLength = cint(objGraphics.MeasureString(Text, objFont).Width)
if intTextLength > Width Then
Width = intTextLength
end if
The problem is, I can't find a simple way to get the Font size of the title
bar of the window. I already Googled for "active title bar" and found a
reference to "System.Windows.Forms.SystemInformation", but none of the
properties there seem to apply. I would think this is a straightforward
thing, to get the current user's settings for Title Bar font size, but it
eludes me. Any help would be appreciated.