D
Dorell
Hi All
I’m trying to create a 48x48 Bitmap image from the 3 colour properties
(CategoryGradientBottomColor, CategoryGradietTopColor and
CategoryGradientBorderColor) of a Category object so that it can be displayed
on a CommandBarButton. I have black displayed in the area to be painted with
a white background in a 48x48 image that is stored as an Image Resource. I
use this image as the mask for the button and as the template for drawing
Category colours.
I know that I need to apply the border property to the pixels around the
edge of the black image but how do I apply the 2 gradient properties to the
area of the image so that it appears as it would when displayed by Outlook?
Regards,
Jason
Here is the code I have so far...
Category category = Application.Session.Categories[index];
imageList.Images.Add(Properties.Resources.CategoryTemplate);
Color categoryGradientTopColor =
PictureConverter.OleColorToDrawingColor(category.CategoryGradientBottomColor);
Color categoryGradientTopColor =
PictureConverter.OleColorToDrawingColor(category.CategoryGradientTopColor);
Color categoryBorderColor =
PictureConverter.OleColorToDrawingColor(category.CategoryBorderColor);
Bitmap newCategoryImage = (Bitmap)ImageList.Images[0];
for (int x = 0; x < 48; x++)
{
for (int y = 0; y < 48; y++)
{
// Code to apply the 3 category color properties to newCategoryImage
}
}
IPictureDisp categoryImage =
PictureConverter.ImageToPictureDisp(newCategoryImage);
button.Picture = categoryImage;
button.Mask = PictureConverter.ImageToPictureDisp(imageList.Images[0]);
internal class PictureConverter : AxHost
{
private PictureConverter() : base(String.Empty) { }
public static stdole.IPictureDisp ImageToPictureDisp(Image image)
{
return (stdole.IPictureDisp)GetIPictureDispFromPicture(image);
}
public static Color OleColorToDrawingColor(uint OleColor)
{
return GetColorFromOleColor(OleColor);
}
}
I’m trying to create a 48x48 Bitmap image from the 3 colour properties
(CategoryGradientBottomColor, CategoryGradietTopColor and
CategoryGradientBorderColor) of a Category object so that it can be displayed
on a CommandBarButton. I have black displayed in the area to be painted with
a white background in a 48x48 image that is stored as an Image Resource. I
use this image as the mask for the button and as the template for drawing
Category colours.
I know that I need to apply the border property to the pixels around the
edge of the black image but how do I apply the 2 gradient properties to the
area of the image so that it appears as it would when displayed by Outlook?
Regards,
Jason
Here is the code I have so far...
Category category = Application.Session.Categories[index];
imageList.Images.Add(Properties.Resources.CategoryTemplate);
Color categoryGradientTopColor =
PictureConverter.OleColorToDrawingColor(category.CategoryGradientBottomColor);
Color categoryGradientTopColor =
PictureConverter.OleColorToDrawingColor(category.CategoryGradientTopColor);
Color categoryBorderColor =
PictureConverter.OleColorToDrawingColor(category.CategoryBorderColor);
Bitmap newCategoryImage = (Bitmap)ImageList.Images[0];
for (int x = 0; x < 48; x++)
{
for (int y = 0; y < 48; y++)
{
// Code to apply the 3 category color properties to newCategoryImage
}
}
IPictureDisp categoryImage =
PictureConverter.ImageToPictureDisp(newCategoryImage);
button.Picture = categoryImage;
button.Mask = PictureConverter.ImageToPictureDisp(imageList.Images[0]);
internal class PictureConverter : AxHost
{
private PictureConverter() : base(String.Empty) { }
public static stdole.IPictureDisp ImageToPictureDisp(Image image)
{
return (stdole.IPictureDisp)GetIPictureDispFromPicture(image);
}
public static Color OleColorToDrawingColor(uint OleColor)
{
return GetColorFromOleColor(OleColor);
}
}