Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / August 2004

Tip: Looking for answers? Try searching our database.

Manipulating a CommandBar object

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rick Strahl [MVP] - 02 Aug 2004 06:48 GMT
I'm trying to add a new menu bar to my Add-In instead of adding to an
existing menu. I've got this working fine, but I can't figure out how to
change a few properties on the CommandBar...

Specifically I need to set the BeginGroup option. How do I get at the
underlying CommandBarControl to set .BeginGroup?

I tried this:
CommandBar commandBar = applicationObject.Commands.AddCommandBar("West Wind
Html Help
Builder",vsCommandBarType.vsCommandBarTypeMenu,commandBar,InsertionIndex) as
CommandBar;

Command cbMenu = applicationObject.Commands.Item("West Wind Html Help
Builder",-1);

CommandBarControl cbMenu2 = cbMenu as CommandBarControl;

and got a Command object, but not the CommandBarControl. Any ideas?

Also it would be nice to set an icon for this item, but that's not likely to
happen?

+++ Rick ---

Signature

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web

Rick Strahl [MVP] - 02 Aug 2004 11:49 GMT
Never mind. I can just use the InsertionIndex to actually retrieve the
CommandBarControl from the parent menu. Still seems odd that you can't more
easily reference this menu item.

CommandBar commandBarHelp = (CommandBar)commandBars["Help"];

int InsertionIndex = commandBarHelp.Controls.Count - 2;

CommandBar commandBar = applicationObject.Commands.AddCommandBar("West Wind
Html Help Builder",

vsCommandBarType.vsCommandBarTypeMenu,commandBarHelp,InsertionIndex) as
CommandBar;

CommandBarControl cbMenu = commandBarHelp.Controls[InsertionIndex];

cbMenu.BeginGroup = true;

InsertionIndex = 1; // Insert Items at the top

+++ Rick ---
Signature


Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web

> I'm trying to add a new menu bar to my Add-In instead of adding to an
> existing menu. I've got this working fine, but I can't figure out how to
[quoted text clipped - 20 lines]
>
> +++ Rick ---

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.