PLEASE HELP: PickObject

Got a demo comming up tomorrow to prove Go.Net. Almost done, but GoView.PickObject doesn’t appear to take into account the zoom level or scroll position. Is this a problem with the evaluation version? Am I doing something wrong? I’m just trying to determine which object is underneight the mouse cursor to perform my own custom drag-and-drop.
Yes, I know that Drag-and-Drop coordinates are in screen coordinates. I’ve already converted them to the view coordinates using PointToClient on the GoView. Everything works great until you zoom in or scroll. After you do either, PickObject still returns the object found at the coordinate before the zoom or scroll.
Thanks for your help,
Jared

You need to call GoView.ConvertViewToDoc as well, so that everything is in document coordinates.
Take a look at the code in GraphView.cs in the Demo1 sample:
protected override IGoCollection DoExternalDrop(DragEventArgs evt) {
IDataObject data = evt.Data;
Object treenodeobj = data.GetData(typeof(TreeNode));
if (treenodeobj != null && treenodeobj is TreeNode) {
TreeNode treenode = (TreeNode)treenodeobj;
Point screenPnt = new Point(evt.X, evt.Y);
Point viewPnt = PointToClient(screenPnt);
PointF docPnt = ConvertViewToDoc(viewPnt);
StartTransaction();
this.Selection.Clear();
this.Selection.HotSpot = new SizeF(0, 0);
GoObject tag = treenode.Tag as GoObject;
GoObject newobj = null;
if (tag != null) {
newobj = this.Document.AddCopy(tag, docPnt);
this.Selection.Add(newobj);
}
FinishTransaction(“Insert from TreeView”);
return this.Selection;
} else {
return base.DoExternalDrop(evt);
}
}

Thank you Walter, I’m pretty sure that will work. But just out of curriosity, is that not what the GoView.PickObject method should do alrady?

No, the argument to GoView.PickObject is in document coordinates. The easy way to notice that is that it is a PointF, not a Point.