我在尝试将圆圈变成同心图案时遇到了麻烦。例如,下一个圆圈更大,然后更大等等。有点像地核、内核、外核和地壳。
以下是我的所有代码:
namespace ClickAppearBalls
{
public partial class Form1 : Form
{
private Random randClick;
private Graphics paper;
private Pen pen;
public Form1()
{
InitializeComponent();
randClick = new Random();
paper = picCanvas.CreateGraphics();
}
private void picCanvas_Click(object sender, EventArgs e)
{
int x, y, size1, size2;
x = picCanvas.Height / 2;
y = picCanvas.Width / 2;
Color color = Color.FromArgb(randClick.Next(0, 256), randClick.Next(0, 256), randClick.Next(0, 256));
Pen pen = new Pen(color);
pen.Width = 3;
size1 = 30;
size2 = 30;
paper.DrawEllipse(pen, x, y, size1, size2);
}
}
}