For some time now, a few people who have been using my application has complained about some strange behaviour in how the WinForm is being drawn.
The form has one splitcontainer
with panel1
being fixed.
I have not been able to reproduce their problems, until today.
I just installed the app on a laptop running a 32 bit version of Win7 enterprise. (app is built and running without problem on my computer running 64 bit version of Win7 ent.)
To see what was going on, I copied the project files over to the laptop and opened it with Visual Studio 2012 to see what was going on. However, is has me stunned as I don't know what do do about it.
On the dev. machine (my 64 bit win7 ent), the specifications for the form (and split container) sizes are as follows:
When I load the project on the laptop, the specifications are changed to this:
Now I can finally understand the frustration with some people not being able to see the program as how it is supposed to be seen.
On the 32 bit machine, the splitter is partly covering a few buttons, which obviously making the program hard to use since they can't see the text.
Is there any reason why this happens?
I mean, if the original code is set to a specific size value, isn't that how it should be no matter where the program is run? (Given the user doesn't resize of course).
And then most importantly, is there any way I can solve this without having to build two separate versions?
You can restrict the size of a form by setting it's MaximumSize and MinimumSize properties. This will help you control the maximum and minimum size the form can be resized to. Also note that WindowState property of the form plays a part in how the form can be resized.
To make a control resize with the form, set the Anchor to all four sides, or set Dock to Fill . It's fairly intuitive once you start using it. For example, if you have OK/Cancel buttons in the lower right of your dialog, set the Anchor property to Bottom and Right to have them drag properly on the form.
You can resize individual controls, and you can resize multiple controls of the same or different kind, such as Button and GroupBox controls.
Resizing of the form can be disabled by setting the FormBorderStyle property of the form to `FixedDialog`, `FixedSingle`, or `Fixed3D`.
They could be running their systems at a different DPI (Dots Per Inch), and so this is changing the way the controls are positioned and scaled on the Windows Form due to the scaling options and affect on the font size.
http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/72995739-60a4-44cd-ba51-fc8be726cba4
http://discuss.joelonsoftware.com/default.asp?dotnet.12.664790.5
You can look at Control Panel | Appearance and Personalization | Display to find those settings:
You can look into the WinForms Scaling options if it's the DPI having an effect and what to adjust appropriately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With