本文整理汇总了C#中MenuItem类的典型用法代码示例。如果您正苦于以下问题:C# MenuItem类的具体用法?C# MenuItem怎么用?C# MenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MenuItem类属于命名空间,在下文中一共展示了MenuItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: HandleFindId
private void HandleFindId(MenuItem mi, PopupTargetInfo pti)
{
using (JaneScript js = WrapperManager.GetJaneScript())
using (ViewItem view = pti.PopupObject.ConvertToConcreteWrapper<ViewItem>())
using (ThreadItem thread = view.Thread()) {
if (null == thread) {
js.Log("通常のスレッドのタブから実行してください。");
return;
}
string id;
int resNumber = pti.Number;
if (resNumber > 0) {
//日付中ID
using (ResItem res = thread.GetRes(resNumber)) {
id = res.Id;
}
} else {
id = pti.InfoText;
}
if (string.IsNullOrEmpty(id)) {
js.Log("IDが取得できませんでした。");
}
try {
this.DoFindId(js, thread, id);
} catch (Exception ex) {
js.Log(ex.Message);
js.Log(ex.StackTrace);
}
}
}
开发者ID:ohtake,项目名称:janeview-scripts,代码行数:30,代码来源:IdComponent.cs
示例2: MainForm
public MainForm(MenuItem menuItem, Options options)
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
onTopToolStripMenuItem.Checked = options.onTop;
this.TopMost = onTopToolStripMenuItem.Checked;
centerOnScreenToolStripMenuItem.Checked = options.centerScreen;
if (centerOnScreenToolStripMenuItem.Checked) {
this.StartPosition = FormStartPosition.CenterScreen;
} else if (options.mousePosition) {
this.StartPosition = FormStartPosition.Manual;
this.Top = Cursor.Position.Y - 10;
this.Left = Cursor.Position.X - 10;
} else {
this.StartPosition = FormStartPosition.Manual;
this.Top = options.top;
this.Left = options.left;
}
setNewPath(menuItem);
this.Text = menuItem.caption;
setMouseCursor ();
closeAfterExecuteToolStripMenuItem.Checked = options.closeExec;
closeOnLostFocusToolStripMenuItem.Checked = options.closeOnLost;
}
开发者ID:martinlebeda,项目名称:simpleexplorer,代码行数:32,代码来源:MainForm.cs
示例3: DrawingMenu
private static Menu DrawingMenu()
{
var drawMenu = new Menu("Drawing Settings", "Drawings");
drawMenu
.AddItem(
new MenuItem("drawoptions", "Drawing Mode Mode").SetValue(
new StringList(new[] { "Normal Mode", "Colorblind Mode" })));
drawMenu.SubMenu("Drawings").AddItem(new MenuItem("Draw", "Display Drawings").SetValue(true));
drawMenu.SubMenu("Drawings").AddItem(new MenuItem("qDraw", "Draw Q").SetValue(true));
drawMenu.SubMenu("Drawings").AddItem(new MenuItem("eDraw", "Draw E").SetValue(true));
drawMenu.SubMenu("Drawings").AddItem(new MenuItem("wDraw", "Draw W").SetValue(true));
drawMenu.SubMenu("Drawings").AddItem(new MenuItem("stackDraw", "Stack Count").SetValue(true));
drawMenu.SubMenu("Drawings").AddItem(new MenuItem("notdraw", "Draw Floating Text").SetValue(true));
drawMenu.SubMenu("Drawings").AddItem(new MenuItem("keyBindDisplay", "Display Keybinds").SetValue(true));
var drawDamageMenu = new MenuItem("RushDrawEDamage", "Combo Damage").SetValue(true);
var drawFill =
new MenuItem("RushDrawWDamageFill", "Draw Damage Fill").SetValue(new Circle(true, Color.SeaGreen));
drawMenu.SubMenu("Drawings").AddItem(drawDamageMenu);
drawMenu.SubMenu("Drawings").AddItem(drawFill);
//GlobalManager.EnableDrawingDamage = drawDamageMenu.GetValue<bool>();
//GlobalManager.EnableFillDamage = drawFill.GetValue<Circle>().Active;
//GlobalManager.DamageFillColor = drawFill.GetValue<Circle>().Color;
return drawMenu;
}
开发者ID:Faqer,项目名称:LeagueSharp-3,代码行数:27,代码来源:MenuManager.cs
示例4: OnLoad
protected override void OnLoad(EventArgs e)
{
Assert.ArgumentNotNull((object)e, "e");
base.OnLoad(e);
if (!Context.ClientPage.IsEvent)
{
Item currentItem = GalleryPublishedTargetsForm.GetCurrentItem();
if (currentItem != null)
{
var targets = new PublishingHelper().ListTargets(currentItem);
foreach (var target in targets.Keys)
{
var menuItem = new MenuItem();
menuItem.Header = target;
if(targets[target].Equals(PublishingHelper.PublishState.Published))
{
menuItem.Icon = "Other/32x32/bullet_ball_glass_green.png";
}
else if (targets[target].Equals(PublishingHelper.PublishState.Changed))
{
menuItem.Icon = "Other/32x32/bullet_ball_glass_yellow.png";
}
else
{
menuItem.Icon = "Other/32x32/bullet_ball_glass_red.png";
}
this.Targets.Controls.Add(menuItem);
}
}
}
}
开发者ID:BraveNewMath,项目名称:sitecore-power-publish,代码行数:31,代码来源:GalleryPublishedTargetsForm.cs
示例5: GetMenuItems
public ObservableCollection<MenuItem> GetMenuItems()
{
ObservableCollection<MenuItem> items = new ObservableCollection<MenuItem>();
MenuItem copyItem = new MenuItem()
{
IconUrl = new Uri("Images/copy.png", UriKind.Relative),
Text = "Copy",
Command = new CopyCommand()
};
items.Add(copyItem);
MenuItem pasteItem = new MenuItem()
{
IconUrl = new Uri("Images/paste.png", UriKind.Relative),
Text = "Paste",
Command = new PasteCommand()
};
items.Add(pasteItem);
MenuItem cutItem = new MenuItem()
{
IconUrl = new Uri("Images/cut.png", UriKind.Relative),
Text = "Cut",
Command = new CutCommand()
};
items.Add(cutItem);
return items;
}
开发者ID:CJMarsland,项目名称:xaml-sdk,代码行数:30,代码来源:MainPage.xaml.cs
示例6: Game_OnUpdate
private static void Game_OnUpdate(EventArgs args)
{
if (!Game.IsInGame)
{
loaded = false;
return;
}
if (loaded)
{
return;
}
Game.GetConsoleVar("fog_enable").SetValue(0);
var player = ObjectMgr.LocalPlayer;
if ((player == null) || (player.Team == Team.Observer))
return;
Game.PrintMessage("<font color='#aaaaaa'>Zoom Improved </font><font color='#33ff66'>Loaded</font>", MessageType.LogMessage);
var slider = new MenuItem("distance", "Camera Distance").SetValue(new Slider(1550, 1134, 2500));
slider.ValueChanged += Slider_ValueChanged;
Menu.AddItem(slider);
Menu.AddToMainMenu();
ZoomVar.RemoveFlags(ConVarFlags.Cheat);
renderVar.RemoveFlags(ConVarFlags.Cheat);
ZoomVar.SetValue(slider.GetValue<Slider>().Value);
renderVar.SetValue(2*(slider.GetValue<Slider>().Value));
loaded = true;
}
开发者ID:dendimonster,项目名称:Ensage,代码行数:26,代码来源:Program.cs
示例7: Main
public static void Main(string[] args)
{
MenuItem item;
item = new MenuItem("heroes", "Check allied heroes").SetValue(true);
item.ValueChanged += Item_ValueChanged;
Menu.AddItem(item);
item = new MenuItem("wards", "Check wards").SetValue(true);
item.ValueChanged += Item_ValueChanged;
Menu.AddItem(item);
item = new MenuItem("mines", "Check techies mines").SetValue(true);
item.ValueChanged += Item_ValueChanged;
Menu.AddItem(item);
item = new MenuItem("units", "Check controlled units (not lane creeps)").SetValue(true);
item.ValueChanged += Item_ValueChanged;
Menu.AddItem(item);
item = new MenuItem("buildings", "Check buildings").SetValue(true);
item.ValueChanged += Item_ValueChanged;
Menu.AddItem(item);
Menu.AddToMainMenu();
Game.OnIngameUpdate += Game_OnUpdate;
}
开发者ID:vitac1998,项目名称:Ensage,代码行数:28,代码来源:Program.cs
示例8: Game_OnGameLoad
private static void Game_OnGameLoad()
{
//Notifications.AddNotification("CS Counter loaded.", 10);
_menu2 = new Menu("CS Counter", "menu2", false);
//var drawings2 = new Menu("Drawings", "drawings2");
//_menu2.AddSubMenu(drawings2);
_menuenable2 = new MenuItem("menu.drawings.enable2", "CS Count").SetValue(true);
_menu2.AddItem(_menuenable2);
_menuenable3 = new MenuItem("menu.drawings.enable3", "My CS Count").SetValue(true);
_menu2.AddItem(_menuenable3);
_menuenable4 = new MenuItem("menu.drawings.enable4", "Allies CS Count").SetValue(true);
_menu2.AddItem(_menuenable4);
advanced = new MenuItem("menu.drawings.advanced", "Advanced Farminfo (ME)").SetValue(false);
_menu2.AddItem(advanced);
_xPos = new MenuItem("menu.Calc.calc5", "X - Position").SetValue(new Slider(47));
_menu2.AddItem(_xPos);
_yPos = new MenuItem("menu.Calc.calc6", "Y - Position").SetValue(new Slider(-10));
_menu2.AddItem(_yPos);
UtilityAIO.Program.MainMenuOp.AddSubMenu(_menu2);
minionspawn = new TimeSpan(0,0,1,30);
countminionwave = 3;
timeplus = new TimeSpan(0, 0, 0, 30);
waveone = 0;
wavetwo = 1;
wavethree = 2;
minionsgesamt = 0;
Drawing.OnDraw += Drawing_OnDraw;
}
开发者ID:fgpmaia123,项目名称:LeagueSharp-18,代码行数:32,代码来源:CSCounter.cs
示例9: Game_OnUpdate
private static void Game_OnUpdate(EventArgs args)
{
if (!Game.IsInGame)
{
loaded = false;
return;
}
if (loaded)
{
return;
}
var slider = new MenuItem("distance", "Camera Distance").SetValue(new Slider(1550, 1134, 2500));
slider.ValueChanged += Slider_ValueChanged;
Menu.AddItem(slider);
Menu.AddToMainMenu();
ZoomVar.RemoveFlags(ConVarFlags.Cheat);
ZoomVar.SetValue(slider.GetValue<Slider>().Value);
Game.GetConsoleVar("r_farz").SetValue(18000);
Game.GetConsoleVar("fog_enable").SetValue(0);
Game.GetConsoleVar("dota_camera_disable_zoom").SetValue(0);
// This section makes MapHack Working
var list = new Dictionary<string, float>
{
{ "sv_cheats", 1 }
};
foreach (var data in list)
{
var var = Game.GetConsoleVar(data.Key);
var.RemoveFlags(ConVarFlags.Cheat);
var.SetValue(data.Value);
}
// Thats it
loaded = true;
}
开发者ID:oleg9522,项目名称:Ensage,代码行数:34,代码来源:Program.cs
示例10: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DataSet ds = GetProductsAndCategories();
// Loop through the category records.
foreach (DataRow row in ds.Tables["Categories"].Rows)
{
// Use the constructor that requires just text
// and a non-displayed value.
MenuItem itemCategory = new MenuItem(
row["CategoryName"].ToString(),
row["CategoryID"].ToString());
Menu1.Items.Add(itemCategory);
// Get the children (products) for this parent (category).
DataRow[] childRows = row.GetChildRows(ds.Relations[0]);
// Loop through all the products in this category.
foreach (DataRow childRow in childRows)
{
MenuItem itemProduct = new MenuItem(
childRow["ProductName"].ToString(),
childRow["ProductID"].ToString());
itemCategory.ChildItems.Add(itemProduct);
}
}
}
}
开发者ID:Helen1987,项目名称:edu,代码行数:32,代码来源:MenuDb.aspx.cs
示例11: Initialize
internal static void Initialize()
{
var manaBarItem = new MenuItem("DrawManaBarIndicator", "Draw Combo ManaBar Indicator").SetValue(true);
Program.DrawMenu.AddItem(manaBarItem);
DxLine = new Line(DxDevice) { Width = 4 };
Drawing.OnPreReset += DrawingOnOnPreReset;
Drawing.OnPostReset += DrawingOnOnPostReset;
AppDomain.CurrentDomain.DomainUnload += CurrentDomainOnDomainUnload;
AppDomain.CurrentDomain.ProcessExit += CurrentDomainOnDomainUnload;
Drawing.OnEndScene += eventArgs =>
{
var color = new ColorBGRA(255, 255, 255, 255);
var qMana = new[] { 0, 40, 50, 60, 70, 80 };
var wMana = new[] { 0, 60, 70, 80, 90, 100 }; // W Mana Cost doesnt works :/
var eMana = new[] { 0, 50, 50, 50, 50, 50 };
var rMana = new[] { 0, 100, 100, 100 };
if (manaBarItem.GetValue<bool>())
{
var totalCostMana = qMana[Program.Q.Level] + wMana[Program.W.Level] + eMana[Program.E.Level]
+ rMana[Program.R.Level];
DrawManaPercent(
totalCostMana,
totalCostMana > ObjectManager.Player.Mana ? new ColorBGRA(255, 0, 0, 255) : new ColorBGRA(255, 255, 255, 255));
}
};
}
开发者ID:qq2128969,项目名称:LeagueSharp-1,代码行数:32,代码来源:ManaBarIndicator.cs
示例12: PhotoVersionMenu
public PhotoVersionMenu (Photo photo)
{
version_id = photo.DefaultVersionId;
uint [] version_ids = photo.VersionIds;
item_infos = new MenuItemInfo [version_ids.Length];
int i = 0;
foreach (uint id in version_ids) {
MenuItem menu_item = new MenuItem (photo.GetVersionName (id));
menu_item.Show ();
menu_item.Sensitive = true;
menu_item.Activated += new EventHandler (HandleMenuItemActivated);
item_infos [i ++] = new MenuItemInfo (menu_item, id);
Append (menu_item);
}
if (version_ids.Length == 1) {
MenuItem no_edits_menu_item = new MenuItem (Mono.Unix.Catalog.GetString ("(No Edits)"));
no_edits_menu_item.Show ();
no_edits_menu_item.Sensitive = false;
Append (no_edits_menu_item);
}
}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:26,代码来源:PhotoVersionMenu.cs
示例13: MainForm
public MainForm ()
{
//
// _mainMenu
//
_mainMenu = new MainMenu ();
//
// _fileMenu
//
_fileMenuItem = new MenuItem ();
_fileMenuItem.Text = "&File";
_mainMenu.MenuItems.Add (_fileMenuItem);
//
// openToolStripMenuItem
//
_openMenuItem = new MenuItem ();
_openMenuItem.Text = "&Open";
_openMenuItem.Click += new EventHandler (OpenMenuItem_Click);
_fileMenuItem.MenuItems.Add (_openMenuItem);
//
// MainForm
//
ClientSize = new Size (400, 300);
IsMdiContainer = true;
Location = new Point (200, 100);
Menu = _mainMenu;
StartPosition = FormStartPosition.Manual;
Text = "bug #81651";
Load += new EventHandler (MainForm_Load);
}
开发者ID:mono,项目名称:gert,代码行数:31,代码来源:MainForm.cs
示例14: CalcWidthItem
/// <summary>
/// Calculate the item's width.
/// </summary>
/// <param name="menuItem">The <see cref="MenuItem" /></param>
/// <returns>The width</returns>
public static int CalcWidthItem(MenuItem menuItem)
{
return
(int)
(MeasureString(MultiLanguage.Translation(menuItem.DisplayName)).Width
+ (MenuSettings.ContainerTextOffset * 2));
}
开发者ID:CjShu,项目名称:LeagueSharp.SDKEx,代码行数:12,代码来源:BlueUtilities.cs
示例15: Ahri
public Ahri()
{
if (ObjectManager.Player.ChampionName != "Ahri")
return;
(_menu = new Menu("AhriSharp", "AhriSharp", true)).AddToMainMenu();
var targetSelectorMenu = new Menu("Target Selector", "TargetSelector");
TargetSelector.AddToMenu(targetSelectorMenu);
_menu.AddSubMenu(targetSelectorMenu);
_orbwalker = new Orbwalking.Orbwalker(_menu.AddSubMenu(new Menu("Orbwalking", "Orbwalking")));
var comboMenu = _menu.AddSubMenu(new Menu("Combo", "Combo"));
comboMenu.AddItem(new MenuItem("comboQ", "Use Q").SetValue(true));
comboMenu.AddItem(new MenuItem("comboW", "Use W").SetValue(true));
comboMenu.AddItem(new MenuItem("comboE", "Use E").SetValue(true));
comboMenu.AddItem(new MenuItem("comboR", "Use R").SetValue(true));
comboMenu.AddItem(new MenuItem("comboROnlyUserInitiate", "Use R only if user initiated").SetValue(false));
var harassMenu = _menu.AddSubMenu(new Menu("Harass", "Harass"));
harassMenu.AddItem(new MenuItem("harassQ", "Use Q").SetValue(true));
harassMenu.AddItem(new MenuItem("harassE", "Use E").SetValue(true));
harassMenu.AddItem(new MenuItem("harassPercent", "Skills until Mana %").SetValue(new Slider(20)));
var farmMenu = _menu.AddSubMenu(new Menu("Lane Clear", "LaneClear"));
farmMenu.AddItem(new MenuItem("farmQ", "Use Q").SetValue(true));
farmMenu.AddItem(new MenuItem("farmW", "Use W").SetValue(false));
farmMenu.AddItem(new MenuItem("farmPercent", "Skills until Mana %").SetValue(new Slider(20)));
farmMenu.AddItem(new MenuItem("farmStartAtLevel", "Only AA until Level").SetValue(new Slider(8, 1, 18)));
var drawMenu = _menu.AddSubMenu(new Menu("Drawing", "Drawing"));
drawMenu.AddItem(new MenuItem("drawQE", "Draw Q, E range").SetValue(new Circle(true, System.Drawing.Color.FromArgb(125, 0, 255, 0))));
drawMenu.AddItem(new MenuItem("drawW", "Draw W range").SetValue(new Circle(false, System.Drawing.Color.FromArgb(125, 0, 0, 255))));
var dmgAfterComboItem = new MenuItem("DamageAfterCombo", "Draw Combo Damage").SetValue(true); //copied from esk0r Syndra
drawMenu.AddItem(dmgAfterComboItem);
var miscMenu = _menu.AddSubMenu(new Menu("Misc", "Misc"));
miscMenu.AddItem(new MenuItem("packetCast", "Packet Cast").SetValue(true));
_itemDFG = Utility.Map.GetMap().Type == Utility.Map.MapType.TwistedTreeline ? new Items.Item(3188, 750) : new Items.Item(3128, 750);
_spellQ = new Spell(SpellSlot.Q, 990);
_spellW = new Spell(SpellSlot.W, 795 - 95);
_spellE = new Spell(SpellSlot.E, 1000 - 10);
_spellR = new Spell(SpellSlot.R, 1000 - 100);
_spellQ.SetSkillshot(.215f, 100, 1600f, false, SkillshotType.SkillshotLine);
_spellW.SetSkillshot(.71f, _spellW.Range, float.MaxValue, false, SkillshotType.SkillshotLine);
_spellE.SetSkillshot(.23f, 60, 1500f, true, SkillshotType.SkillshotLine);
Utility.HpBarDamageIndicator.DamageToUnit = GetComboDamage;
Utility.HpBarDamageIndicator.Enabled = dmgAfterComboItem.GetValue<bool>();
dmgAfterComboItem.ValueChanged += delegate(object sender, OnValueChangeEventArgs eventArgs) { Utility.HpBarDamageIndicator.Enabled = eventArgs.GetNewValue<bool>(); };
Drawing.OnDraw += Drawing_OnDraw;
Game.OnUpdate += Game_OnUpdate;
Game.PrintChat("<font color=\"#1eff00\">AhriSharp by Beaving</font> - <font color=\"#00BFFF\">Loaded</font>");
}
开发者ID:deltinho4,项目名称:LeagueSharp,代码行数:60,代码来源:Ahri.cs
示例16: spellItem_Validated
void spellItem_Validated(MenuItem sender, ValidationEventArgs e)
{
Combat.ChangeState(BlazeraLib.Combat.EState.SpellCellSelection, new Phase.StartInfo(new Dictionary<string,object>()
{
{ "Spell", sender.GetText() }
}));
}
开发者ID:jpx,项目名称:blazera,代码行数:7,代码来源:SpellMenu.cs
示例17: MForm2
public MForm2()
{
Text = "Check menu item";
sb = new StatusBar();
sb.Parent = this;
sb.Text = "Ready";
MainMenu mainMenu = new MainMenu();
MenuItem file = mainMenu.MenuItems.Add("&File");
file.MenuItems.Add(new MenuItem("E&xit",
new EventHandler(OnExit), Shortcut.CtrlX));
MenuItem view = mainMenu.MenuItems.Add("&View");
viewStatusBar = new MenuItem("View StatusBar");
viewStatusBar.Checked = true;
viewStatusBar.Click += new EventHandler(ToggleStatusBar);
view.MenuItems.Add(viewStatusBar);
Menu = mainMenu;
Size = new Size(250, 200);
CenterToScreen();
}
开发者ID:sciruela,项目名称:MonoWinformsTutorial,代码行数:25,代码来源:checkmenu.cs
示例18: ListaMenu
public void ListaMenu()
{
MenuItem menu = new MenuItem();
BEMenu eMenu = new BEMenu();
BERolMenu eRolMenu = new BERolMenu();
DataTable dt = new DataTable();
eRolUsuario.Cod_Personal = Session["IDPERSONAL"].ToString();
try
{
eRolMenu.Id_Rol = Convert.ToInt32(Session["RolElegido"].ToString());
eMenu.Id_Padre = 0;
dt = objMenu.ConsultarMenu(eMenu, eRolMenu);
if (dt.Rows.Count > 0)
{
Session["NewRol"] = Convert.ToInt32(Session["RolElegido"].ToString());
CargaMenu(dt);
}
}
catch (Exception ex)
{
NetAjax.JsMensajeAlert(this.Page, ex.Message);
}
}
开发者ID:campivi,项目名称:MecanicsWorkOfficial,代码行数:26,代码来源:frmFormularioInicio.aspx.cs
示例19: addItem
public void addItem(string category, MenuItem item)
{
if (!m_menu.ContainsKey(category))
m_menu[category] = new List<MenuItem>();
m_menu[category].Add(item);
}
开发者ID:Senney,项目名称:Restorder,代码行数:7,代码来源:Menu.cs
示例20: AddLayerToTree
/// <summary>
/// This function adds a given layer to the tree.
/// </summary>
/// <param name="layer">The layer that is being added. </param>
public void AddLayerToTree(Layer layer)
{
MenuItem root = new MenuItem() { Title = "Location" };
root.Items.Add(new MenuItem() { Title = "Time" });
//TreeViewItems.Add(root);
//LayerView.Items.Add(root);
}
开发者ID:travisolbrich,项目名称:AerialMapping,代码行数:11,代码来源:MainWindow.xaml.cs
注:本文中的MenuItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论