dcsimg
Results 1 to 11 of 11

Thread: controls and form sizing

  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
    Join Date
    Sep 2017
    Posts
    687

    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
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,495

    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.

  4. #4

    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.

  5. #5

    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.

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

    Re: controls and form sizing

    Can you post a picture of before and after the resizing occurs?

  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
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    100,637

    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.
    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

  9. #9

    Thread Starter
    Member
    Join Date
    Jun 2017
    Location
    Ohio
    Posts
    47

    Re: controls and form sizing

    what is WPF?

  10. #10

    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.

  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
  •  



Featured


Click Here to Expand Forum to Full Width