1.导入命名空间
using System.Runtime.InteropServices;
2.输入如下代码
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
private void pictureBox2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void pictureBox4_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
在窗体的MouseDown事件中编写如下代码
private void zcmmForm_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture(); SendMessage(Handle, 0xA1, 0x02, 0);
}
}
原文地址:https://www.cnblogs.com/-s11900085/p/8981609.html
时间: 2024-11-06 07:08:17