您的位置:首页 > 其它

无标题栏窗体拖动

2011-11-28 15:25 113 查看
/// <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;

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: