Writing a Visual Studio extension for a custom designer
So, I've got something I want to try out. The idea is to have a visual designer that works as a Visual Studio Extension, I want to be able to drag out event handlers and wire up behaviors, anyone who's ever played with the warcraft 开发者_JAVA百科III script editor will have a pretty good idea what I'm wanting to do. Is this kind of thing readily handled in the visual studio extensibility tools? If so where should I start looking to learn how to do this?
It's absolutely possible using the Visual Studio Extensibility tools. You'll want to create a VS Package. There are a few different mechanisms (macros, add-ins, and packages) you can use to extend Visual Studio, but Packages are by far the most powerful. More specifically, you should look into creating a "Custom Editor/Designer".
You'll need to download the Visual Studio 2010 SDK if you haven't already. There's a fantastic wizard for creating new VS Packages which will even generate a sample "Custom editor" that you can use as a starting point for your custom designer. I'd recommend reading through the code that the wizard generates until you really understand it. There's a lot of stuff going on, so it can take a while. If you want a book to get started, pretty much the only one I've found is Professional Visual Studio Extensibility, but there are other good resources on the internet. A few I've used are MSDN and DiveDeeper's VSX blog. Probably the best way to get started is reading the code samples from the VSX team, they even have about 10-15 samples related to custom editors!
Good luck!
精彩评论