Library tutorials & articles

Planning Form Layout in VB.NET

Introduction

This article shows you how to design fairly complicated forms, which can resize, using anchors, docks and panels with a dash of code.

Most of you would have heard of, and even used the new anchoring and docking properties available to the windows form controls in VB.NET. They enable controls to resize or reposition themselves as the form resizes, without writing code.

I was definitely excited about these new features. Think of the huge amount of time saved writing stupid, nonproductive resizing code just to make the forms look the same.

Comments

  1. 01 Sep 2008 at 12:58
    It is difficult to design fairly complicated forms by simply using anchors and docks. .Net provides two layout manager Flow layout panel and Table Layout Panel. However you need to use a good layout manager for professional form designing, e.g. SmartLayouts .
  2. 28 Oct 2003 at 05:21

    I would use 4 panels in the following way:
    1) one up (this is the extra panel that is not in your example). Set the Dock property to this one to Top and set the Height to whatever you want.
    2) The Green panel will be inside the panel one. Set the Dock property to Left and set the Width to whatever you want
    3) The Bleu panel also inside the panel one. Set the Dock property to Fill.
    4) The fourth panel (the Red one) comes bottom (as child of the form) with Dock set to Fill. (this is also a difference to your example)


    The rest of the things are the same.
    What we have accomplished with the fourth panel ? The fact that the Height of the Blue/Green panels is fixed to the height of the Panel One, so no coding is necessary to keep the height fix.


    The only problem left is that the Width of the Green panel is fixed and when the form is made wider it does not resize. So the only code necesary is to make the
    Green panel wider according with the width of the form.


    Best regards,
    Dan

  3. 15 Dec 2002 at 07:55

    good work - and helpful!

  4. 07 Mar 2002 at 23:58


    Good one ! Keep it up ...

  5. 07 Mar 2002 at 03:05

    This is very very very nice


    [6]keep it up[/6]


    good work


  6. 01 Jan 1999 at 00:00

    This thread is for discussions of Planning Form Layout in VB.NET.

Leave a comment

Sign in or Join us (it's free).

Benny K. Mathew Benny Mathew is the Founder, CEO of Seamless Integration Solutions Pvt. Ltd. He has 10+ years of formal experience in the IT industry and has provided services to many of the well known multi-natio...

Related podcasts

  • xpert to Expert: Inside Concurrent Basic (CB)

    "Concurrent Basic extends Visual Basic with stylish asynchronous concurrency constructs derived from the join calculus. Our design advances earlier MSRC work on Polyphonic C#, Comega and the Joins Library. Unlike its C# based predecessors, CB adopts a simple event-like syntax familiar to VB progr...

We'd love to hear what you think! Submit ideas or give us feedback