首页 > 代码库 > windows无边框窗体移动设置

windows无边框窗体移动设置

 int cx;         int cy;     

  private void btnClose_Click(object sender, EventArgs e)      

   {             this.Close();         }            

   private void btnClose_MouseLeave(object sender, EventArgs e)        

{             btnClose.BackColor = Color.Transparent;         }

   private void btnClose_MouseMove(object sender, MouseEventArgs e)        

{             btnClose.BackColor = Color.Red;         }

  private void panel1_MouseDown(object sender, MouseEventArgs e)        

{             if (e.Button == MouseButtons.Left)            

         {                 cx = e.X;             

                             cy = e.Y;        

         }       

  }

   private void panel1_MouseMove(object sender, MouseEventArgs e)        

{             if (e.Button == MouseButtons.Left)            

               {             this.Left += e.X - cx;             

                              this.Top += e.Y - cy;           

                }        

}