private void ColorPickerBoxOnMouseUp(object sender, MouseEventArgs e) { int column = e.X / _cellW; int row = e.Y / _cellH; var selectedIndex = row * _columns + column; ColorSelected?.Invoke(this, new ColorSelectedEventArgs(_layer, _colorPickerBox.Hues, selectedIndex)); }
public void PickColor(Color color) { if (color != ActiveColor) { ActiveColor = color; ColorSelected?.Invoke(ActiveColor); } }
private void _colorPicker_MouseMove(object sender, Input.MouseEventArgs e) { int column = e.X / _cellW; int row = e.Y / _cellH; var selectedIndex = row * _columns + column; ColorSelected?.Invoke(this, new ColorSelectedEventArgs(_layer, _colorPickerBox.GeneratedHues, selectedIndex)); }
private void ColorPickerBoxOnMouseUp(object sender, MouseEventArgs e) { int column = e.X / _cellW; int row = e.Y / _cellH; int selectedIndex = row * _columns + column; if (selectedIndex >= 0 && selectedIndex < _colorPickerBox.Hues.Length) { ColorSelected?.Invoke(this, new ColorSelectedEventArgs(_layer, _colorPickerBox.Hues, selectedIndex)); SetCurrentHue(); } }
private void ColorKey_Selected(object sender, EventArgs args) { foreach (ColorKey key in colorKeys) { if (key != sender) { key.Deselect(); } } ColorSelected?.Invoke(this, null); }
private void ColorPanelSelected(object sender, EventArgs e) { ColorSelected?.Invoke(this, e); }
private void ColorPickerBoxOnColorSelectedIndex(object sender, EventArgs e) { ColorSelected?.Invoke(this, new ColorSelectedEventArgs(_layer, _colorPickerBox.Hues, _colorPickerBox.SelectedIndex)); }
public void OnColorSelected() { ColorSelected?.Invoke(new UISelectedValuesEventArgs(t_selectedColor)); }
private UIElement GenerateItem(int row, int column, Color color, int index) { var rectangle = new Rectangle(); rectangle.Fill = new SolidColorBrush(color); if (Size.GridUnitType == GridUnitType.Pixel) { rectangle.Height = Size.Value; rectangle.Width = Size.Value; } else { rectangle.Height = 16; rectangle.Width = 16; } var border = new Border(); border.Margin = ColorPadding; border.BorderThickness = new Thickness(1); border.BorderBrush = new SolidColorBrush(SWM.Colors.Black); border.Width = rectangle.Width; border.Height = rectangle.Height; border.Child = rectangle; var focusBorder = new FocusableBorder(); focusBorder.Child = border; focusBorder.Focusable = true; focusBorder.Padding = new Thickness(1); var dashBorderBrush = new VisualBrush(); var dashVisual = new Rectangle(); dashVisual.StrokeDashArray = new DoubleCollection(new double[] { 4, 2 }); dashVisual.Stroke = new SolidColorBrush(SWM.Colors.Gray); dashVisual.StrokeThickness = 1; dashBorderBrush.Visual = dashVisual; focusBorder.GotFocus += (s, a) => focusBorder.BorderBrush = dashBorderBrush; focusBorder.LostFocus += (s, a) => focusBorder.BorderBrush = new SolidColorBrush(SWM.Colors.Transparent); focusBorder.BorderBrush = new SolidColorBrush(SWM.Colors.Transparent); AutomationProperties.SetHelpText(focusBorder, GetColorHelpText(color)); focusBorder.MouseDown += (s, a) => ColorSelected?.Invoke(this, new ColorPalleteSelectedArgs(color, index)); focusBorder.KeyDown += (s, a) => { if (a.Key == System.Windows.Input.Key.Enter) { ColorSelected?.Invoke(this, new ColorPalleteSelectedArgs(color, index)); } }; Grid.SetColumn(focusBorder, column); Grid.SetRow(focusBorder, row); return(focusBorder); }
protected virtual void OnColorSelected(Color color) { ColorSelected?.Invoke(color); }
void InvokeColorSelected(ColorSource color) { ColorSelected?.Invoke(this, color); }
protected virtual void OnColorSelected(ColorSelectionEventArgs e) { // If the event has been fired, invoke the event with the // arguments. ColorSelected?.Invoke(this, e); }