图片透明

来源:互联网 发布:淘宝买东西怎么付款 编辑:程序博客网 时间:2024/04/30 17:11

直接贴代码

 

——————————

有更好的方法一起讨论

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);

原创粉丝点击