J
Jon Cosby
I need an event handler for dragging the cursor on a PictureBox. The
existing events only include handlers for dragging and dropping objects over
the controls. I'm trying to use the MouseDown and MouseUp handlers as below,
but it never gets out of the while loop.
this.PicBox.MouseDown += new MouseEventHandler(this.StartMapDrag);
this.PicBox.MouseUp += new MouseEventHandler(this.EndMapDrag);
private void StartMapDrag(object sender, MouseEventArgs e)
{
drag = true;
WhileDrag();
}
private void EndMapDrag(object sender, MouseEventArgs e)
{
drag = false;
}
private void WhileDrag()
{
while (drag)
{
// Do something here
}
}
Can someone tell me a better way to handle this event?
Jon Cosby
existing events only include handlers for dragging and dropping objects over
the controls. I'm trying to use the MouseDown and MouseUp handlers as below,
but it never gets out of the while loop.
this.PicBox.MouseDown += new MouseEventHandler(this.StartMapDrag);
this.PicBox.MouseUp += new MouseEventHandler(this.EndMapDrag);
private void StartMapDrag(object sender, MouseEventArgs e)
{
drag = true;
WhileDrag();
}
private void EndMapDrag(object sender, MouseEventArgs e)
{
drag = false;
}
private void WhileDrag()
{
while (drag)
{
// Do something here
}
}
Can someone tell me a better way to handle this event?
Jon Cosby