473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How do I find the font size of the Title Bar?

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.

--
Christopher W. Douglas
SRS Technologies, Inc.
christopher (dot) douglas (at) srs (dot) com
Nov 20 '05 #1
3 2759
I suspect that you would have to look it up in the registry. I do not
remember the exact key, but I suspect that it is HKEY_CURRENT_USER\Control
Panel\Desktop\WindowMetrics or one of the associated ones.

HTH

David

"Christopher W. Douglas" <ch********************@SPAM.srs.com> wrote in
message news:OF**************@TK2MSFTNGP09.phx.gbl...
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.

--
Christopher W. Douglas
SRS Technologies, Inc.
christopher (dot) douglas (at) srs (dot) com

Nov 20 '05 #2
Thanks for your reply, and I will try it. However, does this make sense
that you HAVE to look in the registry to find this information? I mean, I
can get the font of a control with just txtBox.Font, or the font of the form
(labels as such) as me.Font. Why isn't there a SIMPLE means of getting the
title bar font for a form?

--
Christopher W. Douglas
SRS Technologies, Inc.
christopher (dot) douglas (at) srs (dot) com

"David Williams" <dw*******@strohlsystems.com> wrote in message
news:#c**************@TK2MSFTNGP09.phx.gbl...
I suspect that you would have to look it up in the registry. I do not
remember the exact key, but I suspect that it is HKEY_CURRENT_USER\Control
Panel\Desktop\WindowMetrics or one of the associated ones.

HTH

David

"Christopher W. Douglas" <ch********************@SPAM.srs.com> wrote in
message news:OF**************@TK2MSFTNGP09.phx.gbl...
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.

--
Christopher W. Douglas
SRS Technologies, Inc.
christopher (dot) douglas (at) srs (dot) com


Nov 20 '05 #3
* "Christopher W. Douglas" <ch********************@SPAM.srs.com> scripsit:
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):


Maybe p/invoke, a VB6 sample can be found here:

<http://vbaccelerator.nuwebhost.com/tips/vba0034.htm>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: PorkyJr | last post by:
Running an asp page that has the following code: <% response.Write MonthName(Month(date)) %> &nbsp; <% response.Write Day(date) %> ,
11
by: Petre Huile | last post by:
I have designed a site for a client, but they have hired an internet marketing person to incrase their search engine ranking and traffic. He wants to put extra-large fonts on every page which will...
4
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a...
2
by: iwdu15 | last post by:
ok, now i had a similar question involving changing colors from GDI to web, and i couldnt find a font translator class so here i am. I am trying to change rtf to html (w/o 3rd party extensions,...
15
by: srampally | last post by:
The following code works in firefox. But IE displays the hyperlink at font-size=13 rather than font-size=10. Why? If its a known IE bug, how should I fix it? I always want the hyperlinks to take...
7
by: xformer | last post by:
Hello everybody, today I was working on a web site when I found a strange effect. Take the following html document: ----begin---- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01...
30
by: Takehiko Abe | last post by:
I have a <pelement with <ttinside: ;;; <p>A paragraph contains <tt>tt element</tt>.</p> I would like to set the font-size of the TT to the same as the containing <p>. This does not seem to...
18
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin,...
3
by: PYG | last post by:
Hi everybody I have a simple question : If i use this code : <body style="font-size:24px;color:blue;"> Text in body <table> <tr><td> Text in table
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.