本文整理汇总了C#中System.Windows.Forms.ToolStripLabel.PerformClick方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStripLabel.PerformClick方法的具体用法?C# ToolStripLabel.PerformClick怎么用?C# ToolStripLabel.PerformClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ToolStripLabel
的用法示例。
在下文中一共展示了ToolStripLabel.PerformClick方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InvokedEventTest
public void InvokedEventTest ()
{
ToolStripLabel menuItem = new ToolStripLabel ();
menuItem.IsLink = true;
IRawElementProviderSimple provider = ProviderFactory.GetProvider (menuItem);
bridge.ResetEventLists ();
menuItem.PerformClick ();
Assert.AreEqual (1,
bridge.AutomationEvents.Count,
"event count");
AutomationEventTuple eventInfo =
bridge.AutomationEvents [0];
Assert.AreEqual (InvokePatternIdentifiers.InvokedEvent,
eventInfo.eventId,
"event type");
Assert.AreEqual (provider,
eventInfo.provider,
"event element");
Assert.AreEqual (InvokePatternIdentifiers.InvokedEvent,
eventInfo.e.EventId,
"event args event type");
}
示例2: Constructor
public void Constructor ()
{
ToolStripLabel tsi = new ToolStripLabel ();
Assert.AreEqual (Color.Red, tsi.ActiveLinkColor, "A1");
Assert.AreEqual (false, tsi.CanSelect, "A2");
Assert.AreEqual (false, tsi.IsLink, "A3");
Assert.AreEqual (LinkBehavior.SystemDefault, tsi.LinkBehavior, "A4");
Assert.AreEqual (Color.FromArgb (0,0,255), tsi.LinkColor, "A5");
Assert.AreEqual (false, tsi.LinkVisited, "A6");
Assert.AreEqual (Color.FromArgb (128, 0, 128), tsi.VisitedLinkColor, "A7");
int count = 0;
EventHandler oc = new EventHandler (delegate (object sender, EventArgs e) { count++; });
Image i = new Bitmap (1,1);
tsi = new ToolStripLabel (i);
tsi.PerformClick();
Assert.AreEqual (null, tsi.Text, "A8");
Assert.AreSame (i, tsi.Image, "A9");
Assert.AreEqual (false, tsi.IsLink, "A10");
Assert.AreEqual (0, count, "A11");
Assert.AreEqual (string.Empty, tsi.Name, "A12");
tsi = new ToolStripLabel ("Text");
tsi.PerformClick ();
Assert.AreEqual ("Text", tsi.Text, "A13");
Assert.AreSame (null, tsi.Image, "A14");
Assert.AreEqual (false, tsi.IsLink, "A15");
Assert.AreEqual (0, count, "A16");
Assert.AreEqual (string.Empty, tsi.Name, "A17");
tsi = new ToolStripLabel ("Text", i);
tsi.PerformClick ();
Assert.AreEqual ("Text", tsi.Text, "A18");
Assert.AreSame (i, tsi.Image, "A19");
Assert.AreEqual (false, tsi.IsLink, "A20");
Assert.AreEqual (0, count, "A21");
Assert.AreEqual (string.Empty, tsi.Name, "A22");
tsi = new ToolStripLabel ("Text", i, true);
tsi.PerformClick ();
Assert.AreEqual ("Text", tsi.Text, "A23");
Assert.AreSame (i, tsi.Image, "A24");
Assert.AreEqual (true, tsi.IsLink, "A25");
Assert.AreEqual (0, count, "A26");
Assert.AreEqual (string.Empty, tsi.Name, "A27");
tsi = new ToolStripLabel ("Text", i, true, oc);
tsi.PerformClick ();
Assert.AreEqual ("Text", tsi.Text, "A28");
Assert.AreSame (i, tsi.Image, "A29");
Assert.AreEqual (true, tsi.IsLink, "A30");
Assert.AreEqual (1, count, "A31");
Assert.AreEqual (string.Empty, tsi.Name, "A32");
tsi = new ToolStripLabel ("Text", i, true, oc, "Name");
tsi.PerformClick ();
Assert.AreEqual ("Text", tsi.Text, "A33");
Assert.AreSame (i, tsi.Image, "A34");
Assert.AreEqual (true, tsi.IsLink, "A35");
Assert.AreEqual (2, count, "A36");
Assert.AreEqual ("Name", tsi.Name, "A37");
}