home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Original Code / Toolbars and Status Bars / MenuHelpSubclass / MenuItemHelp.cs < prev   
Encoding:
Text File  |  2001-01-15  |  1.1 KB  |  39 lines

  1. //-------------------------------------------
  2. // MenuItemHelp.cs ⌐ 2001 by Charles Petzold
  3. //-------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class MenuItemHelp: MenuItem
  9. {
  10.                                                   // Private fields
  11.      StatusBarPanel sbpHelpPanel;
  12.      string         strHelpText;
  13.                                                   // Constructors
  14.      public MenuItemHelp()
  15.      {
  16.      }
  17.      public MenuItemHelp(string strText): base(strText)
  18.      {
  19.      }
  20.                                                   // Properties
  21.      public StatusBarPanel HelpPanel
  22.      {
  23.           get { return sbpHelpPanel; }
  24.           set { sbpHelpPanel = value; }
  25.      }
  26.      public string HelpText
  27.      {
  28.           get { return strHelpText; }
  29.           set { strHelpText = value; }
  30.      }
  31.                                                   // Method override
  32.      protected override void OnSelect(EventArgs ea)
  33.      {
  34.           base.OnSelect(ea);
  35.  
  36.           if (HelpPanel != null)
  37.                HelpPanel.Text = HelpText;
  38.      }
  39. }