c#中,我输入一个坐标点值在textbox1,2中,如何在一个picturebox中画出这个点呢?谢谢

2024-11-24 10:29:54
推荐回答(1个)
回答1:

void PictureBox1.Paint(object sender, PaintEventArgs e)
{
int x = int.Parse(textbox1.Text);
int y = int.Parse(textbox2.Text);
Graphics g = e.Graphics;
g.FillEllipse(Brushes.Red, new Rectangle(x - 2, y - 2, 4, 4));
}