using System; using System.Drawing; using System.Diagnostics; using System.Windows.Forms; using System.Threading; class TestForm : Form { static void Main () { Application.Run (new TestForm ()); } public TestForm () { this.WindowState = FormWindowState.Maximized; Panel p = new MyPanel (); p.Dock = DockStyle.Fill; p.BackColor = Color.Aqua; this.Controls.Add (p); } protected override void WndProc (ref Message m) { if (m.Msg == 0x0018) Console.WriteLine ("Control {0} received message {1}", this.IsHandleCreated ? this.Handle.ToString() : this.Text, m.ToString ()); base.WndProc (ref m); } private class MyPanel : Panel { protected override void OnVisibleChanged (EventArgs e) { Console.WriteLine ("Panel OnVisible Called: {0}", this.Visible); base.OnVisibleChanged (e); } } }