当前位置: 首页>>代码示例>>C#>>正文


C# ToolStripButton.PerformClick方法代码示例

本文整理汇总了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");
        }
开发者ID:nlhepler,项目名称:mono,代码行数:49,代码来源:ToolStripButtonTest.cs


注:本文中的System.Windows.Forms.ToolStripButton.PerformClick方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。