Reputation: 1
I have a form with a simple calculator with the size 245 x 359.
I currently have a show/hide button for scientific functions.
I want to be able to click a button and have it show the scientific functions.
With the button size 300 x 400.
Upvotes: 0
Views: 579
Reputation: 1
In your example, do not need to hide and show button but only need to change text. Add Fix button on panel or user control and change the text. If require then user Button.Visible = false and true. Share your sample code for work on it.
Upvotes: 0
Reputation: 475
In your button click event, set each scentific function to:
btnMC.Visbile = true;
btnMC.Size = new Size(300, 400);
btnMR.Visbile = true;
btnMR.Size = new Size(300, 400);
ect...
That should do the trick. You might want to considered resizing your form when they click the button as well.
Upvotes: 0
Reputation: 5760
In the designer, just make these buttons, but then drag it's size to how you want it before the specific button is pressed. Add a event handler for the button you want, then do this:
bool buttonPressed = false;
private void onChangeSizeButton_pressed(EventArgs e, object o)
{
if (buttonPressed)
{
this.Size = new Size(this.Size.Width, DEFAULT HEIGHT HERE);
buttonPressed = false;
}
else
{
this.Size = new Size(this.Size.Width, NEW HEIGHT HERE);
buttonPressed = true;
}
}
Upvotes: 0
Reputation: 101701
In your button click event you can do the following:
this.Size = new Size(300,400);
Upvotes: 1