/// <summary>
/// 无标题栏窗体拖动实现
/// </summary>
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wparam, int lparam);
protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
{
base.OnMouseDown(e);
if (e.Button == MouseButtons.Left)//按下的是鼠标左键
{
Capture = false;//释放鼠标使能够手动操作
SendMessage(Handle, 0x00A1, 2, 0);//拖动窗体
}
}
/// <summary>
/// 最小化不可
/// </summary>
private void Metre_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.WindowState = FormWindowState.Normal;
TopMost = true;
}
}