阅读:1813回复:3
关于TOCControl 的HitTest方法
在C#中用TOCControl 的HitTest方法总提示类型不匹配,大家帮帮忙!
|
|
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> |
|
|
2楼#
发布于:2005-04-01 21:04
<P>总统先生:</P><P>楼主好像是问TOCCONTROL的Hittest呀,我也希望知道。</P>
|
|
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> |
|