你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
朱新颖
赞同来自:
IMxDocument mxDocument = ArcMap.Application.Document as IMxDocument; IActiveView actieview = mxDocument. ActiveView; Point point = arg.Location; rect lpRect = new rect(); GetWindowRect(actieview.ScreenDisplay.hWnd, ref lpRect); Form1 form1 = new Form1(); form1.StartPosition = FormStartPosition.Manual; Point points = new Point(); points.X = point.X + lpRect.Left; points.Y = point.Y + lpRect.Top; form1.Location = points; form1.Show();
要回复问题请先登录或注册
1 个回复
朱新颖
赞同来自:
Add-in中自定义Tool的OnMouseDown事件参数MouseEventArgs arg,arg.Location是以ArcMap中地图区域的左上角为0,0的屏幕坐标,而form.Location是以整个计算机屏幕左上角为0,0的坐标,所以需要进行换算。
1,获取arg.Location;
2,通过 GetWindowRect(int hWnd, ref rect lpRect);获取当前IActiveView相对于计算机屏幕的位置和大小;
3,原始点X坐标+lpRect.Left,原始Y坐标+lpRect.Top 即为该点相对于计算机屏幕的坐标,也就是Form窗体弹出的坐标。
要回复问题请先登录或注册