1

A major issue for me creating applications using Visual Studio is the documentation. The description of a class or method is vapid to the degree that the tool tip shown within Visual Studio is as informative as the documentation within the MSDN. And the examples within the MSDN vary from non-existent to cluttered and overblown.

What I am requesting is for someone to provide a definitive explanation (with an extremely clean and well documented example) of the relationship / firing order of all things related to managing the display and movement of graphic elements on a form. The goal being to move animate an image on the form.

The questions that should be answered include: (but are not limited to)

  1. On a single buffered form when does the DrawImage() method draw?
  2. On a double buffered form when does the DrawImage() method draw?
  3. On a double buffered form what triggers the undisplayed buffer to be displayed?
  4. Are images drawn to one buffer automatically also drawn to the second buffer?

  5. Do all images on the screen need to be redrawn for every Paint Event?

  6. How is the Form.BackgroundImage redrawn?

  7. What is the sequence of events that Form.Invalidate() triggers?

  8. What is the sequence of events that Form.Invalidate(Rectangle) triggers?
  9. What is the sequence of events that Form.Update() triggers?
  10. What is the sequence of events that Form.Refresh() triggers?

  11. What is the relationship of DrawImage() and Form.Invalidate()?

  12. What is the relationship of DrawImage() and Form.Update()?
  13. What is the relationship of DrawImage() and Form.Refresh()?

  14. Can DrawImage() trigger the form Paint Event?

  15. Can a from Paint Event safely invoke DrawImage()?

  16. What are the pitfalls associated with multiple threads handling Paint Event?

  17. What are the pitfalls associated with multiple threads invoking Form.Invalidate()?
  18. What are the pitfalls associated with multiple threads invoking Form.Update()?
  19. What are the pitfalls associated with multiple threads invoking Form.Refresh()?
  20. What are the pitfalls associated with multiple threads invoking DrawImage()?

  21. Can the system trigger the Form Paint Event and what would the impact be to the animation?

  22. Basically, how does this aspect of .Net operate and what are the "best practices"?

Please resist referencing other classes, technologies, or approaches. I am hoping that a single definitive answer can be constructed herein, so that anyone who comes after will not need to search any further to understand and become immediately productive.

Thanks!

Neoheurist
  • 3,183
  • 6
  • 37
  • 55

1 Answers1

0

When you need this kind of detail you must consider using a decompiler like Telerik's one to look at the source code of the related class (in this case the Graphics class).

Regarding 16 to 20: multiple threads cannot access a Form, only the thread that created the Form can execute methods on it, you have to use InvokeRequired and Invoke to move the requests from a different thread to the thread that created the Form. See here

Community
  • 1
  • 1
Ignacio Soler Garcia
  • 21,122
  • 31
  • 128
  • 207