How to effectively draw on desktop in C#?

Posted by Lazlo on Stack Overflow See other posts from Stack Overflow or by Lazlo
Published on 2010-05-25T14:50:29Z Indexed on 2010/05/25 15:01 UTC
Read the original article Hit count: 295

Filed under:
|
|
|
|

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.

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.

Normally, I would need to put my drawing code in a "OnPaint" event, but such thing does not exist for the desktop.

How would I do it?

Example code: http://stackoverflow.com/questions/1536141/how-to-draw-directly-on-the-windows-desktop-c

© Stack Overflow or respective owner

Related posts about c#

Related posts about drawing