KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a form which has a image. I am using a slider to change the opacity of the image. So in the "ValueChanged" event of the slider I am calling the following method to change the opacity. //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; } The returned Image is set to the original image. My problem is that the opacity of the image is not changing... If there is any error please be kind enough to point out.. Thnx...
Tags (comma-separated)
Save Edits
Cancel