public void OnMouseDown(object sender, MouseEventArgs e) { if (!Locked && !isDragging) { // If we have a draggable region defined, start dragging only if we're inside the region. if (DraggableRegion == null || DraggableRegion.IsVisible(e.Location)) { isDragging = true; hasDragged = false; offset = e.Location; } } SendMouseUpDown(e.X, e.Y, GetMouseButtonType(e), false); }
private bool ContainsPoint(DraggableRegion region, Point point) { return(point.X >= region.X && point.X <= (region.X + region.Width) && point.Y >= region.Y && point.Y <= (region.Y + region.Height)); }