Public Declare Function SetMenu Lib "user32" (ByVal hwnd As Long, ByVal hMenu As Long) As Long
Private Sub HIdeMenus_Click() ''隐藏/显示CAD菜单 On Error Resume Next If hMenu <> 0 Then Exit Sub If HIdeMenus.Checked = False Then cMenu = GetMenu(lHwnd) SetMenu lHwnd, 0 HIdeMenus.Checked = True Else SetMenu lHwnd, cMenu HIdeMenus.Checked = False End If End Sub
Private Sub HideTool_Click() '隐藏/显示CAD工具栏 On Error Resume Next Dim Menugroup As Object Dim Toolbar As Object Dim i As Integer Static CadTools() As Boolean If Hidetool.Checked = False Then For Each Menugroup In AcadApp.MenuGroups ReDim CadTools(1 To Menugroup.Toolbars.Count) For Each Toolbar In Menugroup.Toolbars i = i + 1 CadTools(i) = Toolbar.Visible '添加工具栏状态 Toolbar.Visible = False Next Toolbar Next Menugroup Hidetool.Checked = True Else For Each Menugroup In AcadApp.MenuGroups For Each Toolbar In Menugroup.Toolbars i = i + 1 Toolbar.Visible = CadTools(i) Next Toolbar Next Menugroup Hidetool.Checked = False End If End Sub
|