S
seacuke
I've got an email add-in that has to be compatible with Outlook 2000 as
well as XP & 2003. The add-in's UI is a button placed on the standard
toolbar.
We would like to have a customized icon on the button, but have run
into an issue with the masking of the icon when the button is disabled;
I've worked with a lot of tweaks and toys trying to get the icon to
have a mask.
I'm writing in C#, and have tried to translate the VB code in this
article: http://support.microsoft.com/default.aspx?scid=kb;en-us;288771
to something I could use, and have had zero luck.
I noticed from trial and experimentation that the Office default
toolbar icons all mask very nicely (how convenient), and was wondering
if there was a way to get into that set of bitmaps and alter them so
that we could fake it into masking our icon?
Or, if anyone knows of a solution in C# that effectively creates a
bitmap that is masked properly when applied to a commandbarbutton it
would be a great help to me.
Here's the code that we're using to generate the icon:
// Load the existing image (blank) into the clipboard,
// so that we get the color of their default background.
syncButton.CopyFace();
IDataObject maskObject = Clipboard.GetDataObject();
maskBitmap = (Bitmap)maskObject.GetData(typeof (Bitmap));
// Load our image
Bitmap treeBitmap =
(Bitmap)Bitmap.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("addIn.SyncButtonImage.bmp"));
// Create new Graphics object based on the 'empty'
// bitmap loaded from the button.
Graphics graphics = Graphics.FromImage(maskBitmap);
// Mask our magenta
treeBitmap.MakeTransparent(Color.FromArgb(255,0,255));
// Apply our icon to the 'empty' bitmap
graphics.DrawImage(treeBitmap,0,0);
// Load bitmap and stash it on the button face.
Clipboard.SetDataObject(maskBitmap);
syncButton.PasteFace();
well as XP & 2003. The add-in's UI is a button placed on the standard
toolbar.
We would like to have a customized icon on the button, but have run
into an issue with the masking of the icon when the button is disabled;
I've worked with a lot of tweaks and toys trying to get the icon to
have a mask.
I'm writing in C#, and have tried to translate the VB code in this
article: http://support.microsoft.com/default.aspx?scid=kb;en-us;288771
to something I could use, and have had zero luck.
I noticed from trial and experimentation that the Office default
toolbar icons all mask very nicely (how convenient), and was wondering
if there was a way to get into that set of bitmaps and alter them so
that we could fake it into masking our icon?
Or, if anyone knows of a solution in C# that effectively creates a
bitmap that is masked properly when applied to a commandbarbutton it
would be a great help to me.
Here's the code that we're using to generate the icon:
// Load the existing image (blank) into the clipboard,
// so that we get the color of their default background.
syncButton.CopyFace();
IDataObject maskObject = Clipboard.GetDataObject();
maskBitmap = (Bitmap)maskObject.GetData(typeof (Bitmap));
// Load our image
Bitmap treeBitmap =
(Bitmap)Bitmap.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("addIn.SyncButtonImage.bmp"));
// Create new Graphics object based on the 'empty'
// bitmap loaded from the button.
Graphics graphics = Graphics.FromImage(maskBitmap);
// Mask our magenta
treeBitmap.MakeTransparent(Color.FromArgb(255,0,255));
// Apply our icon to the 'empty' bitmap
graphics.DrawImage(treeBitmap,0,0);
// Load bitmap and stash it on the button face.
Clipboard.SetDataObject(maskBitmap);
syncButton.PasteFace();