GoPalette Jumps

I put two GoPalette objects on a UserControl and set the UserControl AutoScroll property to true.

Once I click any part of the GoPalette object to drag a node from it, the scroll bar of the parent UserControl, scrolls up so that the top edge of the clicked GoPalette appears. Notice how the scroll bar moved:

That causes a difference space between the mouse cursor and the dragged node, because when the GoPalette moved, the node is no more in its same place.

That doesn’t happen if the GoPalette already have focus before clicking it.
Is there any way to avoid this?

It’s true that a mouse down in a GoView, including a GoPalette, will call Control.Focus().
Does your user control do anything regarding focus?

No it doesn’t. My UserControl does nothing. It’s just a container for two GoPalette objects.
And it has a scroll bar.
When a GoPalette is clicked, it automatically scroll. That makes the cursor of the mouse, to move away from the node in the GoPalette while dragging it.
Picture 3.jpg is captured while dragging. The cursor is a distant above the node.

I just created a simple UserControl like yours, with two GoPalettes positioned vertically above each other. Sure enough, I got the same behavior as you did–when I clicked in a palette window, the UserControl scrolled.
Then I did a simple replacement of “Northwoods.Go.GoPalette” with “System.Windows.Forms.TreeView” and commented out the GoPalette-specific initialization. I got the same behavior. So the problem is not specific to GoDiagram.
I think this is a feature of UserControl. When the control getting focus isn’t completely visible, the UserControl automatically scrolls to make it as visible as possible. I don’t know how to avoid that behavior, although overriding WndProc is a possible work-around.

Yes you are right. The same thing happens with TreeView. But only when I click the TreeView, not when I drag an item out of it.
I mean that, both TreeView and GoPalette causes their parent UserControl to scroll when they are CLICKED.
On the other hand, dragging an item out of the GoPalette has the same effect of clicking it, but dragging an item outside TreeView doesn’t have the same effect of clicking it.

Well, one work-around is to just change the GoView so that it does not call Control.Focus():
public class NoFocusPalette : GoPalette {
public NoFocusPalette() {}
public override void DoMouseDown() {
Try using this control instead of GoPalette in your UserControl. But note that if you do need the control to get focus on a mouse click somehow, you’ll need to implement some other method of doing so.
A reason you might need to get focus on a mouse click is when the user is doing in-place editing, and the editing control wants to be able to finish when the user clicks in the background of the view. Normally that background click would cause the editing control to lose focus, but since the NoFocus-view won’t get focus, the user won’t be able to finish editing in the control.
But in your case you wouldn’t expect the user to do any editing in a palette, so this work-around will probably be just fine for you.

Thanks. That worked fine for me.