I am trying to move a picture on a form when the mouse "drags" it. On form.mousemove the co-ord flow in nicley until I am over the picture a want to move (thus useless!)
The picture seems to be "on top" of the form, and thus no musemove event it called.
Damm annoying - any ideas?
Here the code if it hepls :
private void box_mousedown(object sender, System.Windows.Forms.MouseEventArgs e)
{
mousedown = true;
int MouseX = UserControl3.MousePosition.X;//X cordinate
int MouseY = UserControl3.MousePosition.Y;//Y Cordinate
if ((MouseX>box.Location.X) && (MouseX<(box.Location.X+box.Size.Width)) &&
(MouseY>box.Location.Y) && (MouseY<(box.Location.Y+box.Size.Height)))
{
MessageBox.Show("Not In Box!"
inboxques = false;}
else
{//ie in the box
inboxques = true;
}
}
private void box_mouseup(object sender, System.Windows.Forms.MouseEventArgs e)
{
mousedown = false;
}
private void m(object sender, System.EventArgs e)
{
}
private void form1_mousemove(object sender, System.Windows.Forms.MouseEventArgs e)
{
Console.WriteLine("Mouse move!"+tmpcount);
tmpcount++;
if (mousedown == true)
{
//MessageBox.Show("X : "+UserControl3.MousePosition.X);
//box.Location = new System.Drawing.Point(UserControl3.MousePosition.X-300, 16);
}
}
Thanks
Tom
The picture seems to be "on top" of the form, and thus no musemove event it called.
Damm annoying - any ideas?
Here the code if it hepls :
private void box_mousedown(object sender, System.Windows.Forms.MouseEventArgs e)
{
mousedown = true;
int MouseX = UserControl3.MousePosition.X;//X cordinate
int MouseY = UserControl3.MousePosition.Y;//Y Cordinate
if ((MouseX>box.Location.X) && (MouseX<(box.Location.X+box.Size.Width)) &&
(MouseY>box.Location.Y) && (MouseY<(box.Location.Y+box.Size.Height)))
{
MessageBox.Show("Not In Box!"
inboxques = false;}
else
{//ie in the box
inboxques = true;
}
}
private void box_mouseup(object sender, System.Windows.Forms.MouseEventArgs e)
{
mousedown = false;
}
private void m(object sender, System.EventArgs e)
{
}
private void form1_mousemove(object sender, System.Windows.Forms.MouseEventArgs e)
{
Console.WriteLine("Mouse move!"+tmpcount);
tmpcount++;
if (mousedown == true)
{
//MessageBox.Show("X : "+UserControl3.MousePosition.X);
//box.Location = new System.Drawing.Point(UserControl3.MousePosition.X-300, 16);
}
}
Thanks
Tom