尝试这个:
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var f = new Form1();
f.Mode = false;
Application.Run(f);
bool playerMode = f.Mode;
}
}
和:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public bool Mode = false;
private void button1_Click(object sender, EventArgs e)
{
this.Mode = true;
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
this.Mode = false;
this.Close();
}
}
这对我bool playerMode根据我单击的按钮进行设置很好用。
qq_遁去的一_1
相关分类