最小化很简单,但show,windowstate,activate使用顺序将使界面无法正常显示.
share一下
HTTP://BLOG.youkuaiyun.com/CRABO/
#region Show/Hide
private void menuShowHideCrabo_Click(object sender, System.EventArgs e)
{
if(this.Visible)
{
this.Hide();
this.ShowInTaskbar=false;
}
else
{
this.ShowInTaskbar=true;
this.Show();
this.WindowState=FormWindowState.Normal;
this.Activate();
}
}
private void menuQuitCrabo_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
private void notifyIconCrabo_DoubleClick(object sender, System.EventArgs e)
{
if(this.Visible)
{
this.Hide();
this.ShowInTaskbar=false;
}
else
{
this.ShowInTaskbar=true;
this.Show();
this.WindowState=FormWindowState.Normal;
this.Activate();
}
}
private void PollFormCrabo_SizeChanged(object sender, System.EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Hide();
this.ShowInTaskbar=false;
}
}
#endregion
博客分享了C#中界面显示与隐藏的相关内容。指出最小化操作简单,但show、windowstate、activate的使用顺序会影响界面正常显示,并给出了界面显示、隐藏、退出以及最小化等操作的代码示例。
1113

被折叠的 条评论
为什么被折叠?



