title: Draw on Desktop from WPF application
body: <p>I would draw a rectangle on desktop from my WPF application. I've searched but i didn't find a good solution and a good example.
  I would draw a rectangle at the edges of the screen and changes its color when something of specific happen.</p>
  
  <p>How i can i do this in a correct way? </p>
  
  <p>I found this code :</p>
  
  <pre><code>using System;
  using System.Drawing;
  using System.Drawing.Drawing2D;
  using System.Runtime.InteropServices;
  
  class Program {
  
  [DllImport("User32.dll")]
  static extern IntPtr GetDC(IntPtr hwnd);
  
  [DllImport("User32.dll")]
  static extern void ReleaseDC(IntPtr dc);
  
  static void Main(string[] args) {
      IntPtr desktop = GetDC(IntPtr.Zero);
      using (Graphics g = Graphics.FromHdc(desktop)) {
          g.FillRectangle(Brushes.Red, 0, 0, 100, 100);
      }
      ReleaseDC(desktop);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>But i don't have a console application and i don't understand how i can re-paint / refresh my rectangle or change its color from this code.</p>
  
  <p>thank all.</p>