示例#1
0
        /// <summary>
        /// Performs a color pick at the specified image coordinates.
        /// If the coordinates at not within the image area, nothing is done
        /// </summary>
        /// <param name="point">The point ot color pick at</param>
        /// <param name="colorIndex">The color index to pick for</param>
        protected void ColorPickAtPoint(Point point, ColorIndex colorIndex)
        {
            if (!WithinBounds(point))
            {
                return;
            }

            ColorPicked?.Invoke(this, new PaintToolColorPickedEventArgs(point, colorIndex));
        }
        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var mouse        = MouseUtil.GetMousePosition();
            var compensatedX = mouse.X - SystemInformation.VirtualScreen.Left; // Compensate for potential negative position on multi-monitor
            var compensatedY = mouse.Y - SystemInformation.VirtualScreen.Top;  // Compensate for potential negative position on multi-monitor
            var rgb          = BitmapUtil.PixelToRgb(FreezeFrame.Instance.BitmapSource, compensatedX, compensatedY);

            _vm.RefreshFromRgb(rgb);
            ColorPicked?.Invoke(this, EventArgs.Empty);
            Close();
        }
示例#3
0
        private void PickColor(Color color)
        {
            currentColor = color;

            if (ColorPicked != null)
            {
                ColorPicked.Invoke(this, null);
            }

            Invalidate();
        }
示例#4
0
        private void PickColor(Color color)
        {
            selectedColorIndex = hoverColorIndex;
            currentColor       = color;

            if (ColorPicked != null)
            {
                ColorPicked.Invoke(this, null);
            }

            Invalidate();
        }
示例#5
0
        void dropPanel_ColorPicked(object sender, EventArgs e)
        {
            currentColor = dropPanel.CurrentColor;
            dropPanel.Hide();

            SolidColorPickerPanel.AddRecentColor(currentColor);

            if (ColorPicked != null)
            {
                ColorPicked.Invoke(this, new EventArgs());
            }
        }
示例#6
0
 private void Grid_PointerReleased(object sender, PointerRoutedEventArgs e)
 {
     if (isDragging)
     {
         isDragging = false;
         var element = sender as FrameworkElement;
         var hs      = GetHS(e.GetCurrentPoint(element).Position);
         Hue        = hs.Hue;
         Saturation = hs.Saturation;
         ColorPicked?.Invoke(this, new HS()
         {
             Hue = hs.Hue, Saturation = hs.Saturation
         });
     }
 }
示例#7
0
        void dropPanel_ColorPicked(object sender, EventArgs e)
        {
            currentColor = dropPanel.CurrentColor;

            //if (currentColor is SolidColor)
            //{
            //	dropPanel.Visible = false;
            //}

            Invalidate();

            if (ColorPicked != null)
            {
                ColorPicked.Invoke(this, new EventArgs());
            }
        }
        void dropPanel_ColorPicked(object sender, EventArgs e)
        {
            currentColor = dropPanel.CurrentColor;

            if (CloseOnClick && currentColor is SolidColor)
            {
                dropPanel.Close(ToolStripDropDownCloseReason.ItemClicked);
            }

            Invalidate();

            if (currentColor is SolidColor)
            {
                SolidColorPickerPanel.AddRecentColor(((SolidColor)currentColor).Color);
            }

            if (ColorPicked != null)
            {
                ColorPicked.Invoke(this, new EventArgs());
            }
        }
示例#9
0
 void OnColorPicked()
 {
     ColorPicked?.Invoke(this, new EventArgs());
 }
示例#10
0
 private void OnColorPicked(Color color, bool isSystem)
 {
     ColorPicked?.Invoke(this, new ColorPickedEventArgs(color, isSystem));
 }