VB如何显示/隐藏CAD的标题、菜单、命令行
<p><font face="Verdana">VB<font face="Verdana">如何</font>显示/隐藏CAD的标题、菜单、工具栏、命令行、状态栏,前三样已经实现。</font></p><p> </p>
<p><font face="Verdana"><font face="Verdana">Private Sub AutoCADAll_Click(Index As Integer) 'CAD纳入到VB框中<br/> On Error Resume Next<br/> Set AcadApp = GetObject(, "AutoCAD.Application") '启动AutoCad</font></font></p>
<p><font face="Verdana"><font face="Verdana"> If Err Then<br/> Err.Clear<br/> Set AcadApp = CreateObject("AutoCAD.Application")<br/> If Err Then Exit Sub<br/> End If<br/> On Error GoTo 0<br/> lHwnd = GetParent(GetParent(AcadApp.ActiveDocument.hwnd))<br/> <br/> If lHwnd = 0 Then Exit Sub<br/> AcadApp.Visible = False<br/> AcadApp.WindowState = 2<br/> lState = AcadApp.WindowState<br/> GetWindowRect lHwnd, rS<br/> SetParent lHwnd, Frame.hwnd<br/> Me.ScaleMode = vbPixels<br/> <br/> '=================================================<br/> L = GetWindowLong(lHwnd, GWL_STYLE) '隐藏标题<br/> L = L And Not (WS_CAPTION)<br/> L = SetWindowLong(lHwnd, GWL_STYLE, L) '隐藏标题<br/> '-------------------------------------------------<br/> Call HIdeMenus_Click '隐藏菜单<br/> Call HideTool_Click '隐藏CAD工具栏<br/> '-------------------------------------------------<br/> Call Form_Resize<br/> AcadApp.Visible = True '使AutoCad可见<br/> Set AcadDoc = AcadApp.ActiveDocument '设acaddoc为当前图形文件<br/> Set Mospace = AcadDoc.ModelSpace '设mospace为当前图形文件的模型空间<br/> Set MyLayer = AcadDoc.Layers<br/>End Sub<br/></p></font></font>
<p><font face="Verdana"><font face="Verdana">Private Sub HideTool_Click() '隐藏/显示CAD工具栏<br/> On Error Resume Next<br/> Dim Menugroup As Object<br/> Dim Toolbar As Object<br/> Dim i As Integer<br/> Static CadTools() As Boolean<br/> i = 0<br/> If Hidetool.Checked = False Then<br/> For Each Menugroup In AcadApp.MenuGroups<br/> ReDim CadTools(1 To Menugroup.Toolbars.Count)<br/> For Each Toolbar In Menugroup.Toolbars<br/> i = i + 1<br/> CadTools(i) = Toolbar.Visible '添加工具栏状态<br/> Toolbar.Visible = False<br/> Next Toolbar<br/> Next Menugroup<br/> Hidetool.Checked = True<br/> Else<br/> For Each Menugroup In AcadApp.MenuGroups<br/> For Each Toolbar In Menugroup.Toolbars<br/> i = i + 1<br/> Toolbar.Visible = CadTools(i)<br/> Next Toolbar<br/> Next Menugroup<br/> Hidetool.Checked = False<br/> End If<br/> 'ForceForegroundWindow AcadApp.hwnd ' 将焦点切换到AutoCAD<br/>End Sub<br/></font></font></p>
<p><font face="Verdana"><font face="Verdana">Private Sub HIdeMenus_Click() '隐藏/显示CAD菜单<br/> On Error Resume Next<br/> If hMenu <> 0 Then Exit Sub<br/> <br/> If HIdeMenus.Checked = False Then<br/> cMenu = GetMenu(lHwnd)<br/> SetMenu lHwnd, 0<br/> HIdeMenus.Checked = True<br/> Else<br/> SetMenu lHwnd, cMenu<br/> HIdeMenus.Checked = False<br/> End If<br/>End Sub<br/></font> </font></p> 本人调试了一个晚上也没有成功,水平太浅了,请不吝赐教给原实例好吗? jsxygshh@163.com
十分感谢 请pmq给个实例,谢谢 请pmq给个实例,给看看
页:
[1]