111,126
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
Panel panel1 = new Panel();
panel1.Parent = this;
panel1.Dock = DockStyle.Fill;
//匿名方法
panel1.Paint += delegate(object sender, PaintEventArgs e)
{
// 画一个圆心为(x,y)半径为z的圆
float x = 80;
float y = 90;
float z = 50;
e.Graphics.DrawEllipse(Pens.Red, x - z, y - z, z * 2, z * 2);
};
}
}
}using System;
using System.Drawing;
using System.Windows.Forms;
class Form1 : Form
{
Form1()
{
Panel panel1 = new Panel();
panel1.Parent = this;
panel1.Dock = DockStyle.Fill;
panel1.Paint += delegate(object o, PaintEventArgs e)
{
// 画一个圆心为(x,y)半径为z的实心圆
float x = 80;
float y = 90;
float z = 20;
e.Graphics.FillEllipse(new SolidBrush(Color.Blue), x - z, y - z, z * 2, z * 2);
};
}
static void Main()
{
Application.Run(new Form1());
}
}int x = 100;
int y = 100;
int z = 40;
Graphics g = CreateGraphics();
Pen pen = new Pen(Color.Red, 2);
g.DrawEllipse(pen, x - z, y - z, 2 * z , 2* z);
g.Flush();
g.Dispose();using System;
using System.Drawing;
using System.Windows.Forms;
class Form1 : Form
{
Form1()
{
Panel panel1 = new Panel();
panel1.Parent = this;
panel1.Dock = DockStyle.Fill;
panel1.Paint += delegate(object o, PaintEventArgs e)
{
// 画一个圆心为(x,y)半径为z的圆
float x = 80;
float y = 90;
float z = 50;
e.Graphics.DrawEllipse(Pens.Red, x - z, y - z, z * 2, z * 2);
};
}
static void Main()
{
Application.Run(new Form1());
}
}