读书人

把窗体放到任务栏中的代码出现错误

发布时间: 2014-01-28 21:16:26 作者: rapoo

把窗体放到任务栏中的代码出现错误:

1. 控件:notifyIcon
在类中定义const int WM_SYSCOMMAND = 0x0112;
复制下列代码到你的类中
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_SYSCOMMAND && (int)m.WParam == SC_CLOSE)
{
this.notifyIcon1.Visible = true;
this.Visible = false;
return;
}
base.WndProc(ref m);
}

到底怎么做呢
我把它复制过去好像不对呢

------解决方法--------------------------------------------------------
public const int SC_CLOSE = 0xF060;
把这个加上

        

读书人网 >.NET

热点推荐