winform FormBordStyle=none 及 wpf FormBordStyle=none 的鼠标点击移动问题

winform:

//bool formMove = false;//窗体是否移动
//Point formPoint;//记录窗体的位置

private void Login_MouseDown(object sender, MouseEventArgs e)
{
//formPoint = new Point();

//int xOffset;
//int yOffset;
//if (e.Button == MouseButtons.Left)
//{
// xOffset = -e.X - SystemInformation.FrameBorderSize.Width;
// yOffset = -e.Y - SystemInformation.CaptionHeight - SystemInformation.FrameBorderSize.Height;
// formPoint = new Point(xOffset, yOffset);
// formMove = true;//开始移动
//}
}

private void Login_MouseMove(object sender, MouseEventArgs e)
{
//if (formMove == true)
//{
// Point mousePos = Control.MousePosition;
// mousePos.Offset(formPoint.X, formPoint.Y);
// Location = mousePos;
//}
}

private void Login_MouseUp(object sender, MouseEventArgs e)
{
//if (e.Button == MouseButtons.Left)//按下的是鼠标左键
//{
// formMove = false;//停止移动
//}
}

wpf的移动:

private void Login_MouseDown(object sender, MouseEventArgs e)
{
//if (e.LeftButton == MouseButtonState.Pressed)
//{
// DragMove();
//}

}

winform FormBordStyle=none 及 wpf FormBordStyle=none 的鼠标点击移动问题,布布扣,bubuko.com

winform FormBordStyle=none 及 wpf FormBordStyle=none 的鼠标点击移动问题

上一篇:自己动手写Android框架-数据库框架


下一篇:iOS ARC基本原理