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 = (MenuItem) obj;
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;
}
}