How do I draw a circle and line in the picturebox?

后端 未结 4 1178
栀梦
栀梦 2020-12-06 16:43

How do I draw a circle and line in the picturebox?

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-06 17:16

    or:

        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.DrawLine(
                new Pen(Color.Red,2f), 
                new Point(0,0), 
                new Point(pictureBox1.Size.Width, pictureBox1.Size.Height ));
    
            e.Graphics.DrawEllipse(
                new Pen(Color.Red, 2f),
                0,0, pictureBox1.Size.Width, pictureBox1.Size.Height  );
        }
    

    Handle the paint event of the picture box and do your custom drawing there.

提交回复
热议问题