hi
how can i move the usercontrol on the form?
i search about this but i find any good idea
thx in advance
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bahar JalaliPosted Dec 15, 2009, 12:37 PM
i don't know what is the problem!!!!!
because when i test every which of theses solutions , any time i get true result
every time the user control don't move currect or don't free the mouse pointer
i has a request of you my good friends
please create a simple project and paste your solutions and test it and upload that for me
really i'm confiused.... why that don't work for me
thanks alot
Hiren SoniPosted Dec 14, 2009, 6:27 PM
Bahar JalaliPosted Dec 14, 2009, 2:36 PM
thanks but i do all of that works but the usercontrol don't free mouse pointer,,,, always that move with mouse and in mouse up that don't free from mouse pointer
why ??????
and in start , when program run at first, usercontrol move with mouse too, and it seems that usercontrol_mousedown and usercontrol_mouseup don't work and user control every time move with mouse ...
u can test it ... please tell me if that works fine on your computer .
Hiren SoniPosted Dec 13, 2009, 10:05 AM
Hiren SoniPosted Dec 13, 2009, 10:03 AM
Kirtan PatelPosted Dec 13, 2009, 9:37 AM
here i Coded the code for it Just Pick the Control and Move Mouse it will move With Mouse Pointerr
check "Do you like this answer" check box if it helps you :)
bool isMouseDown =false ;
private void userControl11_MouseDown(object sender, MouseEventArgs e)
{
isMouseDown = true;
}
private void userControl11_MouseMove(object sender, MouseEventArgs e)
{
if (isMouseDown == true)
{
userControl11.Location = new Point(e.X, e.Y);
}
}
private void userControl11_MouseUp(object sender, MouseEventArgs e)
{
isMouseDown = false;
}
Bahar JalaliPosted Dec 13, 2009, 7:52 AM
i want move user control with mouse ...
now how can i do that?
Hiren SoniPosted Dec 13, 2009, 7:02 AM
Kirtan PatelPosted Dec 13, 2009, 6:45 AM
you can move any Control using its Location Property .
see below code
private void button1_Click(object sender, EventArgs e)
{
int x = userControl11.Location.X;
int y=userControl11.Location.Y;
userControl11.Location = new Point( x+10,y+10);
}
if my answer helps you then check "do you like this answer "check box pleasE :)