Apparently, by assigning alternative values to its property
Image
,
http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.image.aspx[
^].
This is simple enough to do it in this way.
In case you will need something even a bit more complex than that, consider not using
PictureBox
at all. Instead, see my past answers:
How do I clear a panel from old drawing[
^],
draw a rectangle in C#[
^].
See also:
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[
^],
Drawing Lines between mdi child forms[
^],
capture the drawing on a panel[
^].
[EDIT]
If you need periodic flipping of the image, I should warn you: it will irritate most of the users very much, so it's the best to avoid it.
Don't use
System.Windows.Forms.Timer
: it is too bad, won't behave periodically. Other two timers types are good enough enough, but a separate thread with periodic flip and
Sleep
is much easier and more reliable. In both timer and thread cases, your handler will be called from some non-UI thread, and you cannot call anything related to UI from non-UI thread. Instead, you need to use the method
Invoke
or
BeginInvoke
of
System.Windows.Threading.Dispatcher
(for both Forms or WPF) or
System.Windows.Forms.Control
(Forms only).
You will find detailed explanation of how it works and code samples in my past answers:
Control.Invoke() vs. Control.BeginInvoke()[
^],
Problem with Treeview Scanner And MD5[
^].
See also more references on threading:
How to get a keydown event to operate on a different thread in vb.net[
^],
Control events not firing after enable disable + multithreading[
^].
—SA