public static void Main() { using (Step6 frm = new Step6()) { frm.Show(); frm.InitializeGraphics(); Application.Run(frm); //triggers OnPaint event, which is main loop } Application.Exit(); }