Click here to Skip to main content
15,917,473 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want build an expandable panel and i do it but when i want to reduce it width when righttoleft is in yes state my panel reduce width from right side to left and i want to do it from left side to right side,i try to change location by change size but it dose not have a good result!

please help!!!!
Posted
Comments
Sergey Alexandrovich Kryukov 2-Jul-14 15:24pm    
Do you mean System.Windows.Forms.Form?
—SA
saber rezaii magham 2-Jul-14 15:32pm    
No I want to resize an usercontrol!
Sergey Alexandrovich Kryukov 2-Jul-14 15:48pm    
System.Windows.Forms or not? Do you think there is only one UserControl type? :-)
And my answer (please see) would be the same. But you say "Form", not "UserControl". I hope you can read your own post. :-)
—SA

1 solution

How about just thinking a bit? It means changing the size and location of the form at the same time:
C#
int increment = //... something
MyForm.Left -= increment;
MyForm.Width += increment;


—SA
 
Share this answer
 
v2
Comments
saber rezaii magham 2-Jul-14 15:36pm    
I try to do it,but in top speed all controls that added to it have shake.
Sergey Alexandrovich Kryukov 2-Jul-14 15:50pm    
On a Form, it's not a big problem. On any controls, sandwich it (and possibly many other things) in parent's SuspendLaout/ResumeLayout.
—SA
saber rezaii magham 2-Jul-14 15:58pm    
Excuse me but I can't know your mean.
Can you explain more?
Sergey Alexandrovich Kryukov 2-Jul-14 20:45pm    
yourControlParent.SuspendLayout();
yourControl.Left -= increment;
yourControl.Width += increment;
yourControlParent.ResumeLayout();

And finally understand for yourself what do you want to resize: a form or some other control; your post is self-contradictory.

—SA
saber rezaii magham 3-Jul-14 4:37am    
Yes, this is true!
Thanks you very much.

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