クリックした地点からマップの縮尺に応じたバッファーを作成してフィーチャ検索用ジオメトリを作成

Private Sub UIToolControl1_MouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long)
    
    Dim pMxApplication As IMxApplication
    Set pMxApplication = Application
    
    Dim pMxDocument As IMxDocument
    Set pMxDocument = ThisDocument
    
    Dim pAppDisplay As IAppDisplay
    Set pAppDisplay = pMxApplication.Display
    
    Dim pDisplayTransformation As IDisplayTransformation
    Set pDisplayTransformation = pAppDisplay.DisplayTransformation
    
    Dim pPoint As IPoint
    Set pPoint = pDisplayTransformation.ToMapPoint(x, y)
    
    Dim pTopologicalOperator As ITopologicalOperator
    Set pTopologicalOperator = pPoint
    
    
    Dim dblDistance As Double
    Const lngRate As Long = 100 '割合の逆数
    
    'マップの縦横サイズの平均を基に計算
    With pMxDocument.ActiveView.Extent
            dblDistance = ((.XMax - .XMin) + (.YMax - .YMin)) / 2 / lngRate
    End With
    
    'マップの縦横サイズ小さい方を基に計算
    With pMxDocument.ActiveView.Extent
        If (.XMax - .XMin) > (.YMax - .YMin) Then
            dblDistance = (.YMax - .YMin) / lngRate
        Else
            dblDistance = (.XMax - .XMin) / lngRate
        End If
    End With

    Dim pGeometry As IGeometry
    Set pGeometry = pTopologicalOperator.Buffer(dblDistance)
    
    Dim pArea As IArea
    Set pArea = pGeometry
    
    Debug.Print pArea.Area
End Sub