Private Sub UIToolControl1_MouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long) Dim pMxDocument As IMxDocument Set pMxDocument = ThisDocument Dim pPoint As IPoint Set pPoint = pMxDocument.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y) Debug.Print "FormPoint:", pPoint.x, pPoint.y '用紙座標 Dim pGCS As IGraphicsContainerSelect Set pGCS = pMxDocument.PageLayout Dim pMapFrame As IMapFrame Set pMapFrame = pGCS.SelectedElement(0) '事前にマップ フレームを選択状態にしておくこと Dim pActiveView As IActiveView Set pActiveView = pMapFrame.Map Dim pMapPoint As IPoint Set pMapPoint = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y) Debug.Print "MapPoint:", pMapPoint.x, pMapPoint.y 'マップ座標 End Sub
レイアウト ビューでマウス クリック地点の用紙座標とマップ座標の両方を取得する方法
2016/9/1 (木)