/// <summary> /// Handles the <see cref="Rectangle.MouseDown"/> event of the color surface. /// </summary> /// <param name="sender">The object where the event handler is attached.</param> /// <param name="e">The event data.</param> private void OnColorPickerRenderSurfaceMouseDown(object sender, [NotNull] MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { colorPickerRenderSurface.CaptureMouse(); suspendBindingUpdates = true; UpdateColorPickerFromMouse(e.GetPosition(colorPickerRenderSurface)); } }
/// <summary> /// 鼠标按下 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ContentControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Rectangle rectangle = sender as Rectangle; if (rectangle == null) { return; } rectangle.CaptureMouse(); m_IsMouseLeftButtonDown = true; m_PreviousMousePoint = e.GetPosition(rectangle); }