Use StatusBarPanel : StatusBar « GUI Windows Form « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » GUI Windows Form » StatusBarScreenshots 
Use StatusBarPanel
 



using System;
using System.Drawing;
using System.Windows.Forms;
   
class MenuHelpFirstTry: Form
{
     StatusBarPanel sbpMenuHelp;
     string         strSavePanelText;
   
     public static void Main()
     {
          Application.Run(new MenuHelpFirstTry());
     }
     public MenuHelpFirstTry()
     {
   
          StatusBar sb = new StatusBar();
          sb.Parent = this;
          sb.ShowPanels = true;
   
          sbpMenuHelp = new StatusBarPanel();
          sbpMenuHelp.Text = "Ready";
          sbpMenuHelp.AutoSize = StatusBarPanelAutoSize.Spring;
   
          sb.Panels.Add(sbpMenuHelp);
   
          Menu = new MainMenu();
          EventHandler ehSelect = new EventHandler(MenuOnSelect);
          
          MenuItem mi = new MenuItem("File");
          mi.Select += ehSelect;
          Menu.MenuItems.Add(mi);
   
          mi = new MenuItem("Open");
          mi.Select += ehSelect;
          Menu.MenuItems[0].MenuItems.Add(mi);
   
          mi = new MenuItem("Close");
          mi.Select += ehSelect;
          Menu.MenuItems[0].MenuItems.Add(mi);
   
          mi = new MenuItem("Save");
          mi.Select += ehSelect;
          Menu.MenuItems[0].MenuItems.Add(mi);
   
          mi = new MenuItem("Edit");
          mi.Select += ehSelect;
          Menu.MenuItems.Add(mi);
   
          mi = new MenuItem("Cut");
          mi.Select += ehSelect;
          Menu.MenuItems[1].MenuItems.Add(mi);
          
          mi = new MenuItem("Copy");
          mi.Select += ehSelect;
          Menu.MenuItems[1].MenuItems.Add(mi);
   
          mi = new MenuItem("Paste");
          mi.Select += ehSelect;
          Menu.MenuItems[1].MenuItems.Add(mi);
     }
     protected override void OnMenuStart(EventArgs ea)
     {
          strSavePanelText = sbpMenuHelp.Text;
     }
     protected override void OnMenuComplete(EventArgs ea)
     {
          sbpMenuHelp.Text = strSavePanelText;
     }
     void MenuOnSelect(object obj, EventArgs ea)
     {
          MenuItem mi = (MenuItemobj;
          string   str;
   
          switch (mi.Text)
          {
              case "File":   str = "file";    break;
              case "Open":   str = "Open";         break;
              case "Close":  str = "Close";        break;
              case "Save":   str = "Save";         break;
              case "Edit":   str = "edit";  break;
              case "Cut":    str = "cut";         break;
              case "Copy":   str = "Copy";                          break;
              case "Paste":  str = "Paste";        break;
              default:       str = "";                                   break;
          }
   
          sbpMenuHelp.Text = str;
     }
}

 
Related examples in the same category
1.Display message in StatusBar
2.Use Label as status barUse Label as status bar
3.Add icon to statusbarAdd icon to statusbar
4.Display current time on statusbarDisplay current time on statusbar
5.Display menu item alert message on the statusbarDisplay menu item alert message on the statusbar
6.StatusBar with two panelsStatusBar with two panels
7.Status bar: display time and prompt message for menu itemStatus bar: display time and prompt message for menu item
8.StatusBar ExampleStatusBar Example
9.Status Strip Example
10.Add StatusPanels to StatusBar
11.Set Text to Statusbar
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.