二、画刷的使用
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
public Form1()
{
InitializeComponent();
comboBox1.SelectedIndex = 0;
}
private void button1_Click(object sender, EventArgs e)
{
Bitmap bp = new Bitmap("1.jpg");
TextureBrush tb = new TextureBrush(bp);
Graphics g = this.CreateGraphics();
g.FillRectangle(tb, this.ClientRectangle);
bp.Dispose();
tb.Dispose();
g.Dispose();
}
private void button2_Click(object sender, EventArgs e)
{
Bitmap bp = new Bitmap("1.jpg");
TextureBrush tb = new TextureBrush(bp, new Rectangle(0, 0, 100, 100));
Graphics g = this.CreateGraphics();
switch (comboBox1.SelectedItem.ToString().Trim())
{
case "Clamp":
tb.WrapMode = WrapMode.Clamp;
g.FillRectangle(tb, this.ClientRectangle);
bp.Dispose();
tb.Dispose();
g.Dispose();
break;
case "Tile":
tb.WrapMode = WrapMode.Tile;
g.FillRectangle(tb, this.ClientRectangle);
bp.Dispose();
tb.Dispose();
g.Dispose();
break;
case "TileFlipX":
tb.WrapMode = WrapMode.TileFlipX;
g.FillRectangle(tb, this.ClientRectangle);
bp.Dispose();
tb.Dispose();
g.Dispose();
break;
case "TileFlipXY":
tb.WrapMode = WrapMode.TileFlipXY;
g.FillRectangle(tb, this.ClientRectangle);
bp.Dispose();
t
1070


画刷的使用&spm=1001.2101.3001.11974&articleId=5136643&d=1&t=3&u=92df88f72ce4469cac31a833f36cec42)

被折叠的 条评论
为什么被折叠?



