C# Winform無(wú)邊框窗體實(shí)現(xiàn)界面拖動(dòng)文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-731244.html
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
public const int VM_NCLBUTTONDOWN = 0xA1; // 定義鼠標(biāo)左鍵按下
public const int HTCAPTION = 2;
//調(diào)用方法
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
// 為當(dāng)前應(yīng)用程序釋放鼠標(biāo)捕獲
ReleaseCapture();
// 發(fā)送消息 讓系統(tǒng)誤以為在標(biāo)題欄上按下鼠標(biāo)
SendMessage((IntPtr)this.Handle, VM_NCLBUTTONDOWN, HTCAPTION, 0);
}
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-731244.html
到了這里,關(guān)于C# Winform無(wú)邊框窗體實(shí)現(xiàn)界面拖動(dòng)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!