默认头像
路人甲
路人甲
  • 注册日期2004-05-10
  • 发帖数60
  • QQ
  • 铜币302枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2328回复:6

选择Element工具怎么做?

楼主#
更多 发布于:2004-05-25 13:49
选择Element工具怎么做?
喜欢0 评分0
默认头像
路人甲
路人甲
  • 注册日期2004-03-25
  • 发帖数341
  • QQ
  • 铜币272枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2004-05-25 15:13
说详细点吗!
签 名: 不能超过 250 个字符 文字将出现在您发表的文章的结尾处。
举报 回复(0) 喜欢(0)     评分
默认头像
路人甲
路人甲
  • 注册日期2004-05-10
  • 发帖数60
  • QQ
  • 铜币302枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2004-05-25 16:01

就是象Arcmap工具条上的Select Element按钮的功能

举报 回复(0) 喜欢(0)     评分
默认头像
路人甲
路人甲
  • 注册日期2004-03-25
  • 发帖数341
  • QQ
  • 铜币272枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2004-05-25 17:07

改动一下下面的代码,试试:

Private Sub CmdSelect_Click() On Error GoTo ErrorHandler   Dim pSelectTool As ICommandItem   Dim pCommandBars As ICommandBars      ' The identifier for the Select Graphics Tool   Dim u As New Uid   u.Value = "{C22579D1-BC17-11D0-8667-0000F8751720}"

 Set pCommandBars = pAppMain.Document.CommandBars   Set pAppMain.CurrentTool = Nothing   Set pSelectTool = pCommandBars.Find(u)      'Set the current tool of the application to be the Select Graphics Tool   Set pAppMain.CurrentTool = Nothing   Set pAppMain.CurrentTool = pSelectTool   'DoRefreshGraLineLists   Exit Sub ErrorHandler:   ModCommon.ShowError End Sub

签 名: 不能超过 250 个字符 文字将出现在您发表的文章的结尾处。
举报 回复(0) 喜欢(0)     评分
默认头像
路人甲
路人甲
  • 注册日期2004-05-10
  • 发帖数60
  • QQ
  • 铜币302枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2004-05-26 08:44
是我少说了,我是用VB+MAPCONTROL开发的。你这个代码好象是VBA的。我的里面是没有pAppMain的。
举报 回复(0) 喜欢(0)     评分
默认头像
路人甲
路人甲
  • 注册日期2004-03-25
  • 发帖数341
  • QQ
  • 铜币272枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2004-05-26 09:14
噢,原来如此。再看看。
签 名: 不能超过 250 个字符 文字将出现在您发表的文章的结尾处。
举报 回复(0) 喜欢(0)     评分
默认头像
卧底
卧底
  • 注册日期2004-04-18
  • 发帖数235
  • QQ
  • 铜币614枚
  • 威望2点
  • 贡献值0点
  • 银元0个
6楼#
发布于:2004-05-26 20:05

Private Sub Page1_OnMouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long, ByVal pageX As Double, ByVal pageY As Double) If selflag = True Then         Dim pa As IActiveView     Dim pdis As IScreenDisplay     Dim pr As IRubberBand     Dim pEnv As IEnvelope     Dim pgra As IGraphicsContainer          Set pgra = Page1.PageLayout     Set pa = Page1.PageLayout     Set pdis = pa.ScreenDisplay     Set pr = New RubberEnvelope     Set pEnv = pr.TrackNew(pdis, Nothing)               Dim peenum As IEnumElement     Set peenum = pgra.LocateElementsByEnvelope(pEnv)     If peenum Is Nothing Then Exit Sub          Dim pElement As IElement     peenum.Reset   'Grab hold of the IElement interface through the first located element     Set pElement = peenum.Next     Dim pSelectionTracker As ISelectionTracker   'Loop through the located elements   Do While Not pElement Is Nothing     'Grab hold of the ISelectionTracker interface through the element     Set pSelectionTracker = pElement.SelectionTracker          'Display the elements selection tracker             Dim pDisplay As IDisplay     'Grab hold of the IDisplay interface through the PageLayoutControls active view     Set pDisplay = Page1.ActiveView.ScreenDisplay          'Start drawing to the display     pDisplay.StartDrawing pDisplay.hDC, esriNoScreenCache     'Draw the selection tracker on the display     pSelectionTracker.Draw pDisplay, pDisplay.hDC, esriTrackerDominant     'Finish drawing to the display     pDisplay.FinishDrawing     

   'Exit so only one element with a selection tracker     Exit Do     Set pElement = peenum.Next   Loop     pa.PartialRefresh esriViewGraphicSelection, Nothing, Nothing End If End Sub

建议你去看看那些DEMO,里面有这些例子

注: page1 为pagelayout

个人专栏: https://zhuanlan.zhihu.com/c_165676639
举报 回复(0) 喜欢(0)     评分
默认头像

返回顶部