I use the following to show / hide the window by its handle:
[DllImport("user32.dll")] private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
private const int SW_HIDE = 0;
private const int SW_SHOW = 5;
ShowWindowAsync(_hWnd, SW_SHOW);
ShowWindowAsync(_hWnd, SW_HIDE);
When I hide Sticky Notes and then show them again, it causes visual “holes” in the sticks, and I have to close Sticky Notes and open it again.
Here is a screenshot of the problem:

I believe the problem is with Sticky Notes.
I don’t know why this is happening, but I would like to solve it somehow.
I was thinking about checking if the Sticky Notes window is, and if it is then Open / Close it will act the same instead of Show / Hide, but I don't like it - it feels hacked.
source
share