Should I use a PictureBox or a Panel to draw on my Form?
Asked Answered
S

1

9

Is there a recommended one to use in order to add lines and circles, so I can build a graph? I will possibly work with background images under the graph itself.

Soft answered 31/10, 2012 at 21:31 Comment(3)
Also, are you using WPF, or Silverlight?Levy
@JohnSaunders I assume it's just Windows Forms based on the tags.Malaise
I'd say neither. If you're doing your own drawing, just inherit from Control itself unless you have a need specifically for one of the other two.Brightman
M
9

Use a PictureBox - it'll be easiest to maintain the code later on. A Panel is not really useful in this case and drawing directly on the Form - while it'd work - would make it harder to make changes later on.

Just handle the Paint event of the PictureBox and do all your drawing in there.

Malaise answered 31/10, 2012 at 21:35 Comment(2)
also noticed that animated graphic shapes are flickering on a panel and on picturebox it does not happen.Peen
@jonathana You can make it work the right way even with a Panel but it's extra work that you don't have to do with a PictureBox.Malaise

© 2022 - 2024 — McMap. All rights reserved.