How to determine which Panel in the Windows Forms StatusBar Control is Clicked ?

Platform: WPF| Category: StatusBar
[C#]

private void statusBar1_PanelClick(object sender, 
System.Windows.Forms.StatusBarPanelClickEventArgs e)
{
   switch (statusBar1.Panels.IndexOf(e.StatusBarPanel))
   {
      case 0 :
         MessageBox.Show('You have clicked Panel One.');
         break;
      case 1 :
         MessageBox.Show('You have clicked Panel Two.');
         break;
   }
}
//Place the following code in the form’s constructor to register the event handler.

   this.statusBar1.PanelClick += new 
   System.Windows.Forms.StatusBarPanelClickEventHandler 
   (this.statusBar1_PanelClick);

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.