将该实现过程写在控件的OnMouseDown事件下
Private Sub AxPageLayoutControl1_OnMouseDown(ByVal sender As Object, ByVal e As ESRI.ArcGIS.Controls.IPageLayoutControlEvents_OnMouseDownEvent) Handles AxPageLayoutControl1.OnMouseDown
Dim pPageLayout As IPageLayout
Dim pActiveView As IActiveView
pPageLayout = Me.AxPageLayoutControl1.PageLayout
'获取控件的PageLayout对象
pActiveView = pPageLayout
'新建一个点Point
Dim pPt As IPoint
pPt = New Point
pPt.PutCoords(e.pageX, e.pageY)
'产生一个Maker元素
Dim pMarkerElement As IMarkerElement
pMarkerElement = New MarkerElement
'产生修饰Marker元素的symbol
Dim pMarkerSymbol As ISimpleMarkerSymbol
pMarkerSymbol = New SimpleMarkerSymbol
'设置符号的颜色
pMarkerSymbol.Color = getRGB(11, 200, 145)
'设置符号大小
pMarkerSymbol.Size = 2
'设置符号类型
pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSDiamond
Dim pElement As IElement
pElement = pMarkerElement
'QI,得到IElement接口对象,用于设置元素的Geometry
pElement.Geometry = pPt
pMarkerElement.Symbol = pMarkerSymbol
Dim pGraphicsContainer As IGraphicsContainer
pGraphicsContainer = pPageLayout
'将元素添加到pPageLayout中
pGraphicsContainer.AddElement(pMarkerElement, 0)
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, Nothing, Nothing)
End Sub
Public Function getRGB(ByVal r As Integer, ByVal g As Integer, ByVal b As Integer) As IRgbColor
Dim color As IRgbColor
color = New RgbColor
With color
.Red = r
.Green = g
.Blue = b
End With
Return color
End Function
End Class