Results 1 to 11 of 11

Thread: controls and form sizing

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2017
    Location
    Ohio
    Posts
    47

    controls and form sizing

    on some computers my controls and other objects on my forms become jumbled(wrong location(s)) and it is caused by the display Font size setting. how do you setup a form and controls to adjust when different resolutions and font sizes are used?

  2. #2
    Fanatic Member kpmc's Avatar
    Join Date
    Sep 2017
    Posts
    1,012

    Re: controls and form sizing

    Use the TableLayoutPanels and docking.

    When opening the form i set these properties
    Code:
                Dim MatrixForm As New frmMatrix(Me)
                MatrixForm.Height = Screen.PrimaryScreen.Bounds.Height - 75
                MatrixForm.Width = Screen.PrimaryScreen.Bounds.Height - 75
                MatrixForm.StartPosition = FormStartPosition.CenterScreen
                MatrixForm.Location = New Point(10, 10)
                MatrixForm.ShowDialog()

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2017
    Location
    Ohio
    Posts
    47

    Re: controls and form sizing

    Quote Originally Posted by kpmc View Post
    Use the TableLayoutPanels and docking.

    When opening the form i set these properties
    Code:
                Dim MatrixForm As New frmMatrix(Me)
                MatrixForm.Height = Screen.PrimaryScreen.Bounds.Height - 75
                MatrixForm.Width = Screen.PrimaryScreen.Bounds.Height - 75
                MatrixForm.StartPosition = FormStartPosition.CenterScreen
                MatrixForm.Location = New Point(10, 10)
                MatrixForm.ShowDialog()
    I checked that out and it's not my problem. the combo boxes and textboxes for example actually changed locations until I decreased the font size of the display and this was in a laptop computer. the actual size of the form is not an issue.

  4. #4
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,753

    Re: controls and form sizing

    I started programming in Visual Basic .NET, but when I started web development I got very jealous of how much more aesthetically pleasing it was. Now whenever program in Visual Basic .NET I do the following:
    • Change the Form's font to Segoe UI, 16px
    • Add a TableLayoutPanel to structure the layout
    • Allow "container" controls (such as Panels, GroupBoxes, etc.) to be auto-resized and for them to grow or shrink


    It takes a little bit longer to design the Form, but it looks a lot better and it is much more consistent throughout deployment.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2017
    Location
    Ohio
    Posts
    47

    Re: controls and form sizing

    Quote Originally Posted by dday9 View Post
    I started programming in Visual Basic .NET, but when I started web development I got very jealous of how much more aesthetically pleasing it was. Now whenever program in Visual Basic .NET I do the following:
    • Change the Form's font to Segoe UI, 16px
    • Add a TableLayoutPanel to structure the layout
    • Allow "container" controls (such as Panels, GroupBoxes, etc.) to be auto-resized and for them to grow or shrink


    It takes a little bit longer to design the Form, but it looks a lot better and it is much more consistent throughout deployment.
    I checked that out and it's not my problem. the combo boxes and textboxes for example actually changed locations until I decreased the font size of the display and this was in a laptop computer. the actual size of the form is not an issue.

  6. #6
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,753

    Re: controls and form sizing

    Can you post a picture of before and after the resizing occurs?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  7. #7

    Thread Starter
    Member
    Join Date
    Jun 2017
    Location
    Ohio
    Posts
    47

    Re: controls and form sizing

    Quote Originally Posted by dday9 View Post
    Can you post a picture of before and after the resizing occurs?
    it's on a customers laptop computer so it's not easy but I will try to re-create it on my laptop.

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: controls and form sizing

    It's likely a DPI issue. You can change the AutoSizeMode (I think) of the form from Font to Dpi and that may give some relief. Windows Forms was developed before high-DPI monitors became common though, so there may be some situations where you just can't make a form look good in every case. WPF, which was developed from the ground up with this sort of thing in mind, avoids these issues.

  9. #9

    Thread Starter
    Member
    Join Date
    Jun 2017
    Location
    Ohio
    Posts
    47

    Re: controls and form sizing

    Quote Originally Posted by jmcilhinney View Post
    It's likely a DPI issue. You can change the AutoSizeMode (I think) of the form from Font to Dpi and that may give some relief. Windows Forms was developed before high-DPI monitors became common though, so there may be some situations where you just can't make a form look good in every case. WPF, which was developed from the ground up with this sort of thing in mind, avoids these issues.
    I tried the DPI and it had no effect.

  10. #10

    Thread Starter
    Member
    Join Date
    Jun 2017
    Location
    Ohio
    Posts
    47

    Re: controls and form sizing

    what is WPF?

  11. #11

    Thread Starter
    Member
    Join Date
    Jun 2017
    Location
    Ohio
    Posts
    47

    Re: controls and form sizing

    Quote Originally Posted by VbRon399 View Post
    what is WPF?

    I searched on the internet and I found WPF.

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