It is necessary that when the user panel1 cursor to button1 panel1 automatically displayed and when the cursor leaves with button1 and panel1 , then panel1 should disappear.

    1 answer 1

    In the form designer, set the visibility to panel1 :

      public Form1() { InitializeComponent(); panel1.Visible = false; } 

    The controls have a MouseLeave event (when the mouse pointer moves outside the bounds of the element). You have this event for panel1 :

      private void panel1_MouseLeave(object sender, EventArgs e) { panel1.Visible = false; } 

    And there is also a “reverse” MouseEnter event (when the cursor enters the visible borders of the element). In your case, for button1 :

      private void button1_MouseEnter(object sender, EventArgs e) { panel1.Visible = true; }