1 private bool _mouseDown;
2 private bool _busy;
3 private int _downX;
4 private int _downY;
5
6 private void lblTitle_MouseDown(object sender, MouseEventArgs e)
7 {
8 if (e.Button==MouseButtons.Left)
9 {
10 if (!this._busy)
11 {
12 try
13 {
14 this._busy = true;
15 this._mouseDown = true;
16
17 this._downX = e.X;
18 this._downY = e.Y;
19 }
20 catch (Exception)
21 {
22 throw;
23 }
24 finally
25 {
26 _busy = false;
27 }
28
29 }
30
31 }
32
33 }
34 private void lblTitle_MouseEnter(object sender, EventArgs e)
35 {
36 this._mouseDown = false;
37 }
38 private void lblTitle_MouseLeave(object sender, EventArgs e)
39 {
40 this._mouseDown = false;
41 }
42 private void lblTitle_MouseMove(object sender, MouseEventArgs e)
43 {
44 if (this._mouseDown)
45 {
46 if (!_busy)
47 {
48 try
49 {
50 int offsetX = e.X - _downX;
51 int offsetY = e.Y - _downY;
52
53 this.Top += offsetY;
54 this.Left += offsetX;
55 }
56 catch
57 {
58 throw;
59 }
60 finally
61 {
62 this._busy = false;
63 }
64 }
65 }
66 }
67 private void lblTitle_MouseUp(object sender, MouseEventArgs e)
68 {
69 this._mouseDown = false;
70 this._busy = false;
71 }