Dynamicaly moving controls at runtime
-
Hi - I'd like to dynamicaly move a button during runtime. I've tried changing the control's Control.Location.X and .Y but get the error: Cannot modify the return value of 'System.Windows.Forms.Control.Location' because it is not a variable. Is there a way to move a control at run time? Thanks, mutty
-
Hi - I'd like to dynamicaly move a button during runtime. I've tried changing the control's Control.Location.X and .Y but get the error: Cannot modify the return value of 'System.Windows.Forms.Control.Location' because it is not a variable. Is there a way to move a control at run time? Thanks, mutty
-
How about Control.Left or control.Top? Pompiedompiedom... ;)
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.." -- Mark McCormick
-
Hi - I'd like to dynamicaly move a button during runtime. I've tried changing the control's Control.Location.X and .Y but get the error: Cannot modify the return value of 'System.Windows.Forms.Control.Location' because it is not a variable. Is there a way to move a control at run time? Thanks, mutty
Well and if you want to know why you cannot change it: open reflector and see that the Location property returns the following:
return new Point(this.x, this.y);
So it is returning a new point object. If you anyway want to change the location of the control using the Location property you should feed it a new Point :
Control.Location = new Point(X,Y);
regards, Gidon