请教各位大侠:在VB程序中嵌入了CAD界面,如何同时打开一个指定的文件
本帖最后由 作者 于 2008-4-26 8:43:54 编辑 <br /><br /> <p></p><p>前面看了efan版主及各位大侠关于“在VB程序窗体中嵌入CAD界面”的帖子,受益匪浅,</p><p>在此对efan版主及各位的热心表示深深感谢 :)</p><p></p><p>这里有一个小问题:在VB程序窗体中嵌入CAD界面后,如何同时同时打开一个指定的cad文件?</p><p>前面代码是这样的:</p><p><font color="#0000ff">Private</font><br/> <font color="#0000ff">Sub</font> Form_Load<font color="#ff0000">(</font><font color="#ff0000">)</font><br/><br/> <br/> <font color="#0000ff">On </font> <font color="#0000ff">Error </font> <font color="#0000ff">GoTo</font> ErrTrap<br/> <font color="#0000ff">Set</font> acadApp <font color="#0000ff">= </font> <font color="#0000ff">GetObject</font><font color="#ff0000">(</font>, <font color="#880000">"AutoCAD.<font color="#0000ff">Application</font>"</font><font color="#ff0000">)</font><br/> acadApp.<font color="#0000ff">Visible </font> <font color="#0000ff">=</font> True<br/> lHwnd <font color="#0000ff">=</font> GetParent<font color="#ff0000">(</font>GetParent<font color="#ff0000">(</font>acadApp.<font color="#0000ff">Activedocument</font>.hwnd<font color="#ff0000">)</font><font color="#ff0000">)</font><br/> <font color="#0000ff">If</font> lHwnd <font color="#0000ff">=</font> 0 <font color="#0000ff">Then </font> <font color="#0000ff">Exit </font> <font color="#0000ff">Sub</font><br/> lState <font color="#0000ff">=</font> acadApp.<font color="#0000ff">WindowState</font><br/> acadApp.<font color="#0000ff">WindowState </font> <font color="#0000ff">=</font> 1 <font color="#008000">'设置ACAD的窗口状态为默认,用于保存窗口位置。</font><br/> GetWindowRect lHwnd, r<br/> SetParent lHwnd, Form1.<font color="#0000ff">hwnd</font><br/> Form1.ScaleMode <font color="#0000ff">=</font> vbPixels <font color="#008000">'将VB窗体默认的缇单位改为以像素为单位。</font><br/> SetWindowPos lHwnd, 0, Form1.ScaleLeft, Form1.ScaleTop, Form1.<font color="#0000ff">ScaleWidth</font>, Form1.<font color="#0000ff">ScaleHeight</font>, 0<br/><font color="#0000ff"> Exit </font> <font color="#0000ff">Sub</font></p><p> ErrTrap:<br/> <font color="#0000ff">On</font><font color="#0000ff">Error</font>
<font color="#0000ff">GoTo</font> 0<br/><font color="#0000ff">End Sub</font><br/><br/><br/></p><p></p> 怎么没人发表意见啊?
页:
[1]