示例#1
0
 // show customColorDialog for custom color selector
 private void CustomColorClick(object sender, EventArgs e)
 {
     if (CustomColorDialog.ShowDialog() != DialogResult.Cancel)
     {
         pen.Color = CustomColorDialog.Color;
         SelectedColor.BackColor = CustomColorDialog.Color;
     }
 }
示例#2
0
        private void SelectFontColorExecute()
        {
            CustomColorDialog dialog = new CustomColorDialog();

            if (dialog.ShowDialog() == true)
            {
                CurrentItemInDesign.TextColor = dialog.Color;
            }
        }
示例#3
0
 protected override async void HandleEvent(MouseEventID id, Vector2 pos)
 {
     if (id == MouseEventID.LeftButtonDown)
     {
         var colorDialog = new CustomColorDialog(GetColorGdi(node));
         await Task.Run(() =>
         {
             if (colorDialog.Show())
             {
                 node.Value = GetColor(colorDialog.SelectedColor);
             }
         });
     }
 }
示例#4
0
 protected override async void HandleEvent(MouseEventID id, Vector2 pos)
 {
     if (id == MouseEventID.LeftButtonDown)
     {
         var colorDialog = new CustomColorDialog(GetColorGdi(node));
         await Task.Run(() =>
         {
             if (colorDialog.Show())
             {
                 node.Value = GetColor(colorDialog.SelectedColor);
             }
         });
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            CustomColorDialog customColorDialog1 = new CustomColorDialog();
            Color             oldColor           = customColorDialog1.Color = BackColor;

            customColorDialog1.ColorChanged += (o, ev) =>
            {
                BackColor = ev.CurrentColor;
            };
            if (customColorDialog1.ShowDialog() != DialogResult.OK)
            {
                BackColor = oldColor;
            }
            ;
        }
示例#6
0
        /// <summary>
        /// Handles the <see cref="ButtonBase.Click"/> event for the "Change Color" <see
        /// cref="Button"/>.</summary>
        /// <param name="sender">
        /// The <see cref="Object"/> where the event handler is attached.</param>
        /// <param name="args">
        /// A <see cref="RoutedEventArgs"/> object containing event data.</param>
        /// <remarks><para>
        /// <b>OnColorChange</b> displays a <see cref="CustomColorDialog"/> allowing the user to
        /// change the masking color.
        /// </para><para>
        /// If the user made any changes, <b>OnColorChange</b> sets the <see
        /// cref="ImageSection.MaskColor"/> of the current <see cref="ImageSection"/> to the new
        /// masking color, calls <see cref="Initialize"/> to reload all image file bitmaps and to
        /// redisplay all images with the new masking color, and sets the <see
        /// cref="SectionTabItem.DataChanged"/> flag.</para></remarks>

        private void OnColorChange(object sender, RoutedEventArgs args)
        {
            args.Handled = true;
            ImageSection images = MasterSection.Instance.Images;

            // retrieve masking color and let user change it
            Color maskColor = images.MaskColor;
            bool  result    = CustomColorDialog.Show(MainWindow.Instance, ref maskColor);

            // update color and brodcast changes, if any
            if (result && images.MaskColor != maskColor)
            {
                images.MaskColor = maskColor;
                Initialize();
                SectionTab.DataChanged = true;
            }
        }
 private void lbCaps_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         CustomColorDialog customColorDialog1 = new CustomColorDialog();
         Color             oldColor           = customColorDialog1.Color = lbCaps.BackColor;
         customColorDialog1.ColorChanged += (o, ev) =>
         {
             lbCaps.BackColor = ev.CurrentColor;
         };
         if (customColorDialog1.ShowDialog() == DialogResult.OK)
         {
             SaveSettings();
         }
         else
         {
             lbCaps.BackColor = oldColor;
         }
     }
 }
示例#8
0
        /// <summary>
        /// Allows the user to change the <see cref="FactionClass"/> color associated with the item
        /// at the specified index in the "Faction" <see cref="ListView"/>.</summary>
        /// <param name="index">
        /// The index of the <see cref="FactionListItem"/> to change.</param>
        /// <remarks>
        /// <b>ChangeColor</b> displays a <see cref="CustomColorDialog"/>, allowing the user to
        /// change the <see cref="FactionClass"/> color associated with the specified <paramref
        /// name="index"/>, and sets the <see cref="DataChanged"/> flag if the user made any
        /// changes.</remarks>

        private void ChangeColor(int index)
        {
            if (index < 0)
            {
                return;
            }
            FactionListItem item = (FactionListItem)FactionList.Items[index];

            // retrieve item color and let user change it
            Color color  = item.Item2;
            bool  result = CustomColorDialog.Show(this, ref color);

            // update item and brodcast changes if confirmed
            if (result && color != item.Item2)
            {
                FactionList.Items[index] = new FactionListItem(
                    item.Item1, color, new SolidColorBrush(color));

                DataChanged = true;
            }
        }