Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag'n'drop was broken #7

Open
wmjordan opened this issue Mar 8, 2021 · 3 comments
Open

Drag'n'drop was broken #7

wmjordan opened this issue Mar 8, 2021 · 3 comments

Comments

@wmjordan
Copy link

wmjordan commented Mar 8, 2021

The point passed to GetActiveTabIndex should be the client coordinate.
Thus the corresponding code in TabControlExtra.OnDragOver should be:

var dragPoint = new Point(drgevent.X, drgevent.Y);
var tabPoint = this.PointToScreen(Point.Empty);
dragPoint.Offset(-tabPoint.X, -tabPoint.Y);
if (this.GetActiveTab(dragPoint) == dragTab) {
    return;
}

int insertPoint = this.GetActiveIndex(dragPoint);
if (insertPoint < 0) return;
@rlktradewright
Copy link
Contributor

Thank you, well spotted.

But is there a reason not to simply use:

var mousePosition = this.PointToClient(new Point(drgevent.X, drgevent.Y));
if (this.GetActiveTab(mousePosition) == dragTab) {
    return;
}

int insertPoint = this.GetActiveIndex(mousePosition);
if (insertPoint < 0) return;

@wmjordan
Copy link
Author

Oh, thank you for replying.
Long time no program with WinForm :)

You are right.

@rlktradewright
Copy link
Contributor

I just wanted to say that I have some other concerns about the current drag-and-drop implementation.

I'll probably release a new version soon just to fix the immediate issue here, and then have a more considered go at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants