WinForm sender初级应用

            //sender 代表的是触发的这个控件的玩意,谁触发的,就是谁
            //这里是如果触发这个控件的是button类型
            if (sender is Button)
            {
                //把触发这个控件的玩意变成button类型
                Button b = sender as Button;
               // 文本框展示的内容就是button的text
                textBox1.Text = b.Text;
            }
            //计算器可以应用这个方法,还有其他多方面可以应用,感觉挺有意思

 

posted on 2017-05-03 20:56  张鑫4477  阅读(353)  评论(0)    收藏  举报