Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 43047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:26:00+00:00 2026-05-10T15:26:00+00:00

What I am trying to achieve is a form that has a button on

  • 0

What I am trying to achieve is a form that has a button on it that causes the Form to ‘drop-down’ and become larger, displaying more information. My current attempt is this:

private void btnExpand_Click(object sender, EventArgs e) {     if (btnExpand.Text == '>')     {         btnExpand.Text = '<';         _expanded = true;         this.MinimumSize = new Size(1, 300);         this.MaximumSize = new Size(int.MaxValue, 300);     }     else     {         btnExpand.Text = '>';         _expanded = false;         this.MinimumSize = new Size(1, 104);         this.MaximumSize = new Size(int.MaxValue, 104);     } } 

Which works great! Except for one small detail… Note that the width values are supposed to be able to go from 1 to int.MaxValue? Well, in practice, they go from this.Width to int.MaxValue, ie. you can make the form larger, but never smaller again. I’m at a loss for why this would occur. Anyone have any ideas?

For the record: I’ve also tried a Form.Resize handler that set the Height of the form to the same value depending on whatever the boolean _expanded was set to, but I ended up with the same side effect.

PS: I’m using .NET 3.5 in Visual Studio 2008. Other solutions are welcome, but this was my thoughts on how it ‘should’ be done and how I attempted to do it.

Edit: Seems the code works, as per the accepted answers response. If anyone else has troubles with this particular problem, check the AutoSize property of your form, it should be FALSE, not TRUE. (This is the default, but I’d switched it on as I was using the form and a label with autosize also on for displaying debugging info earlier)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T15:26:01+00:00Added an answer on May 10, 2026 at 3:26 pm

    As per the docs, use 0 to denote no maximum or minimum size. Tho, I just tried it and it didn’t like 0 at all. So I used int.MaxValue like you did and it worked. What version of the the framework you using?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I'm trying to achieve is to determine if the Postscript that I'm parsing
I am trying to achieve better performance for my Java SWT application, and I
I'm trying to achieve the equivalent of a WinForms ListView with its View property
I'm trying to achieve a 50px space at the bottom of my page, below
I've trying to achieve something like this: class Base { public: Base(string S) {
I'm trying to achieve something google isn't able to give answer. I'm trying to
I am trying to achieve the same behavior as indicated in the following post.
What I am trying to achieve is to merge three strings. Two are provided
What i am really trying to achieve is to full control the active TabItem
Ok, so what I am trying to achieve is, when the user clicks on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.