请教各位superman一个问题
如何求解两个图形的交集、并集以及两个图形相减后的图形?求编程思路,能有程序就更好啦!谢谢啦。。。
Rectangle rec = new Rectangle(0,0,100, 72);//0,0坐标,长100高72的矩形 private void button1_Click(object sender, EventArgs e) { Bitmap bmp=new Bitmap(this.Width,this.Height);//申请图片 Graphics myGraphics = Graphics.FromImage(bmp); GraphicsPath myGraphicsPath = new GraphicsPath();//声明路径myGraphicsPath FontFamily myFontFamily = new FontFamily("黑体"); Point myPoint = new Point(0, 0); StringFormat myStringFormat = new StringFormat(); myGraphicsPath.AddString("要取交集的文字",myFontFamily, 1, 72, myPoint, myStringFormat); Pen myPen = new Pen(Color.Red, 1); myGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;//反锯齿 myGraphics.DrawPath(myPen, myGraphicsPath); //绘制路径myGraphicsPath SolidBrush myBrash = new SolidBrush(Color.Red); else { Region re = new Region(rec);//声明Region对象并用rec初始化 re.Intersect(myGraphicsPath); //区交集 myGraphics.FillRegion(myBrash, re); ////用myBrash填充re的内部 this.CreateGraphics().DrawImage(bmp,0,0);//将内存中的图片显示出来 myGraphics.Dispose();//释放资源 } }//一个文字与一个矩形取交集的例子,希望有帮助~~