Line in PictureBox
-
Hi, I have used the picture box to draw an image on the screen. Its loading perfectly, now I want to draw over some parts of the image, with rectangles and lines. I tried to draw on the picture box by doing the following but nothing shows up? How can I go about doing this. Graphics g = pictureBox1.CreateGraphics(); SolidBrush solidBrush = new SolidBrush(Color.Blue); g.FillRectangle(solidBrush, 0, 0, 100, 100); Any help would be greatly appreciated
-
Hi, I have used the picture box to draw an image on the screen. Its loading perfectly, now I want to draw over some parts of the image, with rectangles and lines. I tried to draw on the picture box by doing the following but nothing shows up? How can I go about doing this. Graphics g = pictureBox1.CreateGraphics(); SolidBrush solidBrush = new SolidBrush(Color.Blue); g.FillRectangle(solidBrush, 0, 0, 100, 100); Any help would be greatly appreciated
-
Hi, I have used the picture box to draw an image on the screen. Its loading perfectly, now I want to draw over some parts of the image, with rectangles and lines. I tried to draw on the picture box by doing the following but nothing shows up? How can I go about doing this. Graphics g = pictureBox1.CreateGraphics(); SolidBrush solidBrush = new SolidBrush(Color.Blue); g.FillRectangle(solidBrush, 0, 0, 100, 100); Any help would be greatly appreciated
"Graphics g = pictureBox1.CreateGraphics();" That is a bad idea unless you're drawing something you want to erase, like a rubber band. Painting should take place in the paint event. And, at this point, you should just draw your bitmap in the paint event, then draw on it.
Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.