Results 1 to 7 of 7

Thread: VB.NET Form AutoScale Problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2021
    Posts
    191

    VB.NET Form AutoScale Problem

    Hi All... I am just struggling here with a form and getting a "universal" layout when using on several computers/screens. I think I have read so many things on this that I am totally lost on what the rule should be when creating a form that should look the way I want on almost any computer. The attached picture is what I am dealing with on a real simple form. The top section is of course how I want it to look, the bottom section is how it looks on a couple other computer screens. Both computers running WIN10, but monitors are of different size. I have made some changes to DPI, FONT etc. Made my Font sizes the same, but I just cant seem to get it right. Any suggestions?
    Attached Images Attached Images  

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: VB.NET Form AutoScale Problem

    I’d use a tablelayoutpanel, with dock = fill (whole form). Add columns and rows to your TLP, then use anchoring or docking in the TLP cells to align your controls in a uniform layout. That’s my best advice. Think yourself lucky you’re not trying to layout controls with Java Swing l

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2021
    Posts
    191

    Re: VB.NET Form AutoScale Problem

    Thanks paul... I have not used a TLP before. So this on Form_Load?
    Code:
     
    Me.TableLayoutPanel1.Dock = DockStyle.Fill
    So the idea is to have one control in one TLP cell?

  4. #4
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: VB.NET Form AutoScale Problem

    On a side note, people with these kinds of needs should really look into learning WPF. WPF handles this sort of thing very naturally.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  5. #5
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: VB.NET Form AutoScale Problem

    Quote Originally Posted by mikeg71 View Post
    Thanks paul... I have not used a TLP before. So this on Form_Load?
    Code:
     
    Me.TableLayoutPanel1.Dock = DockStyle.Fill
    So the idea is to have one control in one TLP cell?
    You can add containers to cells within a TableLayoutPanel(TLP) to give more flexibility, even another TLP.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jan 2021
    Posts
    191

    Re: VB.NET Form AutoScale Problem

    Thanks for all of the thoughts and ideas on this, I am just now playing around with it. Not sure why, but here is what it looks like at runtime. You can see my TLP cell height, but it expands the labels much higher. I have the labels docked to the bottom. What seems to cause me some trouble is the group-boxes they don't stay in really good alignment with my textboxes.

    **Edit: I left out "Me.TableLayoutPanel1.Dock = DockStyle.Fill" on Form_Load and it looks ok now. Still a long way to go for understanding all of the controls.
    Attached Images Attached Images  
    Last edited by mikeg71; Feb 9th, 2022 at 05:18 PM.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jan 2021
    Posts
    191

    Re: VB.NET Form AutoScale Problem

    Hi All... I have a project with listbox drag & drop. Do I need to reference the TableLayoutPanel at all when I use it?

Tags for this Thread

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