DrawEllipse.cs
上传用户:sxsgcs
上传日期:2013-10-21
资源大小:110k
文件大小:1k
- using System;
- using System.Windows.Forms;
- using System.Drawing;
- namespace DrawTools
- {
- /// <summary>
- /// Ellipse graphic object
- /// </summary>
- class DrawEllipse : DrawTools.DrawRectangle
- {
- public DrawEllipse() : this(0, 0, 1, 1)
- {
- }
- public DrawEllipse(int x, int y, int width, int height) : base()
- {
- Rectangle = new Rectangle(x, y, width, height);
- Initialize();
- }
- /// <summary>
- /// Clone this instance
- /// </summary>
- public override DrawObject Clone()
- {
- DrawEllipse drawEllipse = new DrawEllipse();
- drawEllipse.Rectangle = this.Rectangle;
- FillDrawObjectFields(drawEllipse);
- return drawEllipse;
- }
- public override void Draw(Graphics g)
- {
- Pen pen = new Pen(Color, PenWidth);
- g.DrawEllipse(pen, DrawRectangle.GetNormalizedRectangle(Rectangle));
- pen.Dispose();
- }
- }
- }