Results 1 to 7 of 7

Thread: Window size wrong in windows 7, labels and buttons hiding behind window border.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2012
    Posts
    75

    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?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2012
    Posts
    75

    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?
    Last edited by lkallas; Sep 17th, 2012 at 03:18 AM.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 2012
    Posts
    75

    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

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Aug 2012
    Posts
    75

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width