Search

Automation Model (EnvDTE) Enhancement: Accept .NET System.Drawing.Icon to set custom pictures in add-in commands and toolwindows by MVP CarlosQ

Closed
as Fixed Help for as Fixed

6
Sign in to vote
0
Sign in to vote
Sign in
to vote
Type: Suggestion
ID: 336868
Opened: 4/4/2008 1:23:11 AM
Access Restriction: Public
0
Workaround(s)
This is a reopen suggestion for http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=114769.

Add-Ins can create two UI elements that can have custom pictures:

- Buttons (from commands): the custom picture is set through the EnvDTE.Commands.AddNamedCommandBar method.
- Toolwindows: the custom picture is set through the EnvDTE.Window.SetTabPicture method.

The current APIs require a bitmap (not an icon) and have two problems that make this problem the #1 problem in forums (described below)
Details (expand)
Product Language
English

Version

Visual Studio 2008
Operating System
Windows Vista
Operating System Language
English
Problem Statement
- It is extremely complicated to make the picture transparent. This problem lasts at least 10 years from the times of Visual Basic 5.0. Some times you need to use almost green (RGB=0,254,0), sometimes magenta (RGB=255,0,255), which is confusing and counterintuitive.

- It requires a satellite DLL, that can be native or managed (.NET) but in both cases is very complicated to create and register (native DLLs require Visual C++ which is alien to many VB.NET/C# developers and managed DLLs require Windows Explorer, Notepad, ResGen, Assembly Linker and whatever else (see the official solution from Microsoft at http://msdn2.microsoft.com/en-us/library/ms228771(VS.80).aspx).

The following links provide you feedback of the magnitute of the problem. Read the questions of forums, and the comments to blog posts explaining the solutions:

http://blogs.msdn.com/hlong/archive/2005/09/27/474522.aspx
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3112665&SiteID=1
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3022255&SiteID=1
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=188155&SiteID=1
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3020962&SiteID=1
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2833767&SiteID=1
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1871235&SiteID=1
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3016466&SiteID=1
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2172354&SiteID=1
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2702922&SiteID=1
etc.
http://blogs.msdn.com/craigskibo/archive/2004/01/08/48814.aspx
http://www.mztools.com/articles/2005/MZ2005007.aspx
Proposed Solution
In the new Visual Studio version (10.0):

1) Satellite DLLs (managed or native) should not be required. They may be OK for string localizations, but please don't force us to create satellite DLLs for pictures that could be in the own assembly add-in.

2) Provide an EnvDTE100.Commands.AddNamedCommandBar3 that accepts a System.Drawing.Icon as custom picture. Since icons have the concept of transparency (which bitmaps lack), no tricky magenta or almost green would be necessary.

3) Provide an EnvDTE100.Window3.SetTabPicture that accepts a System.Drawing.Icon.
TAP Code (if applicable)
VSIPISSUE
      You can indicate your satisfaction with how Microsoft handled this issue by completing this quick 3 question survey. [Details]

 

File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 3/26/2009 at 10:24 AM
We are replacing the core shell UI layer with WPF for Visual Studio 2010 and have made a few changes to how resources are loaded. We'll check into getting some details on that for you. thanks
Posted by Microsoft on 8/24/2009 at 11:47 AM
Hello Carlos,

I wanted to let you know that the following improvements to Visual Studio 2010 were made based on your feedback:

1)    There will be support for loading a command's bitmap from the add-in module if there is no satellite DLL or if the satellite DLL doesn't contain the image.
2)    Commands.AddNamedCommand2 will now support an IPicture.

QA is currently testing these changes, and I cannot confirm at this time if these changes will appear in the Beta 2 release of VS 2010.

Cheers,
Suzanne Hansen, Program Manager, Visual Studio Platform Shell Team
Posted by Microsoft on 9/11/2009 at 2:20 PM
Hello Carlos,

I wanted to update the Connect bug that’s tracking your request with the final changes that were made to this feature. In addition to the previously mentioned changes, we are also including the following improvements:

For the AddNamedCommands2 method you will now be able to specify image objects that are System.Drawing.Bitmap or System.Drawing.Icon. (In addition to the IPicture support.) This should reduce some of the native to .NET conversion pains that many people have experienced. (Please note that CommandBarButton.Picture is strongly typed to IPicture, so no change was done to that property.)

A similar change for package authors – a new API, AddNamedCommands3, will be available that will also accept Bitmaps, Icons and IPictures.

I want to thank you again for being such a great advocate for the Visual Studio community, and for working with us to make sure that we make the right improvements.

Thanks,
Suzanne Hansen, Program Manager, Visual Studio Platform Shell Team