本文整理汇总了C#中System.Windows.Forms.ToolStripMenuItem.PerformClick方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStripMenuItem.PerformClick方法的具体用法?C# ToolStripMenuItem.PerformClick怎么用?C# ToolStripMenuItem.PerformClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ToolStripMenuItem
的用法示例。
在下文中一共展示了ToolStripMenuItem.PerformClick方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: frmMain
public frmMain()
{
InitializeComponent();
RijndaelEngineControl rijndaelEngineControl = new RijndaelEngineControl();
ToolStripMenuItem rijndaelEngineControlMenu = new ToolStripMenuItem(rijndaelEngineControl.DisplayName)
{
Tag = rijndaelEngineControl
};
rijndaelEngineControlMenu.Click += MenuClick;
configurationToolStripMenuItem.DropDownItems.Add(rijndaelEngineControlMenu);
DPAPIEngineControl dpapiEngineControl = new DPAPIEngineControl();
ToolStripMenuItem dpapiEngineControlMenu = new ToolStripMenuItem(dpapiEngineControl.DisplayName)
{
Tag = dpapiEngineControl
};
dpapiEngineControlMenu.Click += MenuClick;
configurationToolStripMenuItem.DropDownItems.Add(dpapiEngineControlMenu);
HashingControl hashingControl = new HashingControl();
ToolStripMenuItem hashingControlMenu = new ToolStripMenuItem(hashingControl.DisplayName)
{
Tag = hashingControl
};
hashingControlMenu.Click += MenuClick;
configurationToolStripMenuItem.DropDownItems.Add(hashingControlMenu);
rijndaelEngineControlMenu.PerformClick();
}
示例2: VoiceToolstripButton
public VoiceToolstripButton(VoiceService voices)
{
Voices = voices;
ToolTipText = "Voice Chat";
Paint += new PaintEventHandler(VoiceToolstripButton_Paint);
ButtonClick += new EventHandler(VoiceToolstripButton_ButtonClick);
MouseDown += new MouseEventHandler(VoiceToolstripButton_MouseDown);
MouseUp += new MouseEventHandler(VoiceToolstripButton_MouseUp);
OffButton = new ToolStripMenuItem("Off", Res.VoiceRes.VoiceOff, OffButton_Clicked);
VoiceActivatedButton = new ToolStripMenuItem("Voice Activated", Res.VoiceRes.VoiceVAD, VoiceActivatedButton_Clicked);
PushtoTalkButton = new ToolStripMenuItem("Push to Talk", Res.VoiceRes.VoicePTT, PushtoTalkButton_Clicked);
MuteButton = new ToolStripMenuItem("Mute", Res.VoiceRes.VoiceMute, MuteButton_Clicked);
SettingsButton = new ToolStripMenuItem("Settings", Res.VoiceRes.VoiceSettings, SettingsButton_Clicked);
DropDownItems.Add(OffButton);
DropDownItems.Add(VoiceActivatedButton);
DropDownItems.Add(PushtoTalkButton);
DropDownItems.Add(MuteButton);
DropDownItems.Add(SettingsButton);
WindowID = Voices.Core.RndGen.Next();
Voices.RegisterWindow(WindowID, new VolumeUpdateHandler(VoiceService_VolumeUpdate));
OffButton.PerformClick();
}
示例3: Constructor
public void Constructor ()
{
ToolStripMenuItem tsi = new ToolStripMenuItem ();
Assert.AreEqual (false, tsi.Checked, "A1");
Assert.AreEqual (false, tsi.CheckOnClick, "A2");
Assert.AreEqual (CheckState.Unchecked, tsi.CheckState, "A3");
Assert.AreEqual (true, tsi.Enabled, "A4");
Assert.AreEqual (false, tsi.IsMdiWindowListEntry, "A5");
Assert.AreEqual (ToolStripItemOverflow.Never, tsi.Overflow, "A6");
Assert.AreEqual (null, tsi.ShortcutKeyDisplayString, "A7");
Assert.AreEqual (Keys.None, tsi.ShortcutKeys, "A8");
Assert.AreEqual (true, tsi.ShowShortcutKeys, "A9");
Assert.AreEqual (SystemColors.ControlText, tsi.ForeColor, "A9-1");
Assert.AreEqual ("System.Windows.Forms.ToolStripMenuItem+ToolStripMenuItemAccessibleObject", tsi.AccessibilityObject.GetType ().ToString (), "A10");
int count = 0;
EventHandler oc = new EventHandler (delegate (object sender, EventArgs e) { count++; });
Image i = new Bitmap (1, 1);
tsi = new ToolStripMenuItem (i);
tsi.PerformClick ();
Assert.AreEqual (null, tsi.Text, "A10-1");
Assert.AreSame (i, tsi.Image, "A10-2");
Assert.AreEqual (0, count, "A10-3");
Assert.AreEqual (string.Empty, tsi.Name, "A10-4");
tsi = new ToolStripMenuItem ("Text");
tsi.PerformClick ();
Assert.AreEqual ("Text", tsi.Text, "A10-5");
Assert.AreSame (null, tsi.Image, "A11");
Assert.AreEqual (0, count, "A12");
Assert.AreEqual (string.Empty, tsi.Name, "A13");
tsi = new ToolStripMenuItem ("Text", i);
tsi.PerformClick ();
Assert.AreEqual ("Text", tsi.Text, "A14");
Assert.AreSame (i, tsi.Image, "A15");
Assert.AreEqual (0, count, "A16");
Assert.AreEqual (string.Empty, tsi.Name, "A17");
tsi = new ToolStripMenuItem ("Text", i, oc);
tsi.PerformClick ();
Assert.AreEqual ("Text", tsi.Text, "A18");
Assert.AreSame (i, tsi.Image, "A19");
Assert.AreEqual (1, count, "A20");
Assert.AreEqual (string.Empty, tsi.Name, "A21");
tsi = new ToolStripMenuItem ("Text", i, oc, "Name");
tsi.PerformClick ();
Assert.AreEqual ("Text", tsi.Text, "A22");
Assert.AreSame (i, tsi.Image, "A23");
Assert.AreEqual (2, count, "A24");
Assert.AreEqual ("Name", tsi.Name, "A25");
}
示例4: PopulateColorResolutionMenu
public void PopulateColorResolutionMenu(string deviceName)
{
bool foundDefaultResolution = false;
var sm = new ToolStripMenuItem("Color");
foreach (var resolution in ColorResolutions[deviceName])
{
var resText = PixelFormat2String(resolution.Item1.format) + " " + resolution.Item1.width + "x"
+ resolution.Item1.height + " " + resolution.Item2.max + " fps";
var sm1 = new ToolStripMenuItem(resText, null);
var selectedResolution = resolution;
sm1.Click += (sender, eventArgs) =>
{
m_selectedColorResolution = selectedResolution;
ColorResolution_Item_Click(sender);
};
sm.DropDownItems.Add(sm1);
if (selectedResolution.Item1.format == PXCMImage.PixelFormat.PIXEL_FORMAT_YUY2 &&
selectedResolution.Item1.width == 640 && selectedResolution.Item1.height == 360 && selectedResolution.Item2.min == 30)
{
foundDefaultResolution = true;
sm1.Checked = true;
sm1.PerformClick();
}
}
if (!foundDefaultResolution && sm.DropDownItems.Count > 0)
{
((ToolStripMenuItem)sm.DropDownItems[0]).Checked = true;
((ToolStripMenuItem)sm.DropDownItems[0]).PerformClick();
}
try
{
MainMenu.Items.RemoveAt(1);
}
catch (NotSupportedException)
{
sm.Dispose();
throw;
}
MainMenu.Items.Insert(1, sm);
}
示例5: NotifyIcon
public NotifyIcon(Main m)
{
this.m = m;
components = new System.ComponentModel.Container();
menu = new ContextMenuStrip();
exit = new ToolStripMenuItem();
settings = new ToolStripMenuItem();
help = new ToolStripMenuItem();
tobase64 = new ToolStripMenuItem();
tolink = new ToolStripMenuItem();
exit.Text = "Quitter";
exit.Image = ScreenShot.Properties.Resources.close.ToBitmap();
exit.BackColor = c;
exit.Click += (ob, ev) =>
{
m.Close();
};
help.Text = "Aide";
help.Image = ScreenShot.Properties.Resources.help.ToBitmap();
help.BackColor = c;
help.Click += (ob, ev) =>
{
Alert(("-" + CONFIG.XML.PRINT_SCREEN.Key + "+" + CONFIG.XML.PRINT_SCREEN.Modifiers + " : Transforme en lien l'écran actif.\n" +
"-" + CONFIG.XML.PRINT_WINDOW.Key + "+" + CONFIG.XML.PRINT_WINDOW.Modifiers + " : Transforme en lien la fenêtre active.\n" +
"-" + CONFIG.XML.PRINT_FILE.Key + "+" + CONFIG.XML.PRINT_FILE.Modifiers + " : Transforme en lien le presse-papier.\n" +
"-" + CONFIG.XML.PRINT_CROP.Key + "+" + CONFIG.XML.PRINT_CROP.Modifiers + " : Ouvre la fenêtre de découpage.\n")
.Replace("Control", "Ctrl").Replace("+None", ""), "Raccourcis", ToolTipIcon.Info, 20000);
};
settings.Text = "Options";
settings.Image = ScreenShot.Properties.Resources.settings.ToBitmap();
settings.BackColor = c;
settings.Click += (ob, ev) =>
{
if (op == null || op.IsDisposed)
{
op = new Options(m);
op.ShowDialog();
op.Dispose();
}
};
tobase64.Text = "Transformer en texte";
tobase64.Image = ScreenShot.Properties.Resources.tobase64.ToBitmap();
tobase64.BackColor = c;
tobase64.Click += (ob, ev) =>
{
m.GetBase64();
};
tolink.Text = "Tranformer en lien";
tolink.Image = ScreenShot.Properties.Resources.tolink.ToBitmap();
tolink.BackColor = c;
tolink.Click += (ob, ev) =>
{
m.Load_Clipboard();
};
menu.Items.Add(tolink);
menu.Items.Add(tobase64);
menu.Items.Add(new ToolStripSeparator());
menu.Items.Add(settings);
menu.Items.Add(help);
menu.Items.Add(new ToolStripSeparator());
menu.Items.Add(exit);
components.Add(menu);
nIcon = new System.Windows.Forms.NotifyIcon(components);
nIcon.Icon = ScreenShot.Properties.Resources.connection;
nIcon.Text = "Connexion au serveur..";
nIcon.ContextMenuStrip = menu;
nIcon.Visible = true;
nIcon.MouseDoubleClick += (ob, ev) =>
{
settings.PerformClick();
};
}
示例6: frmMain
public frmMain()
{
InitializeComponent();
var rijndaelEngineControl = new RijndaelEngineControl();
var rijndaelEngineControlMenu = new ToolStripMenuItem(rijndaelEngineControl.DisplayName)
{
Tag = rijndaelEngineControl
};
rijndaelEngineControlMenu.Click += MenuClick;
configurationToolStripMenuItem.DropDownItems.Add(rijndaelEngineControlMenu);
#if !NET20
var aesEngineControl = new AesEngineControl();
var aesEngineControlMenu = new ToolStripMenuItem(aesEngineControl.DisplayName)
{
Tag = aesEngineControl
};
aesEngineControlMenu.Click += MenuClick;
configurationToolStripMenuItem.DropDownItems.Add(aesEngineControlMenu);
#endif
var tripleDESEngineControl = new TripleDESEngineControl();
var tripleDESEngineControlMenu = new ToolStripMenuItem(tripleDESEngineControl.DisplayName)
{
Tag = tripleDESEngineControl
};
tripleDESEngineControlMenu.Click += MenuClick;
configurationToolStripMenuItem.DropDownItems.Add(tripleDESEngineControlMenu);
var desEngineControl = new DESEngineControl();
var desEngineControlMenu = new ToolStripMenuItem(desEngineControl.DisplayName)
{
Tag = desEngineControl
};
desEngineControlMenu.Click += MenuClick;
configurationToolStripMenuItem.DropDownItems.Add(desEngineControlMenu);
var rc2EngineControl = new RC2EngineControl();
var rc2EngineControlMenu = new ToolStripMenuItem(rc2EngineControl.DisplayName)
{
Tag = rc2EngineControl
};
rc2EngineControlMenu.Click += MenuClick;
configurationToolStripMenuItem.DropDownItems.Add(rc2EngineControlMenu);
var dpapiEngineControl = new DPAPIEngineControl();
var dpapiEngineControlMenu = new ToolStripMenuItem(dpapiEngineControl.DisplayName)
{
Tag = dpapiEngineControl
};
dpapiEngineControlMenu.Click += MenuClick;
configurationToolStripMenuItem.DropDownItems.Add(dpapiEngineControlMenu);
var hashingControl = new HashingControl();
var hashingControlMenu = new ToolStripMenuItem(hashingControl.DisplayName)
{
Tag = hashingControl
};
hashingControlMenu.Click += MenuClick;
configurationToolStripMenuItem.DropDownItems.Add(hashingControlMenu);
rijndaelEngineControlMenu.PerformClick();
}
示例7: Main
//.........这里部分代码省略.........
command.LostFocus += (ob, ev) =>
{
if (command.Text == "")
command.Text = "Commande ici";
command.ForeColor = Color.Gray;
};
command.KeyDown += (ob, ev) =>
{
if (ev.KeyCode == Keys.Enter)
{
Utility.Sendkeys.Send(Server.Handle, command.Text + "~");
command.Clear();
ev.Handled = ev.SuppressKeyPress = true;
}
};
executer.Text = "Exécuter";
executer.BackColor = c;
executer.Image = ServerManager.Properties.Resources.execute;
executer.DropDown.Items.Add(command);
isvisible.Text = "Visibilité";
isvisible.BackColor = c;
isvisible.Image = ServerManager.Properties.Resources.invisible;
isvisible.Click += (ob, ev) =>
{
isvisible.Image = Utility.View.ChangeVisibility(Server.Handle) ? ServerManager.Properties.Resources.visible : ServerManager.Properties.Resources.invisible;
};
information.Text = "Informations";
information.BackColor = c;
information.Image = ServerManager.Properties.Resources.information;
information.Click += (ob, ev) =>
{
if (Server.IsReady && info != "" && title != "")
MessageBox.Show(this, info, title, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
};
quitter.Text = "Quitter";
quitter.BackColor = c;
quitter.Image = ServerManager.Properties.Resources.exit;
quitter.Click += (ob, ev) =>
{
if (!Server.IsAlive)
Dispose();
else
{
DialogResult dr = MessageBox.Show("Voulez-vous arrêter le server en même temps?", "Confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
if (dr == DialogResult.Yes)
{
if (Server.IsReady)
arreter.PerformClick();
Server.Stop();
Dispose();
}
else if (dr == DialogResult.No)
Dispose();
else if (dr == DialogResult.Cancel)
return;
Server.Stats.Save();
}
Program.Config.Save();
Environment.Exit(0);
};
menu.Items.Add(demarrer);
menu.Items.Add(arreter);
menu.Items.Add(new ToolStripSeparator());
menu.Items.Add(options);
menu.Items.Add(new ToolStripSeparator());
menu.Items.Add(executer);
menu.Items.Add(isvisible);
menu.Items.Add(information);
menu.Items.Add(new ToolStripSeparator());
menu.Items.Add(quitter);
foreach (ToolStripItem tsi in menu.Items)
tsi.Enabled = false;
demarrer.Enabled = true;
options.Enabled = true;
quitter.Enabled = true;
notifyIcon.DoubleClick += (ob, ev) =>
{
if (!Server.IsAlive && title == "" && info == "")
Server.Start();
else
isvisible.PerformClick();
};
t = new Thread(RefreshValues);
this.Load += (ob, ev) => { t.Start(); };
notifyIcon.Icon = disconnected;
notifyIcon.ContextMenuStrip = menu;
notifyIcon.Text = "ServerManager :: " + Path.GetFileName(Program.Config.Path);
notifyIcon.Visible = true;
}
示例8: RefreshConnectionsList
private void RefreshConnectionsList()
{
this.tsDatabase.DropDownItems.Clear();
foreach (ConnectionStringSettings settings in ConnectionsConfigurator.GetLocalConnections())
{
System.Windows.Forms.ToolStripMenuItem item = new System.Windows.Forms.ToolStripMenuItem(settings.get_Name(), AIS.SN.UI.Properties.Resources.database.ToBitmap(), new System.EventHandler(this.dbItem_Click));
this.tsDatabase.DropDownItems.Add(item);
if (settings.get_Name() == Settings.Default.LoginFormDataSource)
{
item.PerformClick();
}
}
bool flag = (bool) (this.tsDatabase.DropDownItems.get_Count() > 0);
this.tsStart.set_Enabled(flag);
this.tsiChangePwd.set_Enabled(flag);
if (!flag)
{
this.tsDatabase.set_Text(DatabaseNotChosen);
}
else
{
bool flag2 = false;
foreach (System.Windows.Forms.ToolStripMenuItem item2 in this.tsDatabase.DropDownItems)
{
if (item2.get_Checked())
{
flag2 = true;
break;
}
}
if (!flag2)
{
this.tsDatabase.DropDownItems.get_Item(0).PerformClick();
}
this.tsDatabase.DropDownItems.Add(new System.Windows.Forms.ToolStripSeparator());
}
this.tsDatabase.DropDownItems.Add(this.tsiSettings);
this.tsDatabase.DropDownItems.Add(this.tsiChangePwd);
}