读书人

这个程序输出如何和想的不一样

发布时间: 2012-09-23 10:28:11 作者: rapoo

这个程序输出怎么和想的不一样
程序是C#入门经典上的例子程序.创建一个winform程序代码是

C# code
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Ch08Ex01{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        private void button1_Click(object sender, EventArgs e)        {            ((Button)sender).Text = "Clicked!";            Button newButton = new Button();            newButton.Text = "New Button!";            newButton.Click += new EventHandler(newButton_Click);            Controls.Add(newButton);        }        private void newButton_Click(object sender, System.EventArgs e)        {            ((Button)sender).Text = "Clicked!!";        }    }}

为什么最后输出的时候,右上角本应该显示New Button后来只显示了一个New呢?


[解决办法]
哈哈,宽度太窄挡住了吧。。。C#的帖子怎么跑C++来了

读书人网 >C++

热点推荐