How can i make a borderless form fullscreen by dragging it to top?

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

xanrer

Guest
First i used mouse_up event with `e.Y` but shortly i realized that's not keeping the mouse location from screens 0,0 point but events own 0,0 point, how can i do this?

This is the code i use for dragging (may be needed for editing):

int movX, movY;
bool mov;

private void UpperPanel_MouseClick(object sender, MouseEventArgs e)
{
formLoc = this.Location;
}

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;
}
}

Continue reading...
 
Back
Top