protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); LinkLineNode nodeTest = HitTest(e.X, e.Y); if (nodeTest != null) { this.Cursor = Cursors.Hand; nodeTest.SelectLine(true); } else { this.Cursor = Cursors.Default; } if (!bMouseIn) { bMouseIn = true; for (int i = 0; i < Controls.Count; i++) { ActiveDrawing ad = Controls[i] as ActiveDrawing; if (ad != null) { ad.FireOnLeave(e); } } } }
protected override void OnMouseMove(MouseEventArgs e) { if (!bMouseEnter) { bMouseEnter = true; if (this.Parent != null) { for (int i = 0; i < this.Parent.Controls.Count; i++) { ActiveDrawing ad = this.Parent.Controls[i] as ActiveDrawing; if (ad != null && ad != this) { ad.FireOnLeave(EventArgs.Empty); } } } Diagram dg = this.Parent as Diagram; if (dg != null) { dg.OnChildActiveDrawingMouseEnter(this); } OnEnter(EventArgs.Empty); } const int MARGIN_D = 2; if (this.Parent != null && (e.Button & MouseButtons.Left) == MouseButtons.Left && bMD) { int offsetX = 0; int offsetY = 0; bool b = false; if (!this.Capture) { this.Capture = true; } int x = this.Left + e.X - x0; int xd = this.Left; int yd = this.Top; Point p0 = this.Parent.PointToClient(this.PointToScreen(e.Location)); if (p0.X > MARGIN_D && p0.X < this.Parent.ClientSize.Width - MARGIN_D) { xd = x; b = true; } int y = this.Top + e.Y - y0; if (p0.Y > MARGIN_D && p0.Y < this.Parent.ClientSize.Height - MARGIN_D) { yd = y; b = true; } if (b) { this.Location = new Point(xd - offsetX, yd - offsetY); RefreshParent(); } } }