Auto scaling of controls in a form (.Net 2008).


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Auto scaling of controls in a form (.Net 2008).

  1. #1
    Join Date
    Mar 2009
    Posts
    67

    Question Auto scaling of controls in a form (.Net 2008).

    DESKTOP APPLICATION.

    Hi, below is the problem briefed:
    In my home form I have a splitcontainer and few buttons. When the buttons are clicked respective forms are opened in the splitcontainer. The splitcontainer is anchored- top, left, right, bottom so that when the home form is resized the splitcontainer resizes itself automatically. The controls within the other forms are also anchored properly to resize themselves accordingly. But the problem is when i open a form in the splitcontainer, even if I resize the home form, the controls in the form within the splitcontainer aren't resizing. The reason is when the home form is resized the splitcontainer is resizing itself accordingly but the form inside the splitcontainer isn't (as forms don't have anchor or dock properties so I couldn't set them). As a result though the controls in the sub form
    are anchored to resize themselves yet they aren't. How to solve it.

    In short I want the form in the splitcontainer and all the controls in it to resize automatically when the home form/splitcontainer is resized. Regards.

  2. #2
    Join Date
    Feb 2004
    Location
    Longueuil, Québec
    Posts
    577
    Do you really need a Form inside the SplitContainer?

    Why not put your controls directly inside the panels of the SplitContainer.

    You can also use Panels or UserControls inside the SplitContainer. They are container controls, so they have an Anchor property and can hold your controls.

    If you really need the Form, react to the SizeChanged event of the SplitContainer, and use it to resize the included Form to the SplitContainer panel ClientSize value.
    Jacques Bourgeois
    JBFI
    http://www3.sympatico.ca/jbfi/homeus.htm

  3. #3
    Join Date
    Mar 2009
    Posts
    67

    Talking

    Never mind! I missed a small property. When you call the subform in the splitcontainer of the main form just set the property Dock to Fill.

    Code:
    dim objFrmSubForm as New frmSubForm()
    	objFrmSubForm.Dock=DockStyle.Fill
    	objFrmSubForm.Show()
    	objFrmSubForm=Nothing
    Regards.

Similar Threads

  1. Perk: A good trick with Form Controls
    By bit_ravinder in forum .NET
    Replies: 0
    Last Post: 07-13-2005, 02:22 AM
  2. How to refer to controls in another form?
    By bjbenoit in forum .NET
    Replies: 2
    Last Post: 06-30-2005, 04:38 PM
  3. ANN: .Net Compact Framework Controls
    By Keith in forum dotnet.announcements
    Replies: 0
    Last Post: 06-15-2003, 08:16 PM
  4. ANN: The XtraGrid Suite & XtraEditors Library - 100% Native .NET Components
    By Developer Express in forum dotnet.announcements
    Replies: 0
    Last Post: 10-06-2001, 03:43 PM
  5. Replies: 0
    Last Post: 10-06-2001, 03:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center