无法隐藏模式对话框
<P>用以下代码创建了一个模式对话框:</P><P><STRONG>CAcModuleResourceOverride resOveride;<BR>CModalDlg pDlg(CWnd::FromHandle(adsw_acadMainWnd()));<BR>pDlg.DoModal();</STRONG></P>
<P>点对话框中一个按钮,添加如下代码,希望隐藏对话框:</P>
<P><STRONG>ShowWindow(SW_HIDE);</STRONG></P>
<P>对话框是隐藏了,但焦点回不了acad的主界面了,就是鼠标点不了acad的界面,包括菜单、绘图区等等,没有任何错误提示,程序也没有“无响应”。</P>
<P>请问大家,这是怎么回事?</P>
reply
你可以使用CAcUiPickButton,在事件处理中用<BR> BeginEditorCommand();<BR> CancelEditorCommand();<BR>参见..\arx_sdk\ObjectARX2004\samples\editor\mfcsamps\acuisample_dg例子 是的.grass说的有道理。 <P>谢谢<A name=55883><FONT color=#990000><B>王咣生</B></FONT></A>斑竹!</P> <P>现在点击了模式对话框的按钮,生成一条直线,只有退出模式对话框才能显示该直线,请问要如何才能更新绘图区呢?</P> <P>更新绘图区acedGetAcadDwgView()->UpdateWindow();</P><P> </P> yfy2003发表于2005-9-10 10:19:00static/image/common/back.gif
更新绘图区acedGetAcadDwgView()->UpdateWindow();
<P><BR>用了这行代码还是没有什么反应的</P>
<P><STRONG> </STRONG>BeginEditorCommand();</P>
<P> //焦点给acad主窗体<BR> AfxGetMainWnd()->SetFocus();<BR> //将当前文档锁定,因为要写入实体了 <BR> acDocManager->lockDocument( acDocManager->curDocument(), AcAp::kWrite, <BR> NULL, <BR> NULL,true) ; <BR></P>
<P> //添加直线到块表记录<BR> AcDbBlockTable* pBlockTable=NULL;<BR> AcDbBlockTableRecord* pSpaceRecord=NULL;<BR> acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable, AcDb::kForRead);<BR> pBlockTable->getAt(ACDB_MODEL_SPACE, pSpaceRecord, AcDb::kForWrite);<BR> pBlockTable->close();</P>
<P> AcDbLine *pLine=new AcDbLine(stPntNew,edPntNew);</P>
<P> pSpaceRecord->appendAcDbEntity(LineId,pLine);<BR> pSpaceRecord->close();</P>
<P> //添加新层<BR> AcDbLayerTable *pLayerTable;<BR> acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pLayerTable, AcDb::kForWrite);<BR> if(!pLayerTable->has("Line"))<BR> {<BR> AcDbLayerTableRecord *pLayerTableRecord=new AcDbLayerTableRecord;<BR> pLayerTableRecord->setName("Line");<BR> pLayerTable->add(pLayerTableRecord);<BR> pLayerTableRecord->close();<BR> }<BR> pLayerTable->close();<BR> pLine->setLayer("Line");<BR> pLine->setColorIndex(1);</P>
<P> pLine->close();</P>
<P><FONT color=#ff0000> <STRONG>//更新绘图区域<BR> acedGetAcadDwgView()->UpdateWindow();</STRONG></FONT><BR><STRONG> </STRONG>//文档解锁<BR> acDocManager->unlockDocument(acDocManager->curDocument());</P>
<P> //返回模式对话框<BR> CompleteEditorCommand();<BR></P> <FONT face=新宋体> </FONT>// 刷新显示屏幕 <BR> actrTransactionManager->flushGraphics(); <BR> acedUpdateDisplay(); <FONT color=#990000><FONT color=#000000>谢谢</FONT><STRONG> </STRONG><A name=56256><FONT color=#990000><STRONG>王咣生</STRONG></FONT></A><STRONG> yfy2003 </STRONG><FONT color=#000000>斑竹,问题已解决了</FONT></FONT>
页:
[1]