Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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:

  • Form height: 383
  • Form Width: 707
  • Split container height: 321
  • Split container Width: 691
  • Splitter distance: 380

When I load the project on the laptop, the specifications are changed to this:

  • Form height: 419
  • Form Width: 859
  • Split container height: 397
  • Split container Width: 921
  • Splitter distance: 380

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
272 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.

You can look at Control Panel | Appearance and Personalization | Display to find those settings:

  • Smaller - 100% = 96 DPI
  • Medium - 125% = 120 DPI
  • Larger - 150% = 144 DPI

You can look into the WinForms Scaling options if it's the DPI having an effect and what to adjust appropriately.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...