创建一个文本注记元素

Sub Create_TextElement()
    Dim doc As IMxDocument
    Set doc = ThisDocument
    
    Dim container As IGraphicsContainer
    Set container = doc.PageLayout
    
    Dim color As IRgbColor
    Set color = New RgbColor
    color.Blue = 0
    color.Red = 255
    color.Green = 0
    
    Dim STS As ISimpleTextSymbol
    Set STS = New TextSymbol
    STS.color = color
    STS.size = 100
    STS.Font.Bold = False
    STS.Angle = 90
    
    Dim TE As ITextElement
    Set TE = New TextElement
    TE.Text = "大学"
    TE.Symbol = STS
    
    Dim area As IArea
    Set area = doc.ActivatedView.Extent
    
    Dim element As IElement
    Set element = TE
    
    Dim point As IPoint
    Set point = area.Centroid
    
    element.Geometry = point
    
    container.AddElement element, 0
    
    doc.ActivatedView.Refresh
    
End Sub

你可能感兴趣的:(ArcObjects)