您的位置:首页 > 其它

真正实现窗口最小化时自动最小化到托盘

2012-11-23 17:37 141 查看
#region 最小化到托盘

const int WM_SYSCOMMAND = 0x0112;

const int SC_MINIMIZE = 0xF020;//最小化

const int SC_MAXIMIZE = 0xF030;//最大化

const int SC_RESTORE = 0xF120;//还原时

protected override void WndProc(ref Message m)

{

base.WndProc(ref m);

if (m.Msg == WM_SYSCOMMAND)

{

int sc = m.WParam.ToInt32();

if (sc == SC_MINIMIZE)

{

this.Hide();

}

}

}

#endregion
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: