C# 解决DrawImage绘制图片拉伸产生渐变

来源:互联网 发布:东莞seo外包 编辑:程序博客网 时间:2024/05/17 05:24

转自:http://blog.sina.com.cn/s/blog_4b34850001010tpx.html

 

方法一:

ImageAttributes ImgAtt = new ImageAttributes(); ;
                ImgAtt.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY);

 

m_graphics.DrawImage(image, new System.Drawing.Rectangle((int)(x - width / 2 + backBmp1.Width), (int)(y - pixel + 1), backBmp2.Width, backBmp2.Height), 0, 0, backImage2.Width, backImage2.Height, GraphicsUnit.Pixel,ImgAtt);

 

方法二:

 TextureBrush Txbrus = new TextureBrush(image);
 Txbrus.WrapMode = System.Drawing.Drawing2D.WrapMode.Tile;
 g.FillRectangle(Txbrus, new Rectangle(0, 0, width, height));

原创粉丝点击