.NET

Reply
Valued Contributor
fsztuczny
Posts: 53
Registered: ‎02-25-2010
Message 1 of 4 (387 Views)

Show/hide toolbars

387 Views, 3 Replies
03-24-2012 03:42 AM

I loaded a partial customization file by CUI dialog. I would like to programmatically hide / show the menus and toolbars, so when you restart AutoCAD to be permanently hidden or visible. Can anyone hint how to do it?

Active Contributor
DesignProQuig
Posts: 32
Registered: ‎03-02-2012
Message 2 of 4 (383 Views)

Re: Show/hide toolbars

03-24-2012 04:27 AM in reply to: fsztuczny

Hi there,

this code works, but I have ran into problems when Windows 7 UAC is set to high:

If any one has a better way of doing this then I would be greatful also:

 

 

 

 

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Interop
Imports System.Environment

<Assembly: CommandClass(GetType(ToolbarCmds))>

Public Class ToolbarCmds
    <CommandMethod("MyMenusCuix")> _
    Public Sub LoadToolbars()


        Dim cuiname As String = "MyMenus"
        Dim cuifile As String = "C:\MyMenus.cuix"
        Dim mg As AcadMenuGroup
        Try
            'Attempt to access our menugroup
            mg = Application.MenuGroups.Item(cuiname)
        Catch ex As System.Exception
            'Failure simply means we need to load the CUI first
            Application.MenuGroups.Load(cuifile)
            mg = Application.MenuGroups.Item(cuiname)
            'Cycle through the toobars, setting them to visible
            Dim i As Integer
            For i = 0 To mg.Toolbars.Count - 1
                mg.Toolbars.Item(i).Visible = True
            Next
        End Try
    End Sub
End Class

 

 

Regards,

 

Martin.

http://www.designprosoftware.co.uk/
*Expert Elite*
Alfred.NESWADBA
Posts: 9,398
Registered: ‎06-29-2007
Message 3 of 4 (382 Views)

Re: Show/hide toolbars

03-24-2012 04:28 AM in reply to: fsztuczny

Hi,

 

...create/save two workspaces, one having your partial menues visible and the other workspace having them invisible ...?

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Valued Contributor
fsztuczny
Posts: 53
Registered: ‎02-25-2010
Message 4 of 4 (330 Views)

Re: Show/hide toolbars

03-30-2012 12:42 PM in reply to: Alfred.NESWADBA

Thank you.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!