StealthRT
StealthRT

Reputation: 10542

Visual Studio 2013 Add custom toolbar Button

Hey all I have been searching Google for a while now trying to find anything on how to go about setting up you're own button on the VS toolbar.

What I am talking about is this:

enter image description here

And when I click on that button I would like to be able to execute some C# code.

As an example, say I had the word "HELLO" highlighted and I pushed on that button on the toolbar and I wrote some code behind it that, when pressed, have whatever is highlighted turn bold and change color from normal BLACK to enter image description here.

I was originally thinking that it was called Visual Studio Extensibility Tools but that doesn't seem to be what I am looking for here - it seemed more as a Nuget plugin type of thing?

I'm looking for more like what you can do with the Office suite of products within VS addins - As in make a button for Outlooks toolbar, etc..

enter image description here

The only remotely close thing I could find so far would be this.

If anyone has done this before or at least know what to search for then please let me know!

Upvotes: 1

Views: 275

Answers (1)

Walt Ritscher
Walt Ritscher

Reputation: 7037

You were on the right track with Visual Studio Extensiblilty tools.

There are several steps.

  • Create the Toolbar and add the button.
  • Create the event handler that runs when the button is clicked.
  • Determine what document has focus (c# doc, xml doc, vb doc, etc.)
  • Determine what is selected in the document.
  • Change the code formatting

Start with an overview of the Extensions SDK.

Here's how to create a toolbar with the VS extensions. Creating a Toolbar for the IDE

Upvotes: 1

Related Questions