本文整理汇总了C#中System.Windows.Forms.Menu类的典型用法代码示例。如果您正苦于以下问题:C# Menu类的具体用法?C# Menu怎么用?C# Menu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Menu类属于System.Windows.Forms命名空间,在下文中一共展示了Menu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddBranchSpecificActions
private void AddBranchSpecificActions(Menu.MenuItemCollection items, bool needsLeadingSeparator)
{
var selectedRows = branchGrid.Grid.SelectedRows;
if (selectedRows.Count > 0)
{
if (needsLeadingSeparator)
{
items.AddSeparator();
}
var row = selectedRows[0].DataRow;
var branchId = row["ID"];
var taskId = row["TaskID"];
var builtInActions = new[]
{
new MenuAction("defaultInspect", "&Inspect", true,
() => SetCurrentBranch(branchId, taskId) ),
new MenuAction("defaultOpen", "&Work on this", row["BasePath"] != DBNull.Value,
() => StartWorkOnBranch(branchId, taskId) ),
};
items.AddActions(builtInActions);
var specificActions = _sourceRepository.GetBranchActions(branchId);
if (specificActions.Count > 0)
{
items.AddSeparator();
items.AddActions(specificActions);
}
}
}
示例2: AddTaskSpecificActions
private void AddTaskSpecificActions(Menu.MenuItemCollection items, bool needsLeadingSeparator)
{
var taskId = taskGrid.FindSelectedId();
if (taskId != null)
{
var specificActions = _taskRepository.GetTaskActions(taskId);
if (specificActions.Count > 0)
{
if (needsLeadingSeparator)
{
items.AddSeparator();
}
items.AddActions(specificActions);
}
if (_sourceRepository != null)
{
if (specificActions.Count > 0)
{
items.AddSeparator();
}
items.AddActions(
new MenuAction("createBranch", "Create branch for task {0}".FormatInvariant(taskId), true,
() => CreateBranch(taskId)),
new MenuAction("goToBranch", "Go to branch for task {0}".FormatInvariant(taskId), true,
() => GoToBranchFor(taskId))
);
}
}
}
示例3: AddBuildSpecificActions
private void AddBuildSpecificActions(Menu.MenuItemCollection items, bool needsLeadingSeparator)
{
var selectedItems = builds.Grid.SelectedRows;
if (selectedItems.Count > 0)
{
if (needsLeadingSeparator)
{
items.AddSeparator();
}
var row = selectedItems[0].DataRow;
var buildId = row["ID"];
var buildName = row["Name"];
var builtInActions = new[]
{
new MenuAction("defaultOpen", "&Open", true,
() => SetCurrentBuild(buildId, buildName) ),
};
items.AddActions(builtInActions);
var specificActions = _buildRepository.GetBuildActions(buildId);
if (specificActions.Count > 0)
{
items.AddSeparator();
items.AddActions(specificActions);
}
}
}
示例4: AddSubMenu
private 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];
Bitmap bmp = ( item.Icon != null ) ? (Bitmap)item.Icon :
( ( item.ImageList != null ) ?
(Bitmap)item.ImageList.Images[ item.ImageIndex ] : null );
EventHandler hndl = item.ClickHandler;
// if menu item does not have any ClickHandler then attach own
if( hndl == null )
{
hndl = new EventHandler( RaiseMenuItemClick );
}
MenuCommand currentMenuCommand = new MenuCommand(item.Text, bmp,
(Shortcut)item.Shortcut, hndl, item);
currentMenuCommand.Checked = item.Checked;
currentMenuCommand.Enabled = item.Enabled;
parentMenuCommand.MenuCommands.Add(currentMenuCommand);
if ( item.MenuItems.Count > 0 )
AddSubMenu(currentMenuCommand, item.MenuItems);
}
}
示例5: ScreenToMenu
internal static Point ScreenToMenu (Menu menu, Point pnt)
{
int x = pnt.X;
int y = pnt.Y;
XplatUI.ScreenToMenu (menu.Wnd.window.Handle, ref x, ref y);
return new Point (x, y);
}
示例6: CreateMenuNode
private TreeNode CreateMenuNode(Menu menu)
{
TreeNode node = new TreeNode(menu.Title) { Tag = menu };
UpdateTreeNodeText(menu, "Title", node);
treeView1.Nodes.Add(node);
return node;
}
示例7: ItemsChanged
internal virtual void ItemsChanged(int change, Menu menu)
{
if (this.form != null)
{
this.form.MenuChanged(change, menu);
}
}
示例8: AddControlMenuItems
public static void AddControlMenuItems(Menu.MenuItemCollection pParent, AemInstance pInstance)
{
List<MenuItem> menuItems = new List<MenuItem>();
MenuItem item;
item = new MenuItem();
item.Text = "Start instance";
item.Click += new EventHandler(ControlStartInstance);
menuItems.Add(item);
item = new MenuItem();
item.Text = "Stop instance";
item.Click += new EventHandler(ControlStopInstance);
menuItems.Add(item);
item = new MenuItem();
item.Text = "Kill instance";
item.Click += new EventHandler(ControlKillInstance);
menuItems.Add(item);
foreach (MenuItem i in menuItems) {
i.Tag = pInstance;
}
pParent.AddRange(menuItems.ToArray());
}
示例9: AddItems
private static void AddItems(Menu.MenuItemCollection items, IntPtr hMenu, int index, ref int cmdId)
{
foreach (MenuItem menu in items)
{
string menuText = menu.Text;
if (menu.IsParent)
{
IntPtr popMenu = CreatePopupMenu();
InsertMenu(hMenu, index, MenuFlags.MF_BYPOSITION | MenuFlags.MF_POPUP, popMenu.ToInt32(), ref menuText);
AddItems(menu.MenuItems, popMenu, 0, ref cmdId);
}
else
{
if (menuText == "-")
InsertMenu(hMenu, index, MenuFlags.MF_BYPOSITION | MenuFlags.MF_SEPARATOR, cmdId, ref menuText);
else
InsertMenu(hMenu, index, MenuFlags.MF_BYPOSITION, cmdId, ref menuText);
cmdId++;
}
menu.Text = menuText;
index++;
}
}
示例10: AddShelvesetSpecificActions
private void AddShelvesetSpecificActions(Menu.MenuItemCollection items, bool needsLeadingSeparator)
{
var selectedItems = shelvesetGrid.Grid.SelectedRows;
if (selectedItems.Count > 0)
{
if (needsLeadingSeparator)
{
items.AddSeparator();
}
var row = selectedItems[0].DataRow;
var shelvesetId = row["ID"];
var shelvesetName = (string) row["Name"];
var builtInActions = new[]
{
new MenuAction("defaultInspect", "&Inspect", true,
() => SetCurrentShelveset(shelvesetId, shelvesetName) ),
};
items.AddActions(builtInActions);
var specificActions = _shelvesetRepository.GetShelvesetActions(shelvesetId);
if (specificActions.Count > 0)
{
items.AddSeparator();
items.AddActions(specificActions);
}
}
}
示例11: TuringMachineSetup
public TuringMachineSetup(Menu menuForm)
{
this.menuForm = menuForm;
alphabetSetupForm = new AlphabetSetup(this);
startingStringFrom = new StartingString(this);
statesSetupForm = new States(this);
InitializeComponent();
}
示例12: MenuItemProvider
public MenuItemProvider (SWF.MenuItem menuItem) :
base (menuItem)
{
this.menuItem = menuItem;
parentMenu = mainMenu = menuItem.GetMainMenu ();
if (parentMenu == null)
parentMenu = menuItem.GetContextMenu ();
}
示例13: yobaivan
GameState state; //индикатор состояния игры
#endregion Fields
#region Constructors
public yobaivan()
{
InitializeComponent();
Canvas = this.CreateGraphics(); //рисуем на всей форме
state = new GameState();
state = GameState.start;
menu = new Menu();
game = new Game();
}
示例14: selectControlbyName
public void selectControlbyName(Menu name)
{
foreach (MenuControl menuControl in menuControls){
if (menuControl.accessMenuName == name){
menuControl.activateControl();
currentMenuIndex = menuControls.IndexOf(menuControl);
break;
}
}
}
示例15: UpdateItems
private void UpdateItems()
{
this.selectedMenuItem = null;
this.MenuItems.Clear();
Size imageSize = GetImageSize(this.items);
foreach (CommandBarItem item in this.items)
{
this.MenuItems.Add(new MenuBarItem(item, imageSize, this.font, this.mnemonics));
}
}