private void button2_Click(object sender, EventArgs e)
{
Bitmap _Bit = (Bitmap)Image.FromFile(@"C:\1.bmp");
Point[] _Point = new Point[3];
_Point[0] = new Point(0, 0);
_Point[1] = new Point(0, 100);
_Point[2] = new Point(100, 100); //定义了一个三角
this.BackgroundImage = GetBitmap(_Bit, _Point);
} public static Bitmap GetBitmap(Bitmap p_Bitmap, Point[] p_Point)
{
System.Drawing.Drawing2D.GraphicsPath _Path = new System.Drawing.Drawing2D.GraphicsPath();
_Path.AddPolygon(p_Point);
Region _Region = new Region(new RectangleF(0, 0, p_Bitmap.Width, p_Bitmap.Height));
_Region.Xor(_Path);
Bitmap _New = (Bitmap)p_Bitmap.Clone();
Graphics _Graphics = Graphics.FromImage(_New);
_Graphics.FillRegion(Brushes.White,_Region);
_Graphics.Dispose();
return _New;
}这样看看.
{
Bitmap _Bit = (Bitmap)Image.FromFile(@"C:\1.bmp");
Point[] _Point = new Point[3];
_Point[0] = new Point(0, 0);
_Point[1] = new Point(0, 100);
_Point[2] = new Point(100, 100); //定义了一个三角
this.BackgroundImage = GetBitmap(_Bit, _Point);
} public static Bitmap GetBitmap(Bitmap p_Bitmap, Point[] p_Point)
{
System.Drawing.Drawing2D.GraphicsPath _Path = new System.Drawing.Drawing2D.GraphicsPath();
_Path.AddPolygon(p_Point);
Region _Region = new Region(new RectangleF(0, 0, p_Bitmap.Width, p_Bitmap.Height));
_Region.Xor(_Path);
Bitmap _New = (Bitmap)p_Bitmap.Clone();
Graphics _Graphics = Graphics.FromImage(_New);
_Graphics.FillRegion(Brushes.White,_Region);
_Graphics.Dispose();
return _New;
}这样看看.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货