logo
CSharp_Graphics

Мозаичное заполнение изображением

-------------------

To flip an image horizontally while tiling

Image image = new Bitmap("HouseAndTree.gif");

TextureBrush tBrush = new TextureBrush(image);

Pen blackPen = new Pen(Color.Black);

tBrush.WrapMode = WrapMode.TileFlipX;

e.Graphics.FillRectangle(tBrush, new Rectangle(0, 0, 200, 200));

e.Graphics.DrawRectangle(blackPen, new Rectangle(0, 0, 200, 200));

To flip an image vertically while tiling

Image image = new Bitmap("HouseAndTree.gif");

TextureBrush tBrush = new TextureBrush(image);

Pen blackPen = new Pen(Color.Black);

tBrush.WrapMode = WrapMode.TileFlipY;

e.Graphics.FillRectangle(tBrush, new Rectangle(0, 0, 200, 200));

e.Graphics.DrawRectangle(blackPen, new Rectangle(0, 0, 200, 200));