How to block form scrolling when I’m dragging a controller?

Asked

Viewed 32 times

0

I have a form where I design a company’s supply network. For this, I need to allow the user to move the controls that are in the form.

This is working.

However, when the user moves the control beyond the current position of the form, the form increases in size and scrolls (right, left, up or down), and the control being dragged is taken further, which causes the form to scroll further, and so on.

The form keeps rolling, maybe increasing in size, until the user releases the mouse button.

To fix this, I need to prevent form scrolling when moving control. How can I do this?

1 answer

0

For the answer of Loathing in the Soen:

You can prevent the form from scrolling using this code by overwriting the method ScrollToControl:

protected override Point ScrollToControl(Control activeControl) {
    Point pt = this.AutoScrollPosition;
    return pt;
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.