using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp5
{
public partial class Form1 : Form
{
private int nCounter;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.nCounter = 50;
this.ShowCounter();
}
private void btnInc_Click(object sender, EventArgs e)
{
this.nCounter++;
this.ShowCounter();
}
private void btnDes_Click(object sender, EventArgs e)
{
this.nCounter--;
this.ShowCounter();
}
private void btnMsg_Click(object sender, EventArgs e)
{
string strMsg = "当前计数器=" + this.nCounter.ToString("D8");
MessageBox.Show(strMsg, "提示");
}
private void ShowCounter()
{
string strMsg = "当前计数器=" + this.nCounter.ToString("D8");
this.lblResult.Text = strMsg;
}
}
照着书敲的代码,为什么不显示窗体