阅读:1531回复:1
请问斑竹
请问在arcmap中插入文字的时候,点击一下会滩出一个文本框,是如何实现的,用哪个接口,谢谢了!!!!!<img src="images/post/smile/dvbbs/em11.gif" />
|
|
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 |
|
|