C#绘画画图
画图,圆形,直线,多边形,等等 Graphics gs = Graphics.FromImage(img); Pen newPen = new Pen(Color.Red, 1); if (Ept.X <= 500 && Ept.Y <= 500) { if (radioButton2.Checked)//画直线 { gs.DrawLine(newPen, Spt, Ept); } if (radioButton3.Checked)//画矩形 { gs.DrawRectangle(newPen, Spt.X, Spt.Y, Ept.X - Spt.X, Ept.Y - Spt.Y); if (Ept.X < Spt.X && Ept.Y < Spt.Y) { gs.DrawRectangle(newPen, Ept.X, Ept.Y, Spt.X - Ept.X, Spt.Y - Ept.Y); } if (Ept.X < Spt.X) { gs.DrawRectangle(newPen, Ept.X, Spt.Y, Spt.X - Ept.X, Ept.Y - Spt.Y); } if (Ept.Y < Spt.Y) { gs.DrawRectangle(newPen, Spt.X, Ept.Y, Ept.X - Spt.X, Spt.Y - Ept.Y); } } if (radioButton4.Checked)//画圆形 { gs.DrawEllipse(newPen, Spt.X, Spt.Y, Ept.X - Spt.X, Ept.Y - Spt.Y); CursorD = false; return; } if (radioButton5.Checked)//画多边型 { if (!TwoClick) { gs.DrawLine(newPen, Spt, Ept); Mpt = Ept; TwoClick = true; } else { gs.DrawLine(newPen, Mpt, Ept); Mpt = Ept; } } if (radioButton7.Checked)//画曲线 { if (TwoClick == false && DoubleClick == false) { Mpt = Ept; TwoClick = true; } if (TwoClick == true && DoubleClick == false) { DoubleClick = true; } if (TwoClick && DoubleClick) { gs.DrawBezier(newPen, Fpt, Spt, Ept, Mpt); } } CursorD = false; } else { return; }
- 1
- 粉丝: 0
- 资源: 1
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助