int DrawEllipse()
{
Graphics dc=this.GreateGrap0hics();
Pen pen=new Pen(Color.Blue,5);//画笔
dc.DrawEllipse(pen,0,50,80,60)//画圆
return 1;
}
{
Graphics dc=this.GreateGrap0hics();
Pen pen=new Pen(Color.Blue,5);//画笔
dc.DrawEllipse(pen,0,50,80,60)//画圆
return 1;
}
其实也可以理解成一个Region.protected void DoPage(Graphics grfx, Color clr, int cx, int cy)
{
RoundedRectangle(grfx, Pens.Red,
new Rectangle(0, 0, cx - 1, cy - 1),
new Size(cx / 5, cy / 5));
}
void RoundedRectangle(Graphics grfx, Pen pen, Rectangle rect, Size size)
{
grfx.DrawLine(pen, rect.Left + size.Width / 2, rect.Top,
rect.Right - size.Width / 2, rect.Top);
grfx.DrawArc(pen, rect.Right - size.Width, rect.Top,
size.Width, size.Height, 270, 90);
grfx.DrawLine(pen, rect.Right, rect.Top + size.Height / 2,
rect.Right, rect.Bottom - size.Height / 2);
grfx.DrawArc(pen, rect.Right - size.Width,
rect.Bottom - size.Height,
size.Width, size.Height, 0, 90);
grfx.DrawLine(pen, rect.Right - size.Width / 2, rect.Bottom,
rect.Left + size.Width / 2, rect.Bottom);
grfx.DrawArc(pen, rect.Left, rect.Bottom - size.Height,
size.Width, size.Height, 90, 90);
grfx.DrawLine(pen, rect.Left, rect.Bottom - size.Height / 2,
rect.Left, rect.Top + size.Height / 2);
grfx.DrawArc(pen, rect.Left, rect.Top,
size.Width, size.Height, 180, 90);
}
是Line 和Elilipse的结合,定义好点而已!MSDN上都有Graphics g =this.button1.CreateGraphics(); Pen myPen = new Pen(Color.Red);
myPen.Width = 5;
g.DrawLine(myPen, 1, 1, 45, 65);
g.DrawBezier(myPen, 15, 15, 30, 30, 45, 30, 87, 20);
g.DrawEllipse(myPen, new Rectangle(33, 45, 40, 50)); g.DrawPolygon(myPen, new PointF[] {new PointF(1, 1), new PointF (20, 10), new PointF(5, 4), new PointF(100, 2),
new PointF(200, 50), new PointF(39, 45)});