CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2008
    Posts
    8

    Resizing Form help needed!

    How do you make a form resize with the Window in a program? Currently, hitting maximize on a window makes the window expand but the form stays the same size.

    I am not very familiar with C# but I believe this is a Windows property that needs to be changed rather than changing specifics in the code. I want to be able to make the form expandable just as it would be in Word, Firefox etc.

    Any help would be greatly appreciated!

  2. #2
    Join Date
    Jun 2008
    Posts
    2,477

    Re: Resizing Form help needed!

    By default, forms are expandable, collapsible, and re-sizable. If yours is not then you change it. You probably modified the MaximumSize property.

  3. #3
    Join Date
    Nov 2008
    Posts
    8

    Re: Resizing Form help needed!

    No, it's not like that.

    Let me clarify, my form expands normally just like any window would if you hit the maximize button at the top right hand corner. BUT, in this case, hitting maximize only maximizes the form whereas the textbox where my program is run stays the same base size it is set to. Also, I am not defining a maximumSize anywhere as you can see below so I am pretty sure that's not the case:

    Code:
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(792,658);
    The code above shows the size my form is initialized to and regardless of if I drag the form wider or hit the maximize button, the textbox where my code is displayed will not change.

    Any help would be greatly appreciated.

    Thanks in advance.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Resizing Form help needed!

    Set the Dock property of the text box as appropriate.

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

Featured