<p>In c#, I have a handle to a window ( an IntPtr ), I want to change the background color of that window.  How can I do this?</p>

<p>I can get the GDI graphics object for that handle like so:</p>

<p>Graphics graphics = Graphics.FromHwnd(theHandle);</p>

<p>So I should somehow be able to change the background color from this?</p>

<p>I also want to ensure the background color remains even after the window moves,resizes,repaints etc.</p>

Create a control class with the Control.FromHandle method and then set the property.
Something like...
```
Control someControl = Control.FromHandle(myHandle);
    someControl.BackColor = SystemColors.Black;
```