У меня есть форма, которая имеет изображение. Я использую ползунок для изменения непрозрачности изображения. Поэтому в событии "ValueChanged" слайдера я вызываю следующий метод для изменения непрозрачности.
//Setting the opacity of the image
public static Image SetImgOpacity(Image imgPic, float imgOpac)
{
Bitmap bmpPic = new Bitmap(imgPic.Width, imgPic.Height);
Graphics gfxPic = Graphics.FromImage(bmpPic);
ColorMatrix cmxPic = new ColorMatrix();
cmxPic.Matrix33 = imgOpac;
ImageAttributes iaPic = new ImageAttributes();
iaPic.SetColorMatrix(cmxPic, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
gfxPic.DrawImage(imgPic, new Rectangle(0, 0, bmpPic.Width, bmpPic.Height), 0, 0, imgPic.Width, imgPic.Height, GraphicsUnit.Pixel, iaPic);
gfxPic.Dispose();
return bmpPic;
}
Возвращенное изображение установлено на исходное изображение.
Моя проблема в том, что непрозрачность изображения не меняется... Если есть какая-либо ошибка, будьте любезны, чтобы указать... Thnx...