Preventing borderless form from going under task bar

  • Thread starter Thread starter xanrer
  • Start date Start date
X

xanrer

Guest
So i have a borderless form and i can move it with these lines:

int movX, movY;
bool mov;

private void UpperPanel_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (mov == true) this.SetDesktopLocation(MousePosition.X - movX, MousePosition.Y - movY);
}

}

private void UpperPanel_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
mov = false;
}

}

private void UpperPanel_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
mov = true;
movX = e.X;
movY = e.Y;
}

}

But when i go under the task bar it gets down and if i release it becomes impossible to reach, is there a way to prevent that like windows forms normally does?

Continue reading...
 
Back
Top