设置为none后窗体已经没有了标题栏,窗体的移动、最大化、最小化、关闭这些需要自己写代码来完成。
窗体的移动:
bool formMove = false;//窗体是否移动
Point formPoint;//记录窗体的位置
private void Form4_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 Form4_MouseMove(object sender, MouseEventArgs e)//鼠标移动
{
窗体的移动:
bool formMove = false;//窗体是否移动
Point formPoint;//记录窗体的位置
private void Form4_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 Form4_MouseMove(object sender, MouseEventArgs e)//鼠标移动
{