[Description of problems with sizing labels for differing DPI screens]
Is there any better solution than just making the labels excessively
tall and wide to make sure everything from normal to large fits?
Is it not possible to size them dynamically? I'm guessing that there
must be a way to retrieve the DPI settings from Windows, but I haven't
attempted to understand this problem myself from a programming point
of view, as yet.
I've looked into this in the past - ok - it was only a few minutes:) -
but the approach is to use a form of dynamically positioning. There are
standards out there with some standard formulas that can be used - doing
a google should bring them up. From memory, delphi was the only dev
toolset that seemed to be able to handle different DPI settings
"automatically".
Read up on MSDN about dialog units - they're not only applicable to
dialog boxes. Technically the correct way to do this is to design your
window in dialog units sizes, and then convert the dialog units to
pixels when you create the window - the conversion takes into account
the size of the font used by the window. I posted some code to do these
conversion to the list some time ago - if you can't find it in the
archive, let me know and I'll see if I can dig it out again.
To do things completely correctly there's a windows message you can
process that tells you when someone changes the system font size, so
that you can re-calculate and re-draw all your windows - I've only seem
a couple of applications that support this.
Here are a couple of references to get you started (urls may wrap):
http://msdn.microsoft.com/library/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/getdialogbaseunits.asp
http://msdn.microsoft.com/library/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/mapdialogrect.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch14e.asp
Regards,
Rob.
--
Robert May
Win32::GUI, a perl extension for native Win32 applications
http://perl-win32-gui.sourceforge.net/