当winfrom 的winfromborderstyle设置为none时,在任务上右键菜单就没有用了。这个时候需要重载winfrom中createparams来设置右键菜单,具体如下:
const int WS_CLIPCHILDREN = 0x2000000;
const int WS_MINIMIZEBOX = 0x20000;
const int WS_MAXIMIZEBOX = 0x10000;
const int WS_SYSMENU = 0x80000;
const int CS_DBLCLKS = 0x8;
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.Style = WS_CLIPCHILDREN | WS_MINIMIZEBOX | WS_SYSMENU;
cp.ClassStyle = CS_DBLCLKS;
return cp;
}
}
转至:http://hi.baidu.com/lihui183492761/blog/item/0cef3d63755ead6b0d33fa09.html