After I wrote this post about using .NET Reflector to debug Visual Studio assemblies,
Guest post: Using .NET Reflector to understand and debug Visual Studio assemblies
Finally today, after much reluctance in the past weeks, I have decided to adopt Visual Studio 2012 as the development environment for all my Visual Studio solutions, and I have just migrated them. I still find the default Light theme unpalatable but the Visual Studio 2012 Color Theme Editor extension provides much more pleasant themes and you can even switch themes with a couple of clicks.
What prompted me to the move was that Packt Publishing gave me a copy of the book Visual Studio 2012 Cookbook of fellow MVP Richard Banks to write a review and after reading the first chapter about the new IDE enhancements in the Solution Explorer and Tab Well I realized they were too good to miss the opportunity to use them on a daily basis.
There is a feature in my MZ-Tools add-in that requires to show the pictures of its commands in a treeview, to select which ones to be visible or not. When using Visual Studio 2012 and the Dark theme, the background of the form and the treeview are darked, and the bitmaps should have inverted colors.
I wanted to reuse the command pictures and use a function that inverts their colors as VS 2012 does. I knew the ThemeDIBits method of the IVsUIShell5 interface, but it took me a while to discover a Visual Studio assembly that used it. Finally I found it and here is the approach:
HOWTO: Get an inverted bitmap to use with the Dark theme of Visual Studio 2012 from an add-in.
The sample also shows how to get the background color of toolwindows, using also the IVSUIShell5 interface.
Note: my command pictures use the almost green (RGB=0,254,0) to denote the transparent color, and the sample provided uses that color, but you can use any color.
My new article in the MZ-Tools Articles Series is about Visual Studio extension setups (a digression from the “theming extensions” subject of my last articles). I learn something new very often from questions in the MSDN Visual Studio Extensibility (VSX) Forum, when I have to investigate something before providing an answer.
A few days ago a question led me to learn something new that I have documented here:
HOWTO: Detect Visual Studio requirements for MSI-based extensions setups.
While writing that article I noticed that I had to update a bit these old ones:
HOWTO: Detect installed Visual Studio editions, packages or service packs
HOWTO: Detect if Visual Studio .NET is installed in a Visual Studio Setup package for an add-in
This is one of the bugs that I found while theming my MZ-Tools add-in with VS 2012 Dark / Light themes:
BUG: Visual Studio 2012 doesn’t theme multiline textbox with initial scrollbar on add-in toolwindow.
And here it is the bug that I have filed through Microsoft Connect to be fixed:
Visual Studio 2012 doesn’t theme multiline textbox with initial scrollbar on add-in toolwindow
Fortunately I found an easy workaround that I have mentioned in the article.
Another building block that I have used to theme my MZ-Tools add-in with the Visual Studio 2012 Dark/Light themes:
HOWTO: Get the Microsoft.VisualStudio.Shell.Interop.IVsUIShell5 interface to theme a Visual Studio 2012 add-in:
In a next article I will explain how to invert the colors of a bitmap like VS 2012 does.
I had pending for weeks to theme scrollbars of controls of my MZ-Tools add-in on modal forms (Visual Studio 2012 automatically themes scrollbars of controls on toolwindows) and finally yesterday I decided to devote some time to the investigation. Here is the answer:
HOWTO: Theme scrollbars of controls on a Windows Forms modal window from a Visual Studio 2012 add-in.
While writing a new article, I have noticed that these two articles required some updating.
Since this article was written, a new GAC location has appeared with .NET Framework 4.0 (in C:WindowsMicrosoft.NETassembly), that furthermore doesn’t have a shell extension:
HOWTO: Reference a Visual Studio assembly in the GAC from an add-in
And I have added C# sample code to this other one:
HOWTO: Get a Visual Studio service from an add-in