C#实现图形区域组合操作的方法
2015-06-12 16:17
1041 查看
本文实例讲述了C#实现图形区域组合操作的方法。分享给大家供大家参考。具体实现方法如下:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace advanced_drawing { public partial class Form17 : Form { public Form17() { InitializeComponent(); } private void Form17_Paint(object sender, PaintEventArgs e) { Rectangle regionRect = new Rectangle(20, 20, 100, 100); e.Graphics.DrawRectangle(Pens.Black, regionRect); RectangleF unionRect = new RectangleF(90, 30, 100, 100); e.Graphics.DrawRectangle(Pens.Red, Rectangle.Round(unionRect)); Region myRegion = new Region(regionRect); //myRegion.Union(unionRect); //myRegion.Intersect(unionRect); //myRegion.Exclude(unionRect); //myRegion.Complement(unionRect); myRegion.Xor(unionRect); SolidBrush myBrush = new SolidBrush(Color.Blue); e.Graphics.FillRegion(myBrush, myRegion); } } }
希望本文所述对大家的C#程序设计有所帮助。
您可能感兴趣的文章:
相关文章推荐
- c#调用COM组件
- C#中抽象方法与虚拟方法的区别
- c#中虚函数的相关使用方法
- C#实现多线程的同步方法实例分析
- C#中尾递归的使用、优化及编译器优化
- C#通用邮件发送类分享
- C#中this的用法集锦
- C#中Equality和Identity浅析
- C#生成饼形图及添加文字说明实例代码
- C#判等对象是否相等的方法汇总
- C#简单的向量用法实例教程
- C#托管堆对象实例包含内容分析
- C#实现按照指定长度在数字前补0方法小结
- C#虚方法的声明和使用实例教程
- C#获取文件夹及文件的大小与占用空间的方法
- C#定义简单的反射工厂实例分析
- C#数字图象处理之肤色检测的方法
- C#实现用于操作wav声音文件的类实例
- C#画笔Pen绘制自定义线的帽子
- C#选择排序法实例分析