圖片透明

直接貼代碼

 

——————————

有更好的方法一起討論

float[][] transArray = {
                new float[] { 1, 0, 0, 0, 0 },
                new float[] { 0, 1, 0, 0, 0 },
                new float[] { 0, 0, 1, 0, 0 },
                new float[] { 0, 0, 0, 1f, 0 },
                new float[] { 0, 0, 0, 0, 1 }
            };

            ColorMatrix mstrix = new ColorMatrix(transArray);

            ImageAttributes attri = new ImageAttributes();
            attri.SetColorMatrix(mstrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);

            Bitmap bmp = new Bitmap(@"E:/Jiho/ll.jpg");
            e.Graphics.DrawImage(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height), 0, 0, bmp.Width, bmp.Height, GraphicsUnit.Pixel, attri);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章