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
ChevronMenu.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.Windows.Forms;
- using System.Drawing;
- using UtilityLibrary.Collections;
- using UtilityLibrary.Menus;
- using UtilityLibrary.WinControls;
- namespace UtilityLibrary.CommandBars
- {
- /// <summary>
- /// Summary description for ToolBarItemMenu.
- /// </summary>
- public class ChevronMenu : PopupMenu
- {
- #region Class Variables
- ToolBarItemCollection items = new ToolBarItemCollection();
- #endregion
- #region Properties
- public ToolBarItemCollection Items
- {
- set { items = value; Attach(); }
- get { return items; }
- }
- #endregion
- #region Implementation
- void AddSubMenu(MenuCommand parentMenuCommand, MenuItemExCollection items)
- {
- for ( int i = 0; i < items.Count; i++ )
- {
- // I know these menu items are actually MenuItemExs
- MenuItemEx item = (MenuItemEx)items[i];
- MenuCommand currentMenuCommand = new MenuCommand(item.Text, item.Icon,
- (Shortcut)item.Shortcut, item.ClickHandler, item);
- parentMenuCommand.MenuCommands.Add(currentMenuCommand);
- if ( item.MenuItems.Count > 0 )
- AddSubMenu(currentMenuCommand, item.MenuItems);
- }
- }
- void AddSubMenu(MenuCommand parentMenuCommand, Menu.MenuItemCollection items)
- {
- for ( int i = 0; i < items.Count; i++ )
- {
- // I know these menu items are actually MenuItemExs
- MenuItemEx item = (MenuItemEx)items[i];
- MenuCommand currentMenuCommand = new MenuCommand(item.Text, (Bitmap)item.Icon,
- (Shortcut)item.Shortcut, item.ClickHandler, item);
- parentMenuCommand.MenuCommands.Add(currentMenuCommand);
- if ( item.MenuItems.Count > 0 )
- AddSubMenu(currentMenuCommand, item.MenuItems);
- }
- }
- void Attach()
- {
- // Cleanup previous menus
- MenuCommands.Clear();
- foreach (ToolBarItem item in items)
- {
- string text = item.Text;
- if ( text == string.Empty || text == null )
- text = item.ToolTip;
- if ( item.Style == ToolBarItemStyle.Separator )
- text = "-";
- // If this is a combobox
- if ( item.ComboBox != null )
- {
- MenuCommands.Add(new MenuCommand(item.ComboBox));
- item.ComboBox.Visible = true;
- // I know where this combobox comes from
- ComboBoxBase cbb = (ComboBoxBase)item.ComboBox;
- cbb.ToolBarUse = false;
- continue;
- }
- MenuCommand currentMenuCommand = new MenuCommand(text, (Bitmap)item.Image,
- (Shortcut)item.Shortcut, item.ClickHandler, item);
- MenuCommands.Add(currentMenuCommand);
- // If we have a menubar
- if ( item.MenuItems != null)
- AddSubMenu(currentMenuCommand, item.MenuItems);
- }
- }
- #endregion
- }
- }