Visual Studio Developer Center > Visual Studio Forums > Visual Studio Extensibility > ToolWindowPane icon (aka bitmap, aka image)
Ask a questionAsk a question
 

AnswerToolWindowPane icon (aka bitmap, aka image)

  • Monday, November 02, 2009 7:10 PMLee J Grissom Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    I was using the original bmp strip that gets generated from the VSIP Wizard, and I was inserting my new icons no problem.  Then I got brave, and decided to create a new bmp strip from scratch and use that instead.  Well, it works just fine except for one thing:  My custom ToolWindowPane no longer shows an icon on it's tab anymore.  Sure, I'm tempted to revert back to using the original strip, but I'd really like to get to the bottom of why my new strip works great everywhere in the VS IDE, except the ToolWindowPane.  It's just not showing at all.  Did I forget to blow away some registry setting?  I have read all the other reports here talking about various format and bitdepths (bmp vs png, 24-bit vs 32-bit, magenta background vs some other crazy colors).  I've tried all of those suggestions and none of those seem to have any improvement on my situation.   Very bizarre.

    public FileHistoryToolWindow() : base(null)
    {
      // Set the window title reading it from the resources.
      this.Caption = Resources.ToolWindowTitle;
      // Set the image that will appear on the tab of the window frame
      // when docked with an other window
      // The resource ID correspond to the one defined in the VSPackage.resx file.
      // The Index is the zero-based offset in the bitmap strip (if you're using a strip). 
      // Each image in the strip being 16x16 pixels.
      this.BitmapResourceID = 400;
      this.BitmapIndex = 0;
    
    <data name="400" type="System.Resources.ResXFileRef, System.Windows.Forms">
      <value>Resources\ToolWin2.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    </data>
    


    Cheers,
    Lee

Answers

  • Wednesday, November 04, 2009 8:41 AMWesley YaoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi Lee,

    Is your bitmap's height 16? your code looks good and I succeed with trying it:
    1. Right-click the Resources folder in the Solution Explorer, select Add->New Item to add a new bitmap into project.
    2. Adjust the bitmap's size to 16x16 and edit it in the IDE.
    3. Modify the VSPackage.resx to use the code you referenced.

    You could also try to append the default bitmap "301" to add a new icon.

    Hope that helps.

    Sincerely,
    Wesley
    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

All Replies

  • Wednesday, November 04, 2009 8:41 AMWesley YaoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi Lee,

    Is your bitmap's height 16? your code looks good and I succeed with trying it:
    1. Right-click the Resources folder in the Solution Explorer, select Add->New Item to add a new bitmap into project.
    2. Adjust the bitmap's size to 16x16 and edit it in the IDE.
    3. Modify the VSPackage.resx to use the code you referenced.

    You could also try to append the default bitmap "301" to add a new icon.

    Hope that helps.

    Sincerely,
    Wesley
    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Monday, November 09, 2009 3:07 AMWesley YaoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hello,

    How are you? Is your problem resolved? May I know whether the above suggestions helped you?

    Thanks,
    Wesley


    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.