C# 如何求多边形的坐标点?

C# 如何求多边形的坐标点?,c#,winforms,C#,Winforms,在我的代码中,我试图绘制多边形,我需要找到多边形的坐标点,并在文本框中显示该坐标点。有人能帮我弄清楚吗 List<Point> points = new List<Point>(); private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { //points.Clear(); // points.Push(e.Location); if (e.Button == M

在我的代码中,我试图绘制多边形,我需要找到多边形的坐标点,并在文本框中显示该坐标点。有人能帮我弄清楚吗

List<Point> points = new List<Point>();
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
    //points.Clear();
    // points.Push(e.Location);

    if (e.Button == MouseButtons.Left)
    {
        points.Add(e.Location);

        pictureBox1.Invalidate();
    }

    private void pictureBox1_Paint(object sender, PaintEventArgs e)
    {
        if (points.Count > 1)
            e.Graphics.DrawPolygon(Pens.DarkBlue, points.ToArray());

        foreach (Point p in points)
        {
            e.Graphics.FillEllipse(Brushes.Red,
                                   new Rectangle(p.X - 2, p.Y - 2, 4, 4));
        }
    }
列表点=新列表();
私有void pictureBox1\u MouseDown(对象发送方,MouseEventArgs e)
{
//点。清除();
//点。推(如位置);
if(e.Button==MouseButtons.Left)
{
添加点(如位置);
pictureBox1.Invalidate();
}
私有void pictureBox1_Paint(对象发送方,PaintEventArgs e)
{
如果(点数>1)
e、 Graphics.DrawPolygon(Pens.DarkBlue,points.ToArray());
foreach(点中的点p)
{
e、 图形。填充椭圆(画笔。红色,
新矩形(p.X-2,p.Y-2,4,4));
}
}
列表点=新列表();
私有void pictureBox1\u MouseDown(对象发送方,MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
{
添加点(如位置);
pictureBox1.Invalidate();
dataGridView1.DataSource=null;
dataGridView1.DataSource=点;
UpdateTextbox();
}
}
私有void pictureBox1_Paint(对象发送方,PaintEventArgs e)
{
如果(点数>1)
e、 Graphics.DrawPolygon(Pens.DarkBlue,points.ToArray());
foreach(点中的点p)
{
e、 图形。填充椭圆(画笔。红色,
新矩形(p.X-2,p.Y-2,4,4));
}
}
void UpdateTextbox()
{
textBox1.Text=“”;
foreach(点中的点p)
{
textBox1.Text+=(p)+“\n”.ToString();
}
}
    List<Point> points = new List<Point>();
    private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
    {
       if (e.Button == MouseButtons.Left)
   {
      points.Add(e.Location);

      pictureBox1.Invalidate();
       dataGridView1.DataSource = null;
        dataGridView1.DataSource = points;
          UpdateTextbox();
    }
    }

       private void pictureBox1_Paint(object sender, PaintEventArgs e)
   {
       if (points.Count > 1)
        e.Graphics.DrawPolygon(Pens.DarkBlue, points.ToArray());

       foreach (Point p in points)
      {
        e.Graphics.FillEllipse(Brushes.Red,
        new Rectangle(p.X - 2, p.Y - 2, 4, 4));
      }
      }


        void UpdateTextbox()
           {
        textBox1.Text = "";
        foreach (Point p in points)
        {
            textBox1.Text += (p) + "\n".ToString();
        }
    }