Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to increage form size in windows applicatio on button click event
Posted

Hi,

see this code which increases your form size for every button click:
C#
private void button1_Click(object sender, EventArgs e)
{
   this.Size = new Size(this.Width + 100, this.Height + 100);
}
 
Share this answer
 
Comments
Shambhoo kumar 24-Sep-12 2:02am    
ok good....
JF2015 24-Sep-12 2:03am    
If it helped you, please accept and upvote my answer. Thanks!
Shambhoo kumar 24-Sep-12 2:12am    
hi.
Shambhoo kumar 24-Sep-12 4:45am    
hey frnd i m srry for that my prev comment.....
this.Size = new System.Drawing.Size(743, 600);
 
Share this answer
 
Comments
Shambhoo kumar 24-Sep-12 7:48am    
ok thanks..
You can use this on button click event:
C#
//Changes the form size
Form1.Size = new System.Drawing.Size(100, 100);




Hope it helps.!
--Amit
 
Share this answer
 
Comments
Shambhoo kumar 24-Sep-12 2:02am    
not form1.size work.... wrong
this.size is worked.....correct
_Amy 24-Sep-12 2:14am    
I just gave a overview and test code. Anyway that worked, I am glad.
Shambhoo kumar 24-Sep-12 2:16am    
ok thanks swt frnd...
_Amy 24-Sep-12 2:22am    
Welcome. :)
One suggestion, if you are asking the question to any one, and that person is finding answer, and if the answer is correct then you should accept the answer so that others can easily get the answer by searching. :)

--Amit
Shambhoo kumar 24-Sep-12 4:45am    
ya ok ....thanks for giving me suggestion.......
Shamboo

Form1.Width += 200;


or

Form1.Size = new Size(300, Form1.Size.Height);



just like what _AMY shown
Form1.Size = new System.Drawing.Size(100, 100);
 
Share this answer
 
Comments
Shambhoo kumar 24-Sep-12 2:03am    
ok thanks.. :)
Shambhoo kumar 24-Sep-12 2:03am    
:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900