The thing is: if you are going to do anything beyond showing a static image in a
PictureBox
, you should never use the
PictureBox
control. Abusing this control is the one of the most usual mistakes. It's totally pointless, because you need to override
OnPaint
or handle the event
Paint
, anyway, so you can just draw a bitmap and whatever you want on top of it. On what control?
Certainly, not PictureBox
. This control is totally redundant, only needed to easy doing the simplest thing. If you do anything else, it only presents a hassle, giving nothing in return. Instead, you should use something "empty":
Panel
or, in most cases, a custom control based on
Control
. I will explain you how:
Please see my past answers:
How do I clear a panel from old drawing[
^],
draw a rectangle in C#[
^],
Append a picture within picturebox[
^].
For more background on rendering, please see also these answers:
Drawing Lines between mdi child forms[
^],
capture the drawing on a panel[
^],
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[
^],
How to speed up my vb.net application?[
^].
Good luck,
—SA