mardi 31 mars 2015

Move a control from a method in Windows Form

High level question, is it possible to move a control from a method? Example, I have a label and a button click event, can the label move from one position (X,Y) to another from the button click to something like (X+20,Y+20)?


I haven't had any luck with changing the .Position property of the label, and I couldn't find anything online so I thought I would ask. Thanks!


EDIT: Was asked to show some code so here ya go. The label1.Position can't be selected/edited, and label1.Move is an event handler, for when the user moves the label?



private void MoveTextButton_Click(object sender, EventArgs e)
{
label1.Position = (x,y);
//label1.Move
}

Aucun commentaire:

Enregistrer un commentaire