the_way
路人甲
路人甲
  • 注册日期2004-08-25
  • 发帖数30
  • QQ
  • 铜币166枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1813回复:3

关于TOCControl 的HitTest方法

楼主#
更多 发布于:2005-04-01 08:56
在C#中用TOCControl 的HitTest方法总提示类型不匹配,大家帮帮忙!
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2005-04-01 13:40
<P>最好把代码贴出来,大家才好帮你看哦</P><P>下面是程序里的一小段,vb的</P><P>Private Sub tb_OnMouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long)
On Error GoTo errh
    m_nCurPageOperate = IsFree
    frmMap.tblEditor.Refresh
'    m_activeControl = 99
         Set frmMap.map1.CurrentTool = Nothing
    
    
'判断选择了什么工具
    Dim lIndex As Long
    lIndex = tb.HitTest(x, y, False)
    
    If lIndex <> -1 Then
        'Get a reference to the ToolbarItem interface
        Dim pToolbarItem As IToolbarItem
        Set pToolbarItem = tb.GetItem(lIndex)
        
        If pToolbarItem Is Nothing Then Exit Sub
        
        Dim pCommand As ICommand
        Set pCommand = pToolbarItem.Command
        If pCommand Is Nothing Then Exit Sub
       </P><P>'        '设置当前的MapCtrl或PageLayoutCtrl控件的工具条
'
        If TypeOf pCommand Is ITool Then
                Set frmMap.map1.CurrentTool = pCommand
        End If
        
            '设置状态条
        SetStatusText pToolbarItem.Command.message
    Else
        SetStatusText ""
    End If
errh:
    m_nCurPageOperate = IsFree
    frmMap.tblEditor.Refresh
    m_activeControl = 99
End Sub</P>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
bbcddc
路人甲
路人甲
  • 注册日期2004-08-07
  • 发帖数20
  • QQ
  • 铜币127枚
  • 威望-1点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
2楼#
发布于:2005-04-01 21:04
<P>总统先生:</P><P>楼主好像是问TOCCONTROL的Hittest呀,我也希望知道。</P>
举报 回复(0) 喜欢(0)     评分
wsm2002
路人甲
路人甲
  • 注册日期2003-11-01
  • 发帖数40
  • QQ
  • 铜币249枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2005-04-10 00:18
<P>pTOC.HitTest X, Y, pItem, pmap, player, pLegendGroup, pIndex
   If pItem ; Chr(9) = 2 Then
        MsgBox "pItem=" ; pItem ; Chr(9) ; "pMap=" ; pmap.Name ; Chr(9) ; "pLayer=" ; player.Name
    Else
    If pItem ; Chr(9) = 1 Then
    Else
    If pItem ; Chr(9) = 4 Then
        MsgBox pItem ; Chr(5) ; pmap.Name ; Chr(5) ; player.Name ; Chr(5) ; pLegendGroup.Heading ; Chr(5) ; pLegendGroup.Class(pIndex).Label ; pIndex</P><P>End If</P><P>vb的</P>
举报 回复(0) 喜欢(0)     评分
游客

返回顶部