日期:2014-05-17 浏览次数:20905 次
//frmmodily 窗体 public partial class frmmodily : Form { //静态变量 static bool btvs; //将aboutbox传的值赋给静态变量btvs public bool Btvs { get { return btvs; } set { btvs = value; } } //静态变量,只是为了标识是否触发了aboutbox的logoPictureBox_Click事件 static bool pcclick; public bool Pcclick { get { return pcclick; } set { pcclick = value; } } public frmmodily() { InitializeComponent(); } private void frmmodily_MouseMove(object sender, MouseEventArgs e) { //触发,执行一次 if (pcclick == true) { //为按钮的Visible赋值 button1.Visible = btvs; pcclick = false; } } /// <summary> /// 为了区分下button1.Visible值已经改变 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmmodily_Load(object sender, EventArgs e) { button1.Visible = false; } } //aboutbox 窗体 public partial class aboutbox : Form { public aboutbox() { InitializeComponent(); } /// <summary> /// 弹出frmmodily窗体 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { frmmodily fd = new frmmodily(); fd.Show(); } /// <summary> /// 为frmmodily窗体上的公开变量Btvs赋值,同时修改触发属性 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void logoPictureBox_Click(object sender, EventArgs e) { frmmodily fd = new frmmodily(); fd.Btvs = true; fd.Pcclick = true; } }