My custom title bar as follows (the blue part, is a Panel control):
Implementation dragging the title bar of the window moves with it - adding Form.cs in:
public BaseForm_hasBar_large() { InitializeComponent(); this.TopBar.MouseDown += TopBar_MouseDown; this.TopBar.MouseMove += TopBar_MouseMove; } #region 点击panel控件移动窗口 private Point downPoint; private void TopBar_MouseDown(object sender, MouseEventArgs e) { //MessageBox.Show("Left"); downPoint = new Point(e.X, e.Y); } private void TopBar_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.Location = new Point(this.Location.X + e.X - downPoint.X, this.Location.Y + e.Y - downPoint.Y); } } #endregion