I am trying to figure out how to stop a form from paintingon screen. What I mean by this is when I launch the form it doesn't end up painting the form so that the interface is not displayed.
I know how to do this with controls but I cannot figure out how to do with a Form. I am thinking sending a message to stop it from painting would be the best option although I am unsure of which message would create the initial paint job.
Here is how to suspend a control from being painted.
using System.Runtime.InteropServices;
class DrawingControl
{
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, Int32 wMsg,
bool wParam, Int32 lParam);
private const int WM_SETREDRAW = 11;
public static void SuspendDrawing(Control parent)
{
SendMessage(parent.Handle, WM_SETREDRAW, false, 0);
}
public static void ResumeDrawing(Control parent)
{
SendMessage(parent.Handle, WM_SETREDRAW, true, 0);
parent.Refresh();
}
}