void OnBorderMouseLeave(object sender, MouseEventArgs e) { this.resizeOption = ResizeValues.NONE; Mouse.OverrideCursor = null; }
void OnBorderMouseMove(object sender, MouseEventArgs e) { if (!this.border.IsMouseCaptured) { if (this.border.IsMouseDirectlyOver && this.IsResizable && ExtensionSurface.GetMode(this) == ExtensionSurface.PlacementMode.Absolute) { Point position = e.GetPosition(this.border); if (position.X <= BorderOffset && position.Y <= BorderOffset) { this.resizeOption = ResizeValues.TopLeft; Mouse.OverrideCursor = Cursors.SizeNWSE; } else if (position.X >= this.border.ActualWidth - BorderOffset && position.Y <= BorderOffset) { this.resizeOption = ResizeValues.TopRight; Mouse.OverrideCursor = Cursors.SizeNESW; } else if (position.X <= BorderOffset && position.Y >= this.border.ActualHeight - BorderOffset) { this.resizeOption = ResizeValues.BottomLeft; Mouse.OverrideCursor = Cursors.SizeNESW; } else if (position.X >= this.border.ActualWidth - BorderOffset && position.Y >= this.border.ActualHeight - BorderOffset) { this.resizeOption = ResizeValues.BottomRight; Mouse.OverrideCursor = Cursors.SizeNWSE; } else if (position.Y <= (BorderOffset / 2.0)) { this.resizeOption = ResizeValues.Top; Mouse.OverrideCursor = Cursors.SizeNS; } else if (position.Y >= this.border.ActualHeight - (BorderOffset / 2.0)) { this.resizeOption = ResizeValues.Bottom; Mouse.OverrideCursor = Cursors.SizeNS; } else if (position.X <= (BorderOffset / 2.0)) { this.resizeOption = ResizeValues.Left; Mouse.OverrideCursor = Cursors.SizeWE; } else if (position.X >= this.border.ActualWidth - (BorderOffset / 2.0)) { this.resizeOption = ResizeValues.Right; Mouse.OverrideCursor = Cursors.SizeWE; } else { Mouse.OverrideCursor = null; this.resizeOption = ResizeValues.NONE; } Point topLeft = ExtensionSurface.GetPosition(this); this.bottomRight = new Point(topLeft.X + Width, topLeft.Y + Height); } else if (Mouse.OverrideCursor != null) { Mouse.OverrideCursor = null; this.resizeOption = ResizeValues.NONE; } } else if (e.LeftButton == MouseButtonState.Pressed) { this.HandleWindowResize(); } }