[高分求救] C#中如何画橡皮圆? 画橡皮线跟橡皮矩形都可以用ControlPaint中的方法搞定,但是橡皮圆怎么画? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 帮忙顶一下,满三了不能写出了。。http://topic.csdn.net/u/20090805/13/254df2c5-2356-438a-a7f5-7f9ce5a9b3b0.html 我顶,,学习了[align=center]**************************************************************** 看帖一定要回,分也一定要接哦 ^_^****************************************************************[/align] { using (Region RG = new Region()) { Rectangle RC1 = default(Rectangle); Rectangle RC2 = default(Rectangle); RC1 = new Rectangle(10, 10, 100, 100); RC2 = new Rectangle(20, 20, 80, 80); using (Drawing2D.GraphicsPath GP = new Drawing2D.GraphicsPath()) { GP.AddEllipse(RC1); GP.AddEllipse(RC2); RG.Intersect(GP); } using (Graphics G = this.CreateGraphics) { G.FillRegion(Brushes.Red, RG); } } } Graphics g = e.Graphics; SolidBrush redBrush = new SolidBrush(Color.Red); g.FillEllipse(redBrush, 0, 0, 100, 60); g.FillPie(redBrush, 100, 0, 100, 70, 30, 300); g.FillRectangle(redBrush, 200, 10, 100, 50); Point[] points = { new Point(0, 100), new Point(20, 120), new Point(50, 100), new Point(60, 200), new Point(30, 220), new Point(180, 200), new Point(20, 110), new Point(0, 220) }; g.FillPolygon(redBrush, points); Rectangle fillRect = new Rectangle(200, 100, 200, 200); Region fillRegion = new Region(fillRect); g.FillRegion(redBrush, fillRegion);参考 http://download.csdn.net/source/1475122这个是橡皮筋线的。你可以参考一下。 多谢csz_1987,皮筋线跟皮筋矩形都已近搞定了,就是皮筋圆有问题. 我的实现是参照http://blog.csdn.net/wzuomin/archive/2006/12/13/1441007.aspx 中的第一个例子做的,所以皮筋圆部分也尽量用.Net自身的功能来实现,尽量不要去引用gdi32.dll 再次表达一下对 dylike 的感谢. 串口收发影响界面运行 更新 datagridview 时,总出这个提示,什么原因呀,我找不到规律呀? 如何实现QQ自动注册功能??? 菜鸟遇见的一个不懂的题目,请教大家. C#SQL查询 简单问题 请高手给个思路,谢谢 用Response.Redirect(文件名称)显示在同一浏览器中,我要显示到新的浏览器中的命令用什么? 怎么实现VB中的Modules(模块)? visual studio 2019怎么关闭输出 使用的vs2005开发工具,要做单元测试,没有此功能,怎么办 WinForms的程序,想只运行一次,并最小化到系统托盘
满三了不能写出了。。
http://topic.csdn.net/u/20090805/13/254df2c5-2356-438a-a7f5-7f9ce5a9b3b0.html
****************************************************************
看帖一定要回,分也一定要接哦 ^_^
****************************************************************[/align]
using (Region RG = new Region()) {
Rectangle RC1 = default(Rectangle);
Rectangle RC2 = default(Rectangle);
RC1 = new Rectangle(10, 10, 100, 100);
RC2 = new Rectangle(20, 20, 80, 80);
using (Drawing2D.GraphicsPath GP = new Drawing2D.GraphicsPath()) {
GP.AddEllipse(RC1);
GP.AddEllipse(RC2);
RG.Intersect(GP);
}
using (Graphics G = this.CreateGraphics) {
G.FillRegion(Brushes.Red, RG);
}
}
}
SolidBrush redBrush = new SolidBrush(Color.Red);
g.FillEllipse(redBrush, 0, 0, 100, 60);
g.FillPie(redBrush, 100, 0, 100, 70, 30, 300);
g.FillRectangle(redBrush, 200, 10, 100, 50);
Point[] points =
{
new Point(0, 100),
new Point(20, 120),
new Point(50, 100),
new Point(60, 200),
new Point(30, 220),
new Point(180, 200),
new Point(20, 110),
new Point(0, 220)
};
g.FillPolygon(redBrush, points);
Rectangle fillRect = new Rectangle(200, 100, 200, 200);
Region fillRegion = new Region(fillRect);
g.FillRegion(redBrush, fillRegion);
参考