|
阅读:951回复:0
toolbar出错“The supplied command is invalid”,请大家帮忙!
<P>我创建了一个toolbardef类,代码如下,然后在form_load中加载到已有的toolbarcontrol中,调试的时候总是提示:“The supplied command is invalid”,请大家帮忙看看咋回事?</P>
<P>Public Class standardtoolbar<BR> Implements IToolBarDef</P> <P> Public ReadOnly Property Caption() As String Implements ESRI.ArcGIS.SystemUI.IToolBarDef.Caption<BR> 'set the caption<BR> Get<BR> Return "工具条"<BR> End Get<BR> End Property</P> <P> Public Sub GetItemInfo(ByVal pos As Integer, ByVal itemDef As ESRI.ArcGIS.SystemUI.IItemDef) Implements ESRI.ArcGIS.SystemUI.IToolBarDef.GetItemInfo<BR> ' Define the commands that will be on the toolbar. <BR> Select Case pos<BR> Case 0<BR> itemDef.ID = "ESRI.ArcGIS.GlobeCore.ControlsGlobeOpenDocCommand"<BR> itemDef.Group = False<BR> Case 1<BR> itemDef.ID = "esri.ArcGIS.GlobeCore.ControlsGlobePanTool"<BR> itemDef.Group = True<BR> Case 2<BR> itemDef.ID = "esri.ArcGIS.GlobeCore.ControlsGlobeFlyTool"<BR> itemDef.Group = False<BR> Case 3<BR> itemDef.ID = "esri.ArcGIS.GlobeCore.ControlsGlobeWalkTool"<BR> itemDef.Group = False<BR> Case 4<BR> itemDef.ID = "esri.ArcGIS.GlobeCore.ControlsGlobeNavigateTool"<BR> itemDef.Group = False<BR> Case 5<BR> itemDef.ID = "esri.ArcGIS.GlobeCore.ControlsGlobeFullExtentCommand"<BR> itemDef.Group = True<BR> Case 6<BR> itemDef.ID = "esri.ArcGIS.GlobeCore.ControlsGlobeFixedZoomInCommand"<BR> itemDef.Group = False<BR> Case 7<BR> itemDef.ID = "esri.ArcGIS.GlobeCore.ControlsGlobeFixedZoomOutCommand"<BR> itemDef.Group = False<BR> End Select<BR> End Sub</P> <P> Public ReadOnly Property ItemCount() As Integer Implements ESRI.ArcGIS.SystemUI.IToolBarDef.ItemCount<BR> Get<BR> Return 8<BR> End Get<BR> End Property</P> <P> Public ReadOnly Property Name() As String Implements ESRI.ArcGIS.SystemUI.IToolBarDef.Name<BR> Get<BR> Return "我的工具条"<BR> End Get<BR> End Property<BR>End Class</P> <P>下面是在form_load中向toolbarcontrol加载toolbardef类的实例的代码:<BR>Dim m_Ptoolbardef As IToolBarDef<BR> m_Ptoolbardef = New standardtoolbar<BR> AxToolbarControl1.AddToolbarDef(m_Ptoolbardef, -1, False, 0, esriCommandStyles.esriCommandStyleIconOnly)<BR> AxToolbarControl1.SetBuddyControl(AxGlobeControl1)<BR> AxToolbarControl1.Show()</P> |
|