Need to Move label in .net application
I want to move the location of label vertically or horizontally and it should appear from in the windows form and should be invisible at a location by moving. I want to make i开发者_开发百科t through .net application using c# so can any one help me for this?
Buddy, you can use the property Location
MyLabel.Location.x = ??
MyLabel.Location.y = ??
Then hide it by using the propertyVisible
MyLabel.Visible = false`
It's difficult to tell exactly what you're trying to accomplish here. I'm going to assume that you want to move a label from its current position on the form to a new position while the application is running. I also assume that you want to make the label invisible while you're moving it so that you cannot see it move across the form.
You can do this easily by setting the Location
property of the label you want to move to its new location. (If necessary, like if you want to move the label a relative number of pixels, you can get the label's current position from the Location
property before you set it.) The label control also has a Visible
property that you can set to True
or False
to show/hide the control, respectively:
//Hide the label first
myLabel.Visible = false;
//Move the label to a new location on the form
myLabel.Location = new Point(30, 25);
//Make the label visible again
myLabel.Visible = true;
If I guessed wrong, and you're just trying to move the label during design-time (before you start running your program), you can just drag-and-drop it to a new position on the form.
you just drag and drop
You can make a label invisible by using the Visible
Property.
myHiddenLabel.Visible = false;
精彩评论