UI resizing
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: UI resizing

  1. #1
    Join Date
    Mar 2010
    Location
    Melbourne Australia
    Posts
    454

    UI resizing

    hello all,
    I am new to C Sharp development, I have experience in Java and C++ programming. I am currently developing a program for our plc controller. Could someone please advise me how to resize the controls on a Windows form when the form is either being resized or being maximised.
    What I want is for my UI elements like buttons, data grid to maintain their relative positions within the Windows form however when the form is either resize or maximised I want these controls to grow with them and occupy the whole screen space like it does in other programming environments such as C++ or Java. Thank you in advance.

  2. #2
    Join Date
    Mar 2010
    Location
    Melbourne Australia
    Posts
    454

    Re: UI resizing

    here is the screenshot of my UI elements

    http://dl.dropbox.com/u/28847599/CsrUIApp.jpg
    Last edited by aamir121a; April 18th, 2012 at 09:20 PM.

  3. #3
    Join Date
    Feb 2012
    Location
    Strasbourg, France
    Posts
    116

    Re: UI resizing

    Cannot view screenshot from where I am, but seems your problem can be solved with anchor property.

    Example :
    Code:
    this.textBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    Anchor allows you to attach a control to a side of the GUI. Imagine a real chain linking the item to the border chosen.

    When you anchor something to the right only it'll keep it's position relative to the right border and moves as the form will be resized.

    If you tie it both to left and right at same time, the item will be expanded/collapsed as your form is resized.

    (if you're using Visual Studio, check the property window of each GUI object)

  4. #4
    Join Date
    Mar 2010
    Location
    Melbourne Australia
    Posts
    454

    Re: UI resizing

    thank you , yes I remember now it was , I did come across it few years back , just could not remember the name.

  5. #5
    Join Date
    Mar 2010
    Location
    Melbourne Australia
    Posts
    454

    Re: UI resizing

    Seems to work for re size event how about maximize , ( button ) at the top right hand side of the window

  6. #6
    Join Date
    Feb 2012
    Location
    Strasbourg, France
    Posts
    116

    Re: UI resizing

    Works the same like a resize in all directions
    Last edited by Erendar; April 19th, 2012 at 08:31 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center