C#: Avoid desktop screen refresh when painting on the desktop directly -


I am writing an app such that users can attract annotations (circle, line, rectangle, etc.) directly to the desktop is. / P>

I am using GetDC from User32.dll and successfully converting a rectangle on the desktop:

  Namespace comments {public partial class baseform: form { DllImport ("User32.dll")] Fixed Extension Interrupt Gate-DC (Interrupt HWD); [DllImport ("User32.dll")] Fixed extern zero releaseDC (IntPtr DC); Public Baseform () {Initialization (); BackColor = Color.Lime; Transparency = Color time; } Private Zero Button 1_Click (Object Sender, EventArgs e) {IntPtr Desktop = GetDC (IntPtr.Zero); Use (graphics g = graphics.form hdc (desktop) {g.FillRectangle (brush .Red, 0, 0, 100, 100); }}}}  

When I click on the button, a rectangle will be drawn to the desktop but when I move the mouse over the rectangular, the desktop will be rebuilt and My rectangle will disappear.

Is there any way that I will always be there in the rectangle (unless I do not clean the drawing)

Thank you.

Is there any way I can make the rectangle forever? Until I clear the drawing)?

If you insist on drawing directly on the desktop, the desktop window is owned by the system when the system determines that it needs to be re-painted, for example because one on the desktop And the window is over, it will paint the desktop again because there is no information about what you want the system to look like, it can not paint your annotation again.

If you want to show continuous status on the desktop, you must create a window in which to draw that state. Create a transparent click-through window, and what you'll do in that paint.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -