swimer123
路人甲
路人甲
  • 注册日期2003-10-15
  • 发帖数25
  • QQ
  • 铜币127枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1433回复:1

请问斑竹

楼主#
更多 发布于:2003-11-13 16:49
请问在arcmap中插入文字的时候,点击一下会滩出一个文本框,是如何实现的,用哪个接口,谢谢了!!!!!<img src="images/post/smile/dvbbs/em11.gif" />
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15947
  • QQ554730525
  • 铜币25339枚
  • 威望15364点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2003-11-13 19:18
可以看例子啦,不可能每个接口都问,就麻烦了,:)

Add Label on Map  


Description:

This sample uses a UIToolControl to add a text label on the focus map. For simplicity sake, the label string is hard-coded to "X marks the spot."

A map label is a text element that is added to a map's basics graphics layer. Text elements can also be added to the page layout's graphics layer - see the 'Add Text to Layout' tip for an example of this. For example, we may be labelling a feature on a map in the first case, and giving the entire map a name in layout case.

How to use:
Add a new UIToolControl to any toolbar.
Paste the code into the UIToolControl's mouse down event.
Mind the name of the control, the sample assumes it is UIToolControl1.
Modify the text string as desired.
Completely shut down VBA so mouse events fire.
Select the tool and click somewhere on the focus map to add the label.
'Adds a text element (label) to the focus map's basic graphics layer
Private Sub UIToolControl1_MouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long)
  Dim pMxDoc As IMxDocument
  Dim pGraphicsContainer As IGraphicsContainer
  Dim pActiveView As IActiveView
  Dim pTextElement As ITextElement
  Dim pElement As IElement

  Set pMxDoc = Application.Document
  Set pGraphicsContainer = pMxDoc.FocusMap
  Set pActiveView = pMxDoc.FocusMap
  
  Set pTextElement = New TextElement
  Set pElement = pTextElement
  
  pTextElement.Text = "X marks the spot"
  pElement.Geometry = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y)
  pGraphicsContainer.AddElement pTextElement, 0
  
  pActiveView.PartialRefresh esriViewGraphics, Nothing, Nothing
End Sub

举报 回复(0) 喜欢(0)     评分
游客

返回顶部