title: How to effectively draw on desktop in C#?
body: <p>I want to draw directly on the desktop in C#. From searching a bit, I ended up using a Graphics object from the Desktop HDC (null). Then, I painted normally using this Graphics object.</p>
  
  <p>The problem is that my shapes get lost when any part of the screen is redrawn. I tried a While loop, but it actually ends up drawing as fast as the application can, which is not the update rate of the desktop.</p>
  
  <p>Normally, I would need to put my drawing code in a "OnPaint" event, but such thing does not exist for the desktop.</p>
  
  <p>How would I do it?</p>
  
  <p>Example code: <a href="https://stackoverflow.com/questions/1536141/how-to-draw-directly-on-the-windows-desktop-c" title="StackOverflow - Draw directly on the Windows Desktop C#">https://stackoverflow.com/questions/1536141/how-to-draw-directly-on-the-windows-desktop-c</a></p>