|
阅读:1105回复:2
MapControl 的 自定义工具如何设为空啊(C#)?
<P>ICommand command = new ControlsMapZoomOutToolClass ();<BR> command.OnCreate(axMapControlMain.Object);<BR> if(command.Enabled == true)<BR> {<BR> axMapControlMain.CurrentTool = (ITool) command;</P>
<P> }</P> <P>设为空axMapControlMain=(ITool)null,这样不行,要抱错啊!</P> <P>高手指点.</P> |
|
|
1楼#
发布于:2005-09-01 18:12
<P>我在VB里是建一个类模块叫DoNothingTool,继承Icommand和Itool,然后什么也不干。</P>
<P> Dim pCom As ICommand<BR> Set pCom = New DoNothingTool<BR> pCom.OnCreate (mapCtrl.object)<BR> pCom.OnClick<BR> If TypeOf pCom Is esriSystemUI.ITool Then<BR> Set mapCtrl.CurrentTool = pCom<BR> End If</P> |
|
|
|
2楼#
发布于:2005-08-28 22:30
((axMapControlMain.Object) as IMapcontrol).CurrentTool = (ITool) command
|
|