本文整理汇总了C#中System.Windows.Forms.MenuStrip类的典型用法代码示例。如果您正苦于以下问题:C# MenuStrip类的具体用法?C# MenuStrip怎么用?C# MenuStrip使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MenuStrip类属于System.Windows.Forms命名空间,在下文中一共展示了MenuStrip类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: buildMenu
/// <summary>
///
/// </summary>
/// <param name="file"></param>
/// <returns></returns>
public MenuStrip buildMenu(String file)
{
MenuStrip mainMenu = new MenuStrip();
// read file
XmlDocument doc = new XmlDocument();
doc.Load(file);
// read
XmlNodeList menuList = doc.SelectNodes("//MainMenu/Menu");
if (menuList != null)
{
IEnumerator menuListEnum =
menuList.GetEnumerator();
while (menuListEnum.MoveNext())
{
XmlNode menu = (XmlNode)menuListEnum.Current;
// create menu
ToolStripMenuItem formMenuItem = new ToolStripMenuItem();
formMenuItem.Text = menu.Attributes["label"].Value;
XmlNodeList menuItemList = menu.ChildNodes;
IEnumerator menuItemListEnum = menuItemList.GetEnumerator();
while (menuItemListEnum.MoveNext())
{
XmlNode menuItem = (XmlNode)menuItemListEnum.Current;
ToolStripMenuItem childMenuItem = new ToolStripMenuItem();
childMenuItem.Text = menuItem.Attributes["label"].Value;
formMenuItem.DropDownItems.Add(childMenuItem);
}
}
}
return null;
}
开发者ID:DelLitt,项目名称:opmscoral,代码行数:37,代码来源:MenuUtility.cs
示例2: Activate
public void Activate()
{
if (_isActivated) return;
var headerControls = App.CompositionContainer.GetExportedValues<IHeaderControl>().ToList();
// Activate only if there are no other IHeaderControl implementations and
// custom HeaderControl not yet set
if (App.HeaderControl == null &&
headerControls.Count == 1 && headerControls[0].GetType() == GetType())
{
_isActivated = true;
var container = new ToolStripPanel {Dock = DockStyle.Top};
Shell.Controls.Add(container);
var menuStrip = new MenuStrip { Name = DEFAULT_GROUP_NAME, Dock = DockStyle.Top };
Shell.Controls.Add(menuStrip);
Initialize(container, menuStrip);
// Add default buttons
container.SuspendLayout();
menuStrip.SuspendLayout();
new DefaultMenuBars(App).Initialize(this);
container.ResumeLayout();
menuStrip.ResumeLayout();
}
}
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:31,代码来源:HeaderControl.cs
示例3: AddMenuStrip
/// <summary>
/// Adds the one and only MenuStrip
/// Throws ApplicationException if this is called multiple times.
/// </summary>
public void AddMenuStrip(MenuStrip menuStrip)
{
if (m_MenuStrip != null)
throw new ApplicationException("Can only add a MenuStrip once");
TopToolStripPanel.Controls.Add(menuStrip);
}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:11,代码来源:ToolbarAdapter.cs
示例4: GenerateMenu
/// <summary>
/// Création et immersion des éléments de menu
/// </summary>
private void GenerateMenu() {
if ( !Registry.Has( MainKeys.KeyMainMenu ) ) return;
ToolStripMenuItem itemReport = new ToolStripMenuItem( "Etat du gestionnaire des plugins dynamiques", global::Psl.Properties.Resources.IconProperties, itemReport_OnClick );
itemReport.MergeAction = MergeAction.Insert;
itemReport.MergeIndex = 9000;
itemReport.ImageTransparentColor = System.Drawing.Color.Magenta;
ToolStripSeparator itemReportSep = new ToolStripSeparator();
itemReportSep.MergeAction = MergeAction.Insert;
itemReportSep.MergeIndex = 9000;
ToolStripMenuItem itemAbout = new ToolStripMenuItem( "A propos du gestionnaire des plugins dynamiques", global::Psl.Properties.Resources.IconAbout, itemAbout_OnClick );
itemAbout.MergeAction = MergeAction.Insert;
itemAbout.MergeIndex = 9000;
itemAbout.ImageTransparentColor = System.Drawing.Color.Magenta;
ToolStripMenuItem itemHelpAbout = new ToolStripMenuItem( "A propos..." );
itemHelpAbout.MergeAction = MergeAction.MatchOnly;
itemHelpAbout.MergeIndex = 1;
itemHelpAbout.DropDownItems.Add( itemAbout );
ToolStripMenuItem menuHelp = new ToolStripMenuItem( "&?" );
menuHelp.MergeAction = MergeAction.MatchOnly;
menuHelp.MergeIndex = 9999;
menuHelp.DropDownItems.Add( itemHelpAbout );
menuHelp.DropDownItems.Add( itemReportSep );
menuHelp.DropDownItems.Add( itemReport );
MenuStrip mainMenu = new MenuStrip();
mainMenu.Items.Add( menuHelp );
Registry.MergeInMainMenu( mainMenu );
}
开发者ID:NicolasR,项目名称:Composants,代码行数:37,代码来源:PluginManagerInternalMenu.cs
示例5: GetMainMenuStrip
static MenuStrip GetMainMenuStrip() {
var menu=new MenuStrip();
menu.Items.Add(FileStripItem());
return menu;
}
开发者ID:WenzCao,项目名称:automatic-graph-layout,代码行数:7,代码来源:FormStuff.cs
示例6: Workspace
/// <summary>
/// The default constructor sets the base controls.
/// </summary>
protected Workspace()
{
// Graphical measures
Graphics g = CreateGraphics();
SizeF sizeString = g.MeasureString("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890", Font);
Data.HorizontalDLU = (sizeString.Width/62)/4;
Data.VerticalDLU = sizeString.Height/8;
g.Dispose();
TsTradeControl = new ToolStrip();
MainMenuStrip = new MenuStrip();
PnlWorkspace = new Panel();
StatusStrip = new StatusStrip();
// Panel Workspace
PnlWorkspace.Parent = this;
PnlWorkspace.Dock = DockStyle.Fill;
PnlWorkspace.Padding = new Padding(2);
PnlWorkspace.AllowDrop = true;
PnlWorkspace.DragEnter += Workspace_DragEnter;
PnlWorkspace.DragDrop += WorkspaceDragDrop;
// Tool Strip Trade control
TsTradeControl.Parent = this;
TsTradeControl.Dock = DockStyle.Top;
// Main menu
MainMenuStrip.Parent = this;
MainMenuStrip.Dock = DockStyle.Top;
// Status bar
StatusStrip.Parent = this;
StatusStrip.Dock = DockStyle.Bottom;
}
开发者ID:kalaytan,项目名称:Forex-Strategy-Trader,代码行数:37,代码来源:Workspace.cs
示例7: Bind
public static void Bind(MenuStrip ms)
{
foreach (ToolStripMenuItem item in ms.Items)
{
Bind(item, item.Text);
}
}
开发者ID:Myvar,项目名称:Eclang,代码行数:7,代码来源:MenuBinder.cs
示例8: MainMenu
public MainMenu(MainForm mainForm)
{
_mainForm = mainForm;
_menuStrip = new MenuStrip();
Initialize();
}
开发者ID:MDSchechtman,项目名称:Aerotech-Motor-Sizer,代码行数:7,代码来源:MainMenu.cs
示例9: Form1
public Form1()
{
InitializeComponent();
m = new MenuStrip();
//добавляем меню верхнего уровня
ToolStripMenuItem file= (ToolStripMenuItem)m.Items.Add("File");
ToolStripMenuItem edit = (ToolStripMenuItem)m.Items.Add("Edit");
this.MainMenuStrip = m;
this.Controls.Add(m); //добавляем меню на форму
//добавляем выпадающее меню для пункта Edit
edit.DropDownItems.Add("Cut");
//добавляем сепаратор
edit.DropDownItems.Add(new ToolStripSeparator());
edit.DropDownItems.Add("Copy");
//добавляем сепаратор
edit.DropDownItems.Add(new ToolStripSeparator());
edit.DropDownItems.Add("Pastle");
//Добвыляем выпадающее меню для пункта File
ToolStripMenuItem close = (ToolStripMenuItem)file.DropDownItems.Add("Close");
//связываем меню с акселератором Alt+C
close.ShortcutKeys = Keys.Alt | Keys.C;
close.ShowShortcutKeys = true; //отображать акселераторы
//добавляем обработчик для пункта меня Close
close.Click += new EventHandler(close_Click);
}
开发者ID:xs2ranjeet,项目名称:13ns9-1spr,代码行数:27,代码来源:Form1.cs
示例10: deshabilitarMenu
public void deshabilitarMenu(MenuStrip m)
{
amistadesToolStripMenuItem.Enabled = false;
publicacionesToolStripMenuItem.Enabled = false;
modificarUsuarioMenuItem.Enabled = false;
bajaUsuarioMenuItem.Enabled = false;
}
开发者ID:GasparMDQ,项目名称:ApSocial,代码行数:7,代码来源:ApSocial.cs
示例11: MenuCommandUiManager
/// <summary>
/// Setup constructor
/// </summary>
/// <param name="menu">Target menu. Commands are added/removed from here</param>
/// <param name="triggerDataFactory">Factory used to create trigger data</param>
/// <exception cref="ArgumentNullException">Thrown if menu or triggerDataFactory are null</exception>
public MenuCommandUiManager( MenuStrip menu, ICommandTriggerDataFactory triggerDataFactory )
{
Arguments.CheckNotNull( menu, "menu" );
Arguments.CheckNotNull( triggerDataFactory, "triggerDataFactory" );
m_Menu = menu;
m_TriggerDataFactory = triggerDataFactory;
}
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:13,代码来源:MenuCommandUiManager.cs
示例12: FormBrowseMenus
public FormBrowseMenus(MenuStrip menuStrip)
{
_menuStrip = menuStrip;
CreateAdditionalMainMenuItems();
Translate();
}
开发者ID:HuChundong,项目名称:gitextensions,代码行数:7,代码来源:FormBrowseMenus.cs
示例13: VisibleMain
public void VisibleMain(MenuStrip menu)
{
if (this.mSysEnv.TerminalInfo.UserKind == 4)
{
this.Change(menu, Enum.GetNames(typeof(InvisibleKioskMain)), false, false);
}
}
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:7,代码来源:CustomizeMenu.cs
示例14: InitializeComponents
void InitializeComponents()
{
var menuStrip = new MenuStrip();
saveToolStripMenuItem = new ToolStripMenuItem { Visible = false };
closeToolStripMenuItem = new ToolStripMenuItem { Visible = false };
openToolStripMenuItem = new ToolStripMenuItem { Visible = false };
newToolStripMenuItem = new ToolStripMenuItem { Visible = false };
menuStrip.SuspendLayout();
SuspendLayout();
menuStrip.Items.Add(saveToolStripMenuItem);
menuStrip.Items.Add(closeToolStripMenuItem);
menuStrip.Items.Add(openToolStripMenuItem);
menuStrip.Items.Add(newToolStripMenuItem);
saveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
closeToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.W;
openToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.O;
newToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.N;
Controls.Add(menuStrip);
Size = new Size(800, 600);
Text = "DevPad";
WindowState = FormWindowState.Maximized;
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
ResumeLayout(false);
PerformLayout();
MainMenuStrip = menuStrip;
}
开发者ID:TerryHughes,项目名称:DevPad,代码行数:35,代码来源:MainForm.designer.cs
示例15: EnableMain
public void EnableMain(MenuStrip menu, bool enable)
{
if (this.mSysEnv.TerminalInfo.UserKind == 4)
{
this.Change(menu, Enum.GetNames(typeof(EnableKioskMain)), true, enable);
}
}
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:7,代码来源:CustomizeMenu.cs
示例16: Change
public void Change(MenuStrip parent, string[] menuitems, bool visible, bool enable)
{
foreach (string str in menuitems)
{
ToolStripItem[] itemArray = parent.Items.Find(str, true);
if (itemArray.Length > 0)
{
itemArray[0].Visible = visible;
itemArray[0].Enabled = enable;
if ((itemArray[0].GetType() == typeof(ToolStripMenuItem)) && !visible)
{
((ToolStripMenuItem) itemArray[0]).ShortcutKeys = Keys.None;
if (((ToolStripMenuItem) itemArray[0]).DropDownItems.Count > 0)
{
List<string> list = new List<string>();
foreach (ToolStripItem item in ((ToolStripMenuItem) itemArray[0]).DropDownItems)
{
list.Add(item.Name);
}
this.Change(parent, list.ToArray(), visible, enable);
list.Clear();
}
}
}
}
}
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:26,代码来源:CustomizeMenu.cs
示例17: AddTo
/// <summary>
/// Adds current element group to specified menu strip.
/// </summary>
/// <param name="menu">Menu strip to add this group to.</param>
public virtual void AddTo(MenuStrip menu)
{
var menuItem = NewMenuItem();
menu.Items.Add(menuItem);
CreateItemsForOptions(menuItem);
}
开发者ID:scaredfinger,项目名称:ActiveWidgets,代码行数:11,代码来源:MenuElementGroup.cs
示例18: mainForm
public mainForm()
{
InitializeComponent();
menu = new MenuStrip();
ToolStripMenuItem file =
menu.Items.Add("File") as ToolStripMenuItem;
ToolStripMenuItem edit =
menu.Items.Add("Edit") as ToolStripMenuItem;
this.MainMenuStrip = menu;
this.Controls.Add(menu);
edit.DropDownItems.Add("Cut");
edit.DropDownItems.Add(new ToolStripSeparator());
edit.DropDownItems.Add("Copy");
edit.DropDownItems.Add(new ToolStripSeparator());
edit.DropDownItems.Add("Paste");
ToolStripMenuItem close =
file.DropDownItems.Add("Close") as ToolStripMenuItem;
close.ShortcutKeys = Keys.Alt | Keys.C;
close.ShowShortcutKeys = true;
close.Click += new EventHandler(close_Click);
}
开发者ID:RoykoSerhiy,项目名称:visualStudio_projects,代码行数:25,代码来源:mainForm.cs
示例19: MenuStrip
public MenuStrip()
{
mMenuItems = new List<MenuItem>();
mDockStyle = @"None";
mMenuStrip = null;
mContain = null;
}
开发者ID:zyouhua,项目名称:nvwa,代码行数:7,代码来源:MenuStrip.cs
示例20: MenuCinta
public MenuCinta(VentanaPrincipal f)
{
this.ventanaPrinc = f;
this.menu = new MenuStrip();
f.Controls.Add(this.menu);
this.agregaMenu();
}
开发者ID:imxrako,项目名称:BaseDeDatosA,代码行数:7,代码来源:MenuCinta.cs
注:本文中的System.Windows.Forms.MenuStrip类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论