2
Answers

C# winform picturebox with a cross

Ask a question
TAN WhoAMI

TAN WhoAMI

11y
1.4k
1
Can anyone show me how to have a C# Winform Picturebox with a cross such that it divides into Left and Right area equally, as well as Top and Bottom area equally?

I have tried this, but does not work...

   private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            Point ptCurrent = new Point(0,0);

            foreach (Point p in _points)
            {
                Point pt1 = new Point(p.X, p.Y - 10);
                Point pt2 = new Point(p.X, p.Y + 10);
                Point pt3 = new Point(p.X - 10, p.Y);
                Point pt4 = new Point(p.X + 10, p.Y);
                g.DrawLine(Pens.Black, pt1, pt2);
                g.DrawLine(Pens.Black, pt3, pt4);

            }
        }

as suggested from http://forums.codeguru.com/showthread.php?481124-how-to-mark-a-cross-on-the-picture-in-the-picture-box-using-c

Answers (2)