本文整理汇总了C#中System.Windows.Forms.Menu类的典型用法代码示例。如果您正苦于以下问题:C# Menu类的具体用法?C# Menu怎么用?C# Menu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Menu类属于System.Windows.Forms命名空间,在下文中一共展示了Menu类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
}
开发者ID:olivierdagenais,项目名称:branchreview,代码行数:28,代码来源:BranchBrowser.cs
示例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))
);
}
}
}
开发者ID:olivierdagenais,项目名称:branchreview,代码行数:29,代码来源:TaskBrowser.cs
示例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);
}
}
}
开发者ID:olivierdagenais,项目名称:branchreview,代码行数:26,代码来源:BuildBrowser.cs
示例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);
}
}
开发者ID:ewosp,项目名称:sycorax,代码行数:31,代码来源:ChevronMenu.cs
示例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);
}
开发者ID:stabbylambda,项目名称:mono,代码行数:7,代码来源:MenuAPI.cs
示例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;
}
开发者ID:Daimakaicho,项目名称:MenuDesigner,代码行数:7,代码来源:Form1.cs
示例7: ItemsChanged
internal virtual void ItemsChanged(int change, Menu menu)
{
if (this.form != null)
{
this.form.MenuChanged(change, menu);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:MainMenu.cs
示例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());
}
开发者ID:wcm-io-devops,项目名称:aem-manager,代码行数:26,代码来源:AemActions.cs
示例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++;
}
}
开发者ID:kthompson,项目名称:gitty.shell,代码行数:25,代码来源:ContextMenuHandlerBase.cs
示例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);
}
}
}
开发者ID:olivierdagenais,项目名称:branchreview,代码行数:26,代码来源:ShelvesetBrowser.cs
示例11: TuringMachineSetup
public TuringMachineSetup(Menu menuForm)
{
this.menuForm = menuForm;
alphabetSetupForm = new AlphabetSetup(this);
startingStringFrom = new StartingString(this);
statesSetupForm = new States(this);
InitializeComponent();
}
开发者ID:Thobias83,项目名称:TileSetGenerator,代码行数:8,代码来源:TuringMachineSetup.cs
示例12: MenuItemProvider
public MenuItemProvider (SWF.MenuItem menuItem) :
base (menuItem)
{
this.menuItem = menuItem;
parentMenu = mainMenu = menuItem.GetMainMenu ();
if (parentMenu == null)
parentMenu = menuItem.GetContextMenu ();
}
开发者ID:mono,项目名称:uia2atk,代码行数:8,代码来源:MenuItemProvider.cs
示例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();
}
开发者ID:stepanton,项目名称:Jumper,代码行数:15,代码来源:yoba-ivan.cs
示例14: selectControlbyName
public void selectControlbyName(Menu name)
{
foreach (MenuControl menuControl in menuControls){
if (menuControl.accessMenuName == name){
menuControl.activateControl();
currentMenuIndex = menuControls.IndexOf(menuControl);
break;
}
}
}
开发者ID:am0rphyst,项目名称:X-O-Genesis,代码行数:10,代码来源:MenuBar.cs
示例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));
}
}
开发者ID:heon21st,项目名称:flashdevelop,代码行数:12,代码来源:CommandBarContextMenu.cs
示例16: MainWindow
public MainWindow()
: base("MD", 640, 480)
{
this.WindowState = WindowState.Maximized;
// Client area
VariableContainer clientarea = new VariableContainer();
// Menu items
MenuItem[] menuitems = new MenuItem[]
{
MenuItem.Create("File", new MenuItem[]
{
MenuItem.Create("Import", delegate
{
using(var fd = new WinForms.OpenFileDialog())
{
fd.Filter = "MP3 Files |*.mp3";
if (fd.ShowDialog() == WinForms.DialogResult.OK)
{
string file = fd.FileName;
AudioContext ac = new AudioContext();
MemoryAudioSource mas = new MP3AudioFeed(file).Copy(4096, 4096 * 100);
SpectrogramView sp = new SpectrogramView(mas);
clientarea.Client = sp;
AudioOutput ao = new AudioOutput(mas.Play);
ao.Play();
}
else
{
return;
}
}
}),
MenuItem.Create("Exit", delegate
{
this.Close();
})
})
};
// Menu and splitter
Menu menu = new Menu(menuitems);
SplitContainer sc = new SplitContainer(Axis.Vertical, menu.WithBorder(0.0, 0.0, 0.0, 1.0), clientarea);
sc.NearSize = 30.0;
// Main layer container
LayerContainer lc = new LayerContainer(sc);
this.Control = lc;
}
开发者ID:dzamkov,项目名称:MD-old,代码行数:53,代码来源:MainWindow.cs
示例17: jumper
GameState state; //индикатор состояния игры
#endregion Fields
#region Constructors
public jumper()
{
InitializeComponent();
Canvas = this.CreateGraphics(); //рисуем на всей форме
state = new GameState();
state = GameState.start;
menu = new Menu();
game = new Game();
context = BufferedGraphicsManager.Current;
context.MaximumBuffer = new Size(this.Width + 1, this.Height + 1);
canvas = context.Allocate(this.CreateGraphics(), new Rectangle(0, 0, this.Width, this.Height));
direction = Direction.Nothing;
}
开发者ID:stepanton,项目名称:Jumper,代码行数:19,代码来源:jumper.cs
示例18: AddMenuItem
public override void AddMenuItem(string menuPath, Menu.MenuItem item)
{
base.AddMenuItem(menuPath, item);
Menu.MenuItem baseNode = findNode(menuPath, MenuData);
//if(baseNode == null)
ToolStripItemCollection coll = (ToolStripItemCollection)baseNode.Tag;
ToolStripMenuItem tsItem = new ToolStripMenuItem();
tsItem.Text = item.Name;
tsItem.Click += delegate { if(item.Command!=null) item.Command(); };
coll.Add(tsItem);
item.Tag = tsItem.DropDownItems;
}
开发者ID:HaKDMoDz,项目名称:LofiGameSDK,代码行数:13,代码来源:FormMenuModule.cs
示例19: AddMenuItem
private static MenuItem AddMenuItem(
Menu menu, string text, EventHandler handler, object context,
Shortcut shortcut = Shortcut.None)
{
var item = new MenuItem(text, handler)
{
Tag = context,
Shortcut = shortcut,
ShowShortcut = shortcut != Shortcut.None
};
menu.MenuItems.Add(item);
return item;
}
开发者ID:nemec,项目名称:Fiddler-Launchpad,代码行数:13,代码来源:LaunchpadView.cs
示例20: 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];
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);
}
}
开发者ID:sillsdev,项目名称:CarlaLegacy,代码行数:13,代码来源:ChevronMenu.cs
注:本文中的System.Windows.Forms.Menu类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论