日期:2014-05-17  浏览次数:20963 次

C# GDI+怎么将图片填充到多边形
有5个point位置得到了一个旋转的及显示位置的矩形,怎么根据这5个位置画一个旋转及指定位置的图形,对GDI不太熟,忘大神指点迷津!
C# GDI+

------解决方案--------------------
private void Form1_Load(object sender, EventArgs e)
{
    GraphicsPath mypath = new GraphicsPath();
    mypath.AddPolygon(new[] { new Point(0, 0), new Point(0, this.Height), new Point(this.Width, 0) 
});
    Region myregion = new Region(mypath);
    this.Region = myregion;
}
再添加命名空间using System.Drawing.Drawing2D;
这样就能实现窗体变成三角形的功能了,至于矩形可以类似的写出代码。希望对你有用哈?
------解决方案--------------------
引用:
Quote: 引用:

private void Form1_Load(object sender, EventArgs e)
{
    GraphicsPath mypath = new GraphicsPath();
    mypath.AddPolygon(new[] { new Point(0, 0), new Point(0, this.Height), new Point(this.Width, 0) 
});
    Region myregion = new Region(mypath);
    this.Region = myregion;
}
再添加命名空间using System.Drawing.Drawing2D;
这样就能实现窗体变成三角形的功能了,至于矩形可以类似的写出代码。希望对你有用哈?


图片能画进去么?


可以用填充图片的方式