Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
MenuCommandCollection.cs
Package: ProgressBar_src.rar [view]
Upload User: nnpulika
Upload Date: 2013-02-15
Package Size: 597k
Code Size: 3k
Category:
StatusBar
Development Platform:
C#
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- using UtilityLibrary.Menus;
- namespace UtilityLibrary.Collections
- {
- public class MenuCommandCollection : CollectionWithEvents
- {
- #region Class Variables
- protected string extraText;
- protected Font extraFont;
- protected Color extraTextColor;
- protected Brush extraTextBrush;
- protected Color extraBackColor;
- protected Brush extraBackBrush;
- #endregion
- #region Constructors
- public MenuCommandCollection()
- {
- // Define defaults for internal state
- extraText = "";
- extraFont = SystemInformation.MenuFont;
- extraTextColor = SystemColors.ActiveCaptionText;
- extraTextBrush = null;
- extraBackColor = SystemColors.ActiveCaption;
- extraBackBrush = null;
- }
- #endregion
- #region Properties
- public bool VisibleItems()
- {
- foreach(MenuCommand mc in base.List)
- {
- // Is the item visible?
- if (mc.Visible)
- {
- // And its not a separator...
- if (mc.Text != "-")
- {
- // Then should return 'true' except when we are a sub menu item ourself
- // in which case there might not be any visible children which means that
- // this item would not be visible either.
- if ((mc.MenuCommands.Count > 0) && (!mc.MenuCommands.VisibleItems()))
- continue;
- return true;
- }
- }
- }
- return false;
- }
- public string ExtraText
- {
- get { return extraText; }
- set { extraText = value; }
- }
- public Font ExtraFont
- {
- get { return extraFont; }
- set { extraFont = value; }
- }
- public Color ExtraTextColor
- {
- get { return extraTextColor; }
- set { extraTextColor = value; }
- }
- public Brush ExtraTextBrush
- {
- get { return extraTextBrush; }
- set { extraTextBrush = value; }
- }
- public Color ExtraBackColor
- {
- get { return extraBackColor; }
- set { extraBackColor = value; }
- }
- public Brush ExtraBackBrush
- {
- get { return extraBackBrush; }
- set { extraBackBrush = value; }
- }
- public MenuCommand this[int index]
- {
- // Use base class to process actual collection operation
- get { return (base.List[index] as MenuCommand); }
- }
- public MenuCommand this[string text]
- {
- get
- {
- // Search for a MenuCommand with a matching title
- foreach(MenuCommand mc in base.List)
- if (mc.Text == text)
- return mc;
- return null;
- }
- }
- #endregion
- #region Methods
- public MenuCommand Add(MenuCommand _value)
- {
- // Use base class to process actual collection operation
- base.List.Add(_value as object);
- return _value;
- }
- public void AddRange(MenuCommand[] values)
- {
- // Use existing method to add each array entry
- foreach(MenuCommand page in values)
- Add(page);
- }
- public void Remove(MenuCommand value)
- {
- // Use base class to process actual collection operation
- base.List.Remove(value as object);
- }
- public void Insert(int index, MenuCommand value)
- {
- // Use base class to process actual collection operation
- base.List.Insert(index, value as object);
- }
- public bool Contains(MenuCommand value)
- {
- // Use base class to process actual collection operation
- return base.List.Contains(value as object);
- }
- public int IndexOf(MenuCommand value)
- {
- // Find the 0 based index of the requested entry
- return base.List.IndexOf(value);
- }
- #endregion
- }
- }