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

I am trying to achieve dynamic META information so that it will allow META
I've got a Windows Form that has 6 listboxes in it. I'm trying to
I have a scenario that I'm trying to turn into a more responsive UI
I have a web page that has a button. Currently I am binding this
I'm playing around with MVC3 and trying to create a simple contact form that
I have a search form built in ASP.NET that has a dropdown list which
I'm trying to create a form filter, that would do some post-processing of a
Trying to achieve any moving effect while appending an element from one to another
im trying to achieve something but i dont really know how I have set
What I'm trying to achieve is show count of lines starting with/ending with needle

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.