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 / Languages / Managed C++ / October 2007

Tip: Looking for answers? Try searching our database.

Form size differs in different OS's?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Oliphant - 23 Oct 2007 15:46 GMT
I'm developing a program at home on a Windows Vista computer. In it I create
a form with a few buttons on it that fill up the form's visible area.

So, I took the application to work, where I use a Windows XP PRO computer.
When I ran my program, the form visible area is different! Not very much,
but it is obvious. I haven't done experiments yet, but it looks like the
form is slightly wider and slightly shorter. I now have extra space on the
right of my buttons as well as the bottom clipping of the bottom button.

Why is this the case? And, more to the point, is there a way of detecting
what the actually VISIBLE size is to a form when establishing its size
(Width,Height) at RUNTIME? Or is this something to do with the coordinate
system being different (e.g., one OS considers the form boundary as part of
the size/space, the other does not, or differing amountsbased on some sort
of 'style'). I guess I could just add extra space to be sure, but this
behavior seems weird to me...

[==Peter==]
Carl Daniel [VC++ MVP] - 23 Oct 2007 16:59 GMT
> I'm developing a program at home on a Windows Vista computer. In it I
> create a form with a few buttons on it that fill up the form's
[quoted text clipped - 13 lines]
> could just add extra space to be sure, but this behavior seems weird
> to me...

This is, most likely,  due to a difference in font rendering resolution
between the two systems (e.g. one at 96dpi and one at 100dpi).  This is not
at all uncommon if one of the machines is a laptop and the other not.

Yes, you can make your program adapt by setting the right properties
(particularly AutoSize and the autosize mode property) on all of the
controls, containers and forms.  I can't give you a recipe from memory - I'm
sure I'd miss something, because it does take a lot of fuss to make a forms
layout that looks "the same" on different resolutions, but it can be done.

-cd
Peter Oliphant - 23 Oct 2007 21:35 GMT
Thanks Carl! It's not too big a deal, the difference is a few pixels, so if
I just make it big enough for every case I'll be good! :)

[==Peter=]

>> I'm developing a program at home on a Windows Vista computer. In it I
>> create a form with a few buttons on it that fill up the form's
[quoted text clipped - 26 lines]
>
> -cd

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.