阅读:1647回复:4
[求助]关于statusbar的问题
<P>我在help中找到statusbar的例子,其中OnCurrentViewChanged如下</P>
<P><FONT color=#0000ff>private void</FONT> axArcReaderControl1_OnCurrentViewChanged(<CODE><FONT color=#0000ff>object</FONT></CODE> sender, ESRI.ArcGIS.ArcReaderControl.IARControlEvents_OnCurrentViewChangedEvent e)<BR> {<BR> <CODE><FONT color=#008000>//Set current tool</FONT></CODE><BR> <CODE><FONT color=#0000ff>if</FONT></CODE> (axArcReaderControl1.CurrentViewType == esriARViewType.esriARViewTypeMap)<BR> {<BR> <CODE><FONT color=#0000ff>if</FONT></CODE> (axArcReaderControl1.CurrentARTool != esriARTool.esriARToolMapPan)<BR> {<BR> axArcReaderControl1.CurrentARTool = esriARTool.esriARToolMapPan;<BR> }<BR> }<BR> <CODE><FONT color=#0000ff>else if</FONT></CODE> (axArcReaderControl1.CurrentViewType == esriARViewType.esriARViewTypePageLayout)<BR> {<BR> <CODE><FONT color=#0000ff>if</FONT></CODE> (axArcReaderControl1.CurrentARTool != esriARTool.esriARToolLayoutPan )<BR> {<BR> axArcReaderControl1.CurrentARTool = esriARTool.esriARToolLayoutPan;<BR> }<BR> }<BR><BR> <CODE><FONT color=#008000>//Get IARCommandInfo interface</FONT></CODE><BR> IARCommandInfo arCommandInfo = axArcReaderControl1.get_ARCommandInfo(axArcReaderControl1.CurrentARTool);<BR> <CODE><FONT color=#008000>//Display the message property of the current tool in the status bar</FONT></CODE><BR> StatusBar1.Panels[0].Text = arCommandInfo.Message;<BR> }<BR>我写的是这样</P> <P>private void barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)<BR> {<BR> //Get the first layer in the focus map<BR> IARLayer arLayer = axReaderControl1.ARPageLayout.FocusARMap.get_ARLayer(0);<BR> //Open the find window set to perform a find on the layer<BR> axReaderControl1.ShowARWindow(esriARWindows.esriARWindowsFind, true, arLayer);</P> <P> <BR> }</P> <P> private void barButtonItem6_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)<BR> {<BR> IToolbarBuddy toolbarBuddy = (IToolbarBuddy) axReaderControl1.Object;<BR> ICommand command = new ControlsReaderIdentifyToolClass();<BR> command.OnCreate(toolbarBuddy);<BR> axReaderControl1.CurrentARTool = esriARTool.esriARToolCustom;<BR> toolbarBuddy.CurrentTool = (ITool) command;<BR> <BR> }</P> <P><FONT color=#0000ff>private void</FONT> axArcReaderControl1_OnCurrentViewChanged(<CODE><FONT color=#0000ff>object</FONT></CODE> sender, ESRI.ArcGIS.ArcReaderControl.IARControlEvents_OnCurrentViewChangedEvent e)<BR> {<BR> <CODE><FONT color=#008000>//Set current tool</FONT></CODE><BR> <CODE><FONT color=#0000ff>if</FONT></CODE> (axArcReaderControl1.CurrentViewType == esriARViewType.esriARViewTypeMap)<BR> {<BR> <CODE><FONT color=#0000ff>if</FONT></CODE> (axArcReaderControl1.CurrentARTool != esriARTool.esriARToolCustom)<BR> {<BR> axArcReaderControl1.CurrentARTool = esriARTool.esriARToolCustom;<BR> }<BR> }<BR> <CODE><FONT color=#0000ff>else if</FONT></CODE> (axArcReaderControl1.CurrentViewType == esriARViewType.esriARViewTypePageLayout)<BR> {<BR> <CODE><FONT color=#0000ff>if</FONT></CODE> (axArcReaderControl1.CurrentARTool != esriARTool.esriARToolCustom )<BR> {<BR> axArcReaderControl1.CurrentARTool = esriARTool.esriARToolCustom;<BR> }<BR> }<BR><BR> <CODE><FONT color=#008000>//Get IARCommandInfo interface</FONT></CODE><BR> IARCommandInfo arCommandInfo = axArcReaderControl1.get_ARCommandInfo(axArcReaderControl1.CurrentARTool);<BR> <CODE><FONT color=#008000>//Display the message property of the current tool in the status bar</FONT></CODE><BR> StatusBar1.Panels[0].Text = arCommandInfo.Message;<BR> }<BR>我想要在statusbar显示ButtonItem5和ButtonItem6,请问一下代码出错在哪里?谢谢!</P><img src="images/post/smile/dvbbs/em02.gif" /> |
|
1楼#
发布于:2005-09-07 15:17
你是代码运行出错,还是statusbar未显示结果
|
|
|
2楼#
发布于:2005-09-07 15:38
谢谢。代码运行时不提示错误,但在最后跳出让我调试的对话框,我觉得是 <CODE><FONT color=#0000ff>if</FONT></CODE> (axArcReaderControl1.CurrentViewType == esriARViewType.esriARViewTypeMap)<BR> {<BR> <CODE><FONT color=#0000ff>if</FONT></CODE> (axArcReaderControl1.CurrentARTool != esriARTool.esriARToolCustom)<BR> {<BR> axArcReaderControl1.CurrentARTool = esriARTool.esriARToolCustom;<BR> }<BR> }<BR> <CODE><FONT color=#0000ff>else if</FONT></CODE> (axArcReaderControl1.CurrentViewType == esriARViewType.esriARViewTypePageLayout)<BR> {<BR> <CODE><FONT color=#0000ff>if</FONT></CODE> (axArcReaderControl1.CurrentARTool != esriARTool.esriARToolCustom )<BR> {<BR> axArcReaderControl1.CurrentARTool = esriARTool.esriARToolCustom;<BR> }<BR> }<BR>的问题,但又不知道错在哪
|
|
3楼#
发布于:2005-09-07 17:17
我觉得是你的这句IARCommandInfo arCommandInfo = axArcReaderControl1.get_ARCommandInfo(axArcReaderControl1.CurrentARTool);<BR>出错了,应该是把CurrentARTool改为currenttool,再试试!
|
|
4楼#
发布于:2005-10-13 09:02
<P>有没有修改好,透露一下解决方法及结果。</P>
|
|