Image on CommandBarButton

S

Suri

Hi,

here is my code snippet.

newCommanBarBtn =
(CommandBarButton)newCommandBar.Controls.Add(MsoControlType.msoControlButton,
Type.Missing, Type.Missing, Type.Missing, Type.Missing);

//newCommanBarBtn.Style = MsoButtonStyle.msoButtonCaption;

newCommanBarBtn.Style = MsoButtonStyle.msoButtonIconAndCaption;

newCommanBarBtn.Caption = "Save";

newCommanBarBtn.Tag = "Save Tag";

System.Drawing.Image myImage =
Image.FromFile(@"C:\Trials\WordApp\WordApp\Resources\Bitmap1.bmp");

pict = imageConv.ImagetoIPicture(myImage);

newCommanBarBtn.Picture = pict;

In the above code, I am able to get a non null "pict" object of the type
stdole.IPictureDisp from my helper ImageConverter class. However, as soon as
I try to assign the pict to CommandBarButton's picture property I get a Com
Exception "Catastrophic Failure; E_Unexpected"



Please help!-

-S
 
Top