模擬標題欄,移動或雙擊可以最大或最小化窗體

internal static int WM_NCHITTEST = 0x84; //移動鼠標,按住或釋放鼠標時發生的系統消息
internal static IntPtr HTCLIENT = (IntPtr)0x1;//工作區
internal static IntPtr HTCAPTION = (IntPtr)0x2; //標題欄
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_NCHITTEST)
{
base.WndProc(ref m);
if (m.Result == HTCLIENT)
{
m.Result = HTCAPTION;//模擬標題欄,移動或雙擊可以最大或最小化窗體
}
}
else
{
base.WndProc(ref m);
}
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章