日期:2014-05-17 浏览次数:20864 次
Graphics g = this.pictureBox1.CreateGraphics(); Bitmap bitmap = new Bitmap(@"D:\My Documents\My Pictures\20100713133939131.jpg"); float[][] matrixItems = { 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,0.8f,0}, new float[]{0,0,0,0,1}, }; ColorMatrix colorMatrix = new ColorMatrix(matrixItems); ImageAttributes imageAtt = new ImageAttributes(); imageAtt.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); int iWidth = bitmap.Width; int iHeight = bitmap.Height; g.DrawLine(new Pen(Color.Black, 25), new Point(10, 35), new Point(200, 35)); //图片是半透明的 g.DrawImage(bitmap, new Rectangle(30, 0, iWidth, iHeight), 0, 0, iWidth, iHeight, GraphicsUnit.Pixel, imageAtt); g.DrawString(); g.Flush(); g.Dispose();