Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / General / November 2004

Tip: Looking for answers? Try searching our database.

Large Font/ Small Font

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JohnL - 29 Nov 2004 18:09 GMT
I am developing a dialog-based Win32 application with Visual C++ 6.0.

I recently encountered a problem when testing my software in computers with
different OS and screen settings such as the font size. For Win2K, my
application only works small font, when under big font, the following
problem were observed:

1) The size of Bitmap necomes smaller than the size of dialog.
2) The text of ComboBox control looks smaller.
3) The plots I draw with GDI object deviate from their original locations.

For WinXP, different size of DPI will cause same problems.

Does anybody know how to make my application work for both cases?

I replaced the default "MS Sans Serif" font with "MS Shell Dlg" in the
resource file as Sev suggested, but it does not help. I also inserted a
placeholder for all bitmaps as Alexander suggested, and it worked. However,
I would like to know if there is any easier way for my application to
support different font settings.

John
Tim Robinson - 30 Nov 2004 12:10 GMT
[...]
> 1) The size of Bitmap necomes smaller than the size of dialog.
> 2) The text of ComboBox control looks smaller.
[quoted text clipped - 3 lines]
>
> Does anybody know how to make my application work for both cases?
[...]

There are a couple of ways:
-- Look at GetSystemMetrics(SM_LOGPIXELSX) and SM_LOGPIXELSY to obtain
the number of pixels per inch in each direction
-- Computer your measurements relative to the pixel size of
GetStockObject(DEFAULT_GUI_FONT), which depends on SM_LOGPIXELSX/Y

See "DPI Problem on dialogs" (microsoft.public.win32.programmer.ui, 25
Nov 2004) for what happens to dialog boxes. I recommend that you code to
cope with changing DPI settings, instead of resizing your dialogs,
controls and fonts to what you expect them to be.

A good habit is to develop with a setting of Large Fonts, then use Small
Fonts occasionally to test.

Signature

Tim Robinson (MVP, Windows SDK)
http://mobius.sourceforge.net/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.