Click here to Skip to main content
16,017,241 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
hello

I'm using C# to do a program that allowing user dragging controls. Now, I encounter a problem, And I want to deep understand the difference between size and height/width, and the difference between position and left/top. Such as the difference in each value, and the difference in which can change the control state when I revise it value without refresh.
Posted

1 solution

The difference is simply that the Height / Width pair shadow the Size parameter: You can change one of them independantly of the other - you cannot do that with the Size property since you cannot change either the Size.Height or Size.Width - the setters are not exposed. So you can change either Hieght or Width independantly:
C#
myForm.Width = 200;
myForm.Height = 300;

or both together:
C#
myForm.Size = new Size(200, 300);
 
Share this answer
 
Comments
dirk.zhang 15-Jan-12 4:24am    
thank you, and I either don't understand which property need refresh control to really change the control.
OriginalGriff 15-Jan-12 4:42am    
Either will do - they both affect the controls size.
dirk.zhang 15-Jan-12 21:08pm    
OK,I get it, thank you
Sergey Alexandrovich Kryukov 15-Jan-12 12:05pm    
Correct, a 5.
--SA

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