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 WindowsFormsApplication5 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public static int a = 10; private void button1_Click(object sender, EventArgs e) { a--; MessageBox.Show(a.ToString()); } } }
用一个成员变量ss: private int ss=10;按钮Click事件方法写: ss--;
namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private int ss = 10;// private void button1_Click(object sender, EventArgs e) { ss--; MessageBox.Show(ss.ToString()); } } } 第一次 9 点击第二次 8 以此递减
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public static int a = 10;
private void button1_Click(object sender, EventArgs e)
{
a--;
MessageBox.Show(a.ToString());
}
}
}
用一个成员变量ss:
private int ss=10;按钮Click事件方法写:
ss--;
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private int ss = 10;//
private void button1_Click(object sender, EventArgs e)
{
ss--;
MessageBox.Show(ss.ToString());
}
}
}
第一次 9 点击第二次 8 以此递减