错误 1 找不到类型或命名空间名称“Form1”(是否缺少 using 指令或程序集引用?)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowFormsApplication1
{
public partial class Form1 : Form
{
private string struser = "";
public string user { get { return struser; } set { struser = value; } }
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{ tsslUser.Text = "当前用户:" + user; }
private void timer1_Tick(object sender, EventArgs e)
{
time.Text = "当前时间:" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" +
DateTime.Now.Day + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" +
DateTime.Now.Second;
}
private void Form1Main_FormClosing(object sender, FormClosingEventArgs e)
{
if (MessageBox.Show("您是否真的退出系统", "提示", MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.Yes)
{ System.Environment.Exit(0); }
else
{
e.Cancel = true;
}
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Escape:
if (MessageBox.Show("您是否真的退出系统", "提示", MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.Yes) { System.Environment.Exit(0); } break;
}
}
}
}