Setting picture for CommandBar button

Y

Yevgeny Barkovsky

Hello!

Is the standard procedure to set CommandBar button image don't applicable
for Visio 2003?

When I try to use code listed below, I have "Unspecified error" exception.
All images referenced in the code is embedded 16x16 images.

<skipped command bar button creation>

System.Reflection.Assembly ThisAssembly;

ThisAssembly = System.Reflection.Assembly.GetExecutingAssembly();


System.IO.Stream objStreamPic, objStreamMask;

objStreamPic =
ThisAssembly.GetManifestResourceStream("VisioTestProject.settings.bmp");

objStreamMask =
ThisAssembly.GetManifestResourceStream("VisioTestProject.Settings_mask.bmp")
;

stdole.IPictureDisp iPic, iMask;

iPic =
LocalAxHost.IPictureDisp(System.Drawing.Image.FromStream(objStreamPic));

iMask =
LocalAxHost.IPictureDisp(System.Drawing.Image.FromStream(objStreamMask));

addedCommandBarButton.Picture = iPic;

addedCommandBarButton.Mask = iMask;


All code before "addedCommandBarButton.Picture = iPic;" works fine, no nulls
as iPic and iMask values....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top