getting a disabled picture
-
hi all, when i put a bitmap on a button and disable the control, the image is painted in a smooth gray-scale way. is there any chance to access the corresponding
Image MakeMyImageGrayScale(Image my Image);
function directly, giving it the colored image and getting back the grayscaled one? or is the algorithm easy, so that someone can describe it here in the forum or knows a link to a description? if someone tells me how, i would do that myself. would be :cool: thx in advance :wq
-
hi all, when i put a bitmap on a button and disable the control, the image is painted in a smooth gray-scale way. is there any chance to access the corresponding
Image MakeMyImageGrayScale(Image my Image);
function directly, giving it the colored image and getting back the grayscaled one? or is the algorithm easy, so that someone can describe it here in the forum or knows a link to a description? if someone tells me how, i would do that myself. would be :cool: thx in advance :wq
ok, i wrote my own:
Image ImageToGrayScale(Image orig)
{
Bitmap bm = new Bitmap(orig);
for (int i=0; i<bm.Width; ++i)
for (int j=0; j<bm.Height; ++j)
{
Color pixel = bm.GetPixel(i,j);
if (pixel.A>0)
{
int grayVal = 175+(pixel.R+pixel.G+pixel.B)/12;
bm.SetPixel(i,j,Color.FromArgb(grayVal,grayVal,grayVal));
}
}
return bm;
}:rolleyes: :wq