本文整理汇总了C#中System.Windows.Forms.ToolStripButton.PerformClick方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStripButton.PerformClick方法的具体用法?C# ToolStripButton.PerformClick怎么用?C# ToolStripButton.PerformClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ToolStripButton
的用法示例。
在下文中一共展示了ToolStripButton.PerformClick方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Constructor
public void Constructor ()
{
ToolStripButton tsi = new ToolStripButton ();
Assert.AreEqual (true, tsi.AutoToolTip, "A1");
Assert.AreEqual (true, tsi.CanSelect, "A2");
Assert.AreEqual (false, tsi.Checked, "A3");
Assert.AreEqual (false, tsi.CheckOnClick, "A4");
Assert.AreEqual (CheckState.Unchecked, tsi.CheckState, "A5");
int count = 0;
EventHandler oc = new EventHandler (delegate (object sender, EventArgs e) { count++; });
Image i = new Bitmap (1,1);
tsi = new ToolStripButton (i);
tsi.PerformClick();
Assert.AreEqual (null, tsi.Text, "A6");
Assert.AreSame (i, tsi.Image, "A7");
Assert.AreEqual (0, count, "A8");
Assert.AreEqual (string.Empty, tsi.Name, "A9");
tsi = new ToolStripButton ("Text");
tsi.PerformClick ();
Assert.AreEqual ("Text", tsi.Text, "A10");
Assert.AreSame (null, tsi.Image, "A11");
Assert.AreEqual (0, count, "A12");
Assert.AreEqual (string.Empty, tsi.Name, "A13");
tsi = new ToolStripButton ("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 ToolStripButton ("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 ToolStripButton ("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");
}