Why are my forms different sizes in Win2000 and XP?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In a winform desktop application I'm writing I've notice that the forms are different sizes, or at least the controls are in different positions depending on whether I'm working in Windows 2000 or Windows XP.

I have an infragistics UltraListBar that fits perfectly in my form in 2000, but in XP the bottom half of the last group is cut off. So, I thought it was something about the IG control. But, today on a form called as a dialog using ShowDialog, I noticed that my cancel and OK buttons are half chopped off by the bottom edge of the form.

What gives?
 
Visual Styles can change the size of a form and the size of it's controls. What
you'll
notice is that if you are setting the Size property somewhere, then most likely
you are
destroying any hope of a consistent application, since the Size is the total
size of the
form including non-client area. Often different border widths, the user
changing the
font size, other window decorations, etc... can all change the amount of client
area
available. This client area is set via ClientSize and you have to make sure it
holds
your controls and is set appropriately.

Even settting ClientSize might not be enough since controls can be larger
depending
on the system font and button decorations. If you are allowing the system to
render
the control, then you'll most certainly run into problems. Check your FlatStyle
and
make sure you aren't running into problems with system drawn controls.

I've not really run into this problem much as I render most of my controls
custom.
I'm sure some other users will have more details, tips, and tricks on getting
things up
and running. In the meantime maybe one of the above tips will help get you back
on
track.

--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

shamus said:
In a winform desktop application I'm writing I've notice that the forms are
different sizes, or at least the controls are in different positions depending
on whether I'm working in Windows 2000 or Windows XP.
I have an infragistics UltraListBar that fits perfectly in my form in 2000,
but in XP the bottom half of the last group is cut off. So, I thought it was
something about the IG control. But, today on a form called as a dialog using
ShowDialog, I noticed that my cancel and OK buttons are half chopped off by the
bottom edge of the form.
 
* =?Utf-8?B?c2hhbXVz?= said:
In a winform desktop application I'm writing I've notice that the
forms are different sizes, or at least the controls are in different
positions depending on whether I'm working in Windows 2000 or Windows
XP.

Are you using a different # of dpi on your machines?
 
Justin ( Herfried too )
Thanks for the reply. I apologize for not responding earlier but I was out of commission for a while on personal business.

I'm about to dig the documentation for further explanation of what you describe. Though I'm a little lost. I would think that I'm setting sizes all over the place as I'm resizing controls visually in the VS designer. Or is that not what you mean?

And please excuse my ignorance. I've been writing web apps for the last few years and am used to floating non-determinate layouts, but I've never written desktop code where I had to micro-manage the display of the controls, so I'm a little dismayed.

I don't know how taxing it would be to render the controls manually, but I shouldn't have to do that and unless it's simplistic I don't think I'll even consider it since there's probably no way I could get it into the project budget. And anyway I'm simply not a big fan of writing code to size everything properly in a desktop app. The framework should be able to draw its components properly. So I'd prefer another solution.

I take it from the docs that the ClientSize is defined as the width and height of the controls. Decorations and adornments can encroach on the client size? Why? So then there's no way to define a size. If that's correct then I may have some serious issues because each UI control contains its stuff properly, except for the form which does not. I can appreciate that the OS can allow the user to customize their visual experience, but the differentiation should be accounted for in the framework. It's something of a logical flaw. If a user sets their system font to 800 point wingDings, well, lions, tigers and bears. So, I'm not sure what to do.

You mentioned the FlatStyle property. I checked and it seems to be set to standard across the board. What should it be?
 
Back
Top