Window size wrong in windows 7, labels and buttons hiding behind window border.
Hello!
I have a problem with an application made in Visual studio 2010. I have tested my program in win XP SP3. Everything works fine.
Now i put my application to win7 machine, all functions work fine but some of the window sizes are wrong. Some text goes hidden behind the window border and half button goes behind window border . Basically the window is smaller than it´s contents.
How do I fix it? Have to check something in the form properties in vb?
Re: Window size wrong in windows 7, labels and buttons hiding behind window border.
Are you sure the form size is wrong? Have you actually checked what the Size it is on both OSes? It may be a DPI issue, especially if one system is a laptop and another isn't.
In most cases a form should be able to support a range of sizes without mangling the layout anyway. You might like to follow the CodeBank link in my signature and check out my thread on Dock & Anchor to see how to achieve that.
Re: Window size wrong in windows 7, labels and buttons hiding behind window border.
Thank you for replying.
I am not so sure that the window size is different in win 7. It couldn't because I have set it in VB to be (for exaple 300;300) - so window size should stay the same in both OS's? What I know is that the resolution is not the same as win xp machine.
I have found that the so called distortion has something to do with forms autoscale properties?
So basically I should dock & anchor my labels and buttons to view them properly?
Re: Window size wrong in windows 7, labels and buttons hiding behind window border.
I've never actually encountered a situation where I've needed to do this myself, so I don't know all the details, but you could try changing the AutoScaleMode of the form. I believe that the default is Font and you may be able to solve your issue by setting it to Dpi. That's why I asked about one system being a laptop: they sometimes have a different DPI setting to other systems.
Re: Window size wrong in windows 7, labels and buttons hiding behind window border.
I have tried different form settings and seems that the issue is solved when:
form AutoSize = True
Contents(labels, pictures, buttons) are anchored top, left (haven't used this setting yet, but it should work)
Form AutoScale = DPI
Right now I have set the contents anchor to left, top, right, bottom and this messes up the picture box and button size. But nothing goes hidden behind window border :)
Re: Window size wrong in windows 7, labels and buttons hiding behind window border.
You're obviously misusing the Anchor property. Follow the instructions from my first post to learn how to use it properly.
Re: Window size wrong in windows 7, labels and buttons hiding behind window border.
Hello again!
Changed the form autosize to true and anchored all controls properly.
Everything is displayed correctly(labels, pictureboxes), but the button(designed to be in the bottom center of the form) still get half hidden behind bottom border(anchor: left, bottom, right).
Try to set the form height manually to force the button to show itself fully.