P
Puneet
I created an imagelist object and added image to that object.
Now the picture property of button accepts Stdole.IPictureDisp type. So to convert the imge type returned from the imagelist object i used
using System;
using System.Drawing;
using System.Windows.Forms;
using stdole;
public class MyHost : AxHost
{
public MyHost(): base("59EE46BA-677D-4d20-BF10-8D8067CB8B33")
{
}
public new static IPictureDisp GettIPictureDispFromPicture(Image image)
{
return (IPictureDisp)AxHost.GetIPictureDispFromPicture(image);
}
}
this class
and here is the coding to add the pic
ImagelistForm ObjIlf = new ImagelistForm();
//To add the "Archive to Sugar" button in the outlook
Office.CommandBarButton button_1 =(Office.CommandBarButton)newToolBar.Controls.Add(1, missing, missing, missing, missing);
button_1.Style = (Microsoft.Office.Core.MsoButtonStyle)Office.MsoButtonStyle. msoButtonCaption;
button_1.Caption = "Archive to Sugar";
button_1.Tag = "ArchivetoSugar";
button_1.piPicture = MyHost.GettIPictureDispFromPicture(ObjIlf.imageListbuttons.I mages[1]);
if (this.archieve == null)
{
this.archieve = button_1;
archieve.Click += new Office._CommandBarButtonEvents_ClickEventHandler(archieveCli ck);
}
But the pic is not shown on the button
If any body knows th tricks than plz reply as soon as possible as i have already spent lots of time on that
Now the picture property of button accepts Stdole.IPictureDisp type. So to convert the imge type returned from the imagelist object i used
using System;
using System.Drawing;
using System.Windows.Forms;
using stdole;
public class MyHost : AxHost
{
public MyHost(): base("59EE46BA-677D-4d20-BF10-8D8067CB8B33")
{
}
public new static IPictureDisp GettIPictureDispFromPicture(Image image)
{
return (IPictureDisp)AxHost.GetIPictureDispFromPicture(image);
}
}
this class
and here is the coding to add the pic
ImagelistForm ObjIlf = new ImagelistForm();
//To add the "Archive to Sugar" button in the outlook
Office.CommandBarButton button_1 =(Office.CommandBarButton)newToolBar.Controls.Add(1, missing, missing, missing, missing);
button_1.Style = (Microsoft.Office.Core.MsoButtonStyle)Office.MsoButtonStyle. msoButtonCaption;
button_1.Caption = "Archive to Sugar";
button_1.Tag = "ArchivetoSugar";
button_1.piPicture = MyHost.GettIPictureDispFromPicture(ObjIlf.imageListbuttons.I mages[1]);
if (this.archieve == null)
{
this.archieve = button_1;
archieve.Click += new Office._CommandBarButtonEvents_ClickEventHandler(archieveCli ck);
}
But the pic is not shown on the button
If any body knows th tricks than plz reply as soon as possible as i have already spent lots of time on that