C#无边框窗体被控件覆盖后编写代码怎么拖动不了窗体
展开全部
问题没有描述清楚,也许大概可能是你自定义拖动的方法没写好,我这正好有一个实例:
#region 拖动窗口
private Point offset;
private void panelBG_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point cur = MousePosition;
offset = new Point(cur.X - this.Left, cur.Y - this.Top);
}
}
private void panelBG_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point cur = MousePosition;
this.Location = new Point(cur.X - offset.X, cur.Y - offset.Y);
}
}
#region 拖动窗口
private Point offset;
private void panelBG_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point cur = MousePosition;
offset = new Point(cur.X - this.Left, cur.Y - this.Top);
}
}
private void panelBG_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point cur = MousePosition;
this.Location = new Point(cur.X - offset.X, cur.Y - offset.Y);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询