// Show static public void Show(Point location, Size size) { // Create a new object? if (shaDow == null) { shaDow = new ShaDowControl(); shaDow.Show(); // Just to get the size correct at first use (.NET bug?). Try to remove this line... } // Set the location and size, then show the form shaDow.Location = location; shaDow.Size = size; shaDow.Show(); }
// Handle mouse down; Start check for "mouse up" or "mouse leave parent container" protected override void OnMouseDown(MouseEventArgs mouseEventArgs) { this.onSelectDragEvent(this.Name); // Continue? if (mouseEventArgs.Button != MouseButtons.Left) { return; } // Save coordinates for later use (at "mouse up" or "drop") startPoint = new Point(mouseEventArgs.X, mouseEventArgs.Y); this.IsFirstClickDrag = true; // Show the outline object ShaDowControl.Show(this.PointToScreen(new Point(mouseEventArgs.X - startPoint.X - 2, mouseEventArgs.Y - startPoint.Y - 2)), this.Size); // Register the mouse move handler this.MouseMove -= new MouseEventHandler(DragItem_MouseMove); this.MouseMove += new MouseEventHandler(DragItem_MouseMove); base.OnMouseDown(mouseEventArgs); }