Beispiel #1
0
 void ambLightButton_Click(object sender, EventArgs e)
 {
     if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         AmbientLightColor = new ColorValue((int)colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B, 1);
     }
 }
Beispiel #2
0
 private void colorpiker_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     System.Windows.Forms.ColorDialog ColorColection = new System.Windows.Forms.ColorDialog();
     ColorColection.ShowDialog();
     if (ColorColection.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
     }
 }
 private void btnLightColor_Click(object sender, RoutedEventArgs e)
 {
     colorDlg.Color = ((Color)btnLightColor.Tag).ToDrawingColor();
     if (colorDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         SetColor(btnLightColor, colorDlg.Color.ToWPFColor());
         sld_ValueChanged(this, null);
     }
 }
Beispiel #4
0
        private void ShowColorDialog()
        {
            // HACK: Windows ストア アプリや Windows Phone などにも移植する場合、Windows Forms (Win32) のカラーダイアログは使えない。
            // .NET Compact Framework でもサポートされていないらしい。
            // ストア アプリでもカラーピッカーは用意されていないようなので、必要に応じて
            // Photoshop ライクの RGB/HSV/HSB カラーエディタなどを改めて XAML 実装したほうがよい。

            this._isHoldingPin = false;
            var vm         = this._viewModel.CurrentGradientStop;
            var colorDlg   = new System.Windows.Forms.ColorDialog();
            var brushColor = vm != null ? vm.Color : Colors.White;

            colorDlg.Color    = System.Drawing.Color.FromArgb(brushColor.R, brushColor.G, brushColor.B);
            colorDlg.FullOpen = true;
            if (colorDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var newColor = Color.FromRgb(colorDlg.Color.R, colorDlg.Color.G, colorDlg.Color.B);
                if (vm != null)
                {
                    vm.Color = newColor;
                    this.SetActiveGradientStop(vm);
                    var stop = vm.Tag as GradientStop;
                    if (stop != null)
                    {
                        stop.Color = vm.Color;
                    }
                }
            }
        }
        //=============================================================================
        private void OnPickColorButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            Button button = sender as Button;

            if (button == null)
            {
                return;
            }

            ColorViewModel vm = button.DataContext as ColorViewModel;

            if (vm == null)
            {
                return;
            }

            System.Windows.Forms.ColorDialog clrDialog = new System.Windows.Forms.ColorDialog();
            clrDialog.Color         = System.Drawing.Color.FromArgb(vm.Value.A, vm.Value.R, vm.Value.G, vm.Value.B);;
            clrDialog.AllowFullOpen = true;
            clrDialog.FullOpen      = true;
            if (clrDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                vm.Value = System.Windows.Media.Color.FromArgb(clrDialog.Color.A, clrDialog.Color.R, clrDialog.Color.G, clrDialog.Color.B);
            }
        }
Beispiel #6
0
        private void ButtonColor_OnClick(object sender, RoutedEventArgs e)
        {
            var colorDialog  = new System.Windows.Forms.ColorDialog();
            var dialogResult = colorDialog.ShowDialog();

            ListBoxResult.Items.Add($"DialogResult is {dialogResult}.");
        }
        /// <summary>
        /// Asetetaan pelinappuloiden värit. Jos värit ovat samat, annetaan virhe.
        /// </summary>
        private void Pelaaja_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.ColorDialog variDialog = new System.Windows.Forms.ColorDialog();
            if (variDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                System.Drawing.Color       variValinta = variDialog.Color;
                System.Windows.Media.Color uusiVari    = System.Windows.Media.Color.FromArgb(variValinta.A, variValinta.R, variValinta.G, variValinta.B);
                if ((Button)sender == pelaaja1Button)
                {
                    NappulaVari1 = new SolidColorBrush(uusiVari);
                    pelaaja1Button.Foreground = NappulaVari1;
                }
                else
                {
                    NappulaVari2 = new SolidColorBrush(uusiVari);
                    pelaaja2Button.Foreground = NappulaVari2;
                }
            }

            //Jos nappuloiden värit ovat samat niin ei anneta jatkaa (koska ohjelma hajoaisi... eikä muutenkaan järkeä)
            if (((SolidColorBrush)NappulaVari1).Color == ((SolidColorBrush)NappulaVari2).Color)
            {
                virheteksti            = "Pelaajien värit eivät saa olla samat!";
                aloitaButton.IsEnabled = false;
            }
            else
            {
                virheteksti            = "";
                aloitaButton.IsEnabled = true;
            }

            virheLabel.Content = virheteksti;
        }
Beispiel #8
0
        private void Pallet_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            string controlname = (sender as FrameworkElement).Name;

            System.Windows.Shapes.Rectangle r = (System.Windows.Shapes.Rectangle)sender;

            //Get Current color
            SolidColorBrush scb     = r.Fill as SolidColorBrush;
            var             DrColor = System.Drawing.Color.FromArgb(scb.Color.A, scb.Color.R, scb.Color.G, scb.Color.B);

            //Windows Forms color picker tool
            System.Windows.Forms.ColorDialog cd = new System.Windows.Forms.ColorDialog();
            cd.FullOpen = true;
            cd.Color    = DrColor;
            cd.ShowDialog();
            System.Windows.Media.Color selcolor = new System.Windows.Media.Color();
            selcolor.A = cd.Color.A;
            selcolor.R = cd.Color.R;
            selcolor.G = cd.Color.G;
            selcolor.B = cd.Color.B;
            string hexcolor = "#" + selcolor.R.ToString("X2") + selcolor.G.ToString("X2") + selcolor.B.ToString("X2");

            r.Fill            = new SolidColorBrush(selcolor);
            fontcolorTxt.Text = hexcolor;
            //AllAppSettings.Set(controlname, hexcolor);
            cd.Dispose();
        }
Beispiel #9
0
        /// <summary>
        /// Process a click on the custom color option.
        /// </summary>
        /// <param name="sender">Object that raised the event.</param>
        /// <param name="e">Event arguments.</param>
        private void comboBoxInput_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (comboBoxInput.SelectedItem == panelCustomColor)
                {
                    System.Windows.Forms.ColorDialog dlg = new System.Windows.Forms.ColorDialog();
                    if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        Color color = Color.FromArgb(dlg.Color.A, dlg.Color.R, dlg.Color.G, dlg.Color.B);
                        SelectedColor = color;
                    }
                    else
                    {
                        if (_previousSelection != panelCustomColor)
                        {
                            comboBoxInput.SelectedItem = _previousSelection;
                        }
                    }
                }
                else
                {
                    _previousSelection = comboBoxInput.SelectedItem;
                }

                buttonSelect.IsEnabled = (comboBoxInput.SelectedItem != null);
            }
            catch (Exception err)
            {
                App.HandleException(err);
            }
        }
Beispiel #10
0
        private void Canvas_MouseLeftButtonDown_SelectVectorColour(object sender, MouseButtonEventArgs e)
        {
            System.Windows.Media.Brush mediaBrush        = ((Canvas)sender).Background;
            System.Drawing.SolidBrush  drawingSolidBrush = new System.Drawing.SolidBrush(
                (System.Drawing.Color) new System.Drawing.ColorConverter().ConvertFromString(new BrushConverter().ConvertToString(mediaBrush)));
            //double a = drawingSolidBrush.Color.A;
            //double r = drawingSolidBrush.Color.R;
            //double g = drawingSolidBrush.Color.G;
            //double b = drawingSolidBrush.Color.B;

            System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog {
                Color = drawingSolidBrush.Color,
            };
            if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                SolidColorBrush b = new SolidColorBrush(Color.FromArgb(colorDialog.Color.A,
                                                                       colorDialog.Color.R,
                                                                       colorDialog.Color.G,
                                                                       colorDialog.Color.B));

                ((Canvas)sender).Background    = b;
                this._canvasVector.VectorBrush = b;

                this._canvasVector.UpdateBrush();
            }
        }
Beispiel #11
0
        private void dataGridColoursSet(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;

            try
            {
                ColourData data = (ColourData)button.Tag;
                if (null != data)
                {
                    System.Windows.Forms.ColorDialog cd = new System.Windows.Forms.ColorDialog();
                    cd.Color          = System.Drawing.Color.FromArgb(255, data.R, data.G, data.B);
                    cd.AnyColor       = true;
                    cd.SolidColorOnly = true;
                    cd.FullOpen       = true;
                    if (cd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        data.R     = cd.Color.R;
                        data.G     = cd.Color.G;
                        data.B     = cd.Color.B;
                        data.Color = new SolidColorBrush(Color.FromRgb(data.R, data.G, data.B));
                        dataGridColours.Items.Refresh();
                    }
                }
            }
            catch
            {
            }
        }
        public bool ShowDialog(ref Color?wpfColor)
        {
            var wpfMainWindowHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle;
            var win32Parent         = new System.Windows.Forms.NativeWindow();

            win32Parent.AssignHandle(wpfMainWindowHandle);

            var colorDialog = new System.Windows.Forms.ColorDialog();

            if (wpfColor != null)
            {
                colorDialog.Color = System.Drawing.Color.FromArgb(
                    wpfColor.Value.A, wpfColor.Value.R, wpfColor.Value.G, wpfColor.Value.B);
            }

            var dialogResult = colorDialog.ShowDialog(win32Parent);

            var result = false;

            if (dialogResult == System.Windows.Forms.DialogResult.OK)
            {
                var drawingColor = colorDialog.Color;
                wpfColor = Color.FromArgb(drawingColor.A, drawingColor.R, drawingColor.G, drawingColor.B);
                result   = true;
            }

            return(result);
        }
Beispiel #13
0
        /// <summary>
        /// Choose a colour from a dialog.
        /// </summary>
        /// <returns>
        /// The chosen colour.
        /// </returns>
        public static Primitive Colour()
        {
            string result = "";

            try
            {
                ThreadStart start = delegate
                {
                    System.Windows.Forms.ColorDialog dlg = new System.Windows.Forms.ColorDialog();
                    dlg.AllowFullOpen  = true;
                    dlg.AnyColor       = true;
                    dlg.FullOpen       = true;
                    dlg.SolidColorOnly = false;

                    if (dlg.ShowDialog(Utilities.ForegroundHandle()) == System.Windows.Forms.DialogResult.OK)
                    {
                        result = ColorTranslator.ToHtml(dlg.Color).ToString();
                    }
                };
                Thread thread = new Thread(start);
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
                StartPosition(null, "Color");
                thread.Join();
            }
            catch (Exception ex)
            {
                Utilities.OnError(Utilities.GetCurrentMethod(), ex);
            }
            return(result);
        }
Beispiel #14
0
        public void Execute(Point startClick, Point endClick)
        {
            var pt = new System.Drawing.Point((int)startClick.X, (int)startClick.Y);

            if (askForColor)
            {
                colorDlg.ShowDialog();
                fillColor = colorDlg.Color;
            }

            Animation animation = Animation.getInstance();

            if (animation.PointInCell(startClick))
            {
                //Already Exisiting Cell
                Cell c     = animation.findCell(startClick);
                int  frame = _viewModel.currentFrame;
                c.color[frame] = fillColor;

                //Trigers and update on the View
                _viewModel.Cells.Remove(c);
                _viewModel.Cells.Add(c);
            }
            else
            {
                var finder = new RegionFinder(_viewModel.Image, pt, _viewModel.Tolerance);
                finder.LineFound +=
                    line => _viewModel.Cells.Add(new Cell(line.Select(p => new Point(p.X, p.Y)).ToArray(), animation.numFrames(), _viewModel.currentFrame, fillColor));
                finder.Process();

                //Add to the Model
                animation.addCell(_viewModel.Cells.Last());
            }
        }
Beispiel #15
0
            /// <summary>
            /// Display Rhino's color selection dialog.
            /// </summary>
            /// <param name="color">
            /// [in/out] Default color for dialog, and will receive new color if function returns true.
            /// </param>
            /// <param name="includeButtonColors">
            /// Display button face and text options at top of named color list.
            /// </param>
            /// <param name="dialogTitle">The title of the dialog.</param>
            /// <returns>true if the color changed. false if the color has not changed or the user pressed cancel.</returns>
            public static bool ShowColorDialog(ref System.Drawing.Color color, bool includeButtonColors, string dialogTitle)
            {
                bool rc = false;

                try
                {
                    int abgr = System.Drawing.ColorTranslator.ToWin32(color);
                    rc = UnsafeNativeMethods.RHC_RhinoColorDialog(ref abgr, includeButtonColors, dialogTitle);
                    if (rc)
                    {
                        color = System.Drawing.ColorTranslator.FromWin32(abgr);
                    }
                }
                catch (EntryPointNotFoundException)
                {
                    if (!Rhino.Runtime.HostUtils.RunningInRhino)
                    {
                        System.Windows.Forms.ColorDialog cd = new System.Windows.Forms.ColorDialog();
                        cd.Color = color;
                        if (cd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            rc    = true;
                            color = cd.Color;
                        }
                    }
                }
                return(rc);
            }
Beispiel #16
0
        private void ButtonColorSets_Click(object sender, RoutedEventArgs e)
        {
            colorDialog = new System.Windows.Forms.ColorDialog();
            colorDialog.AllowFullOpen  = true;
            colorDialog.AnyColor       = true;
            colorDialog.SolidColorOnly = false;
            // colorDialog.ShowDialog();

            if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                //lineColor = colorDialog.Color.GetHashCode();
                //string color = lineColor.ToString();
                var conv = new System.Windows.Media.BrushConverter();
                var a    = colorDialog.Color.A;
                var r    = colorDialog.Color.R;
                var g    = colorDialog.Color.G;
                var b    = colorDialog.Color.B;

                Color color = new Color();
                color = Color.FromRgb(r, g, b);
                Brush brush = new SolidColorBrush(color);

                lineColor = brush;
                Console.WriteLine(color.R);
                rectInfo.Fill = brush;
            }
        }
Beispiel #17
0
 private void BColor_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.ColorDialog ColPicker = new System.Windows.Forms.ColorDialog();
     if (ColPicker.ShowDialog() != System.Windows.Forms.DialogResult.OK)
         return;
     BColor.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(ColPicker.Color.A, ColPicker.Color.R, ColPicker.Color.G, ColPicker.Color.B));
 }
        /// <summary>
        /// Background colour document.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BackgroundColour_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
            colorDialog.AllowFullOpen = true;

            // If ok.
            if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                System.Windows.Media.Color col = new System.Windows.Media.Color();
                col.A = colorDialog.Color.A;
                col.B = colorDialog.Color.B;
                col.G = colorDialog.Color.G;
                col.R = colorDialog.Color.R;

                // Get the selected colour.
                System.Windows.Media.Brush brush = new SolidColorBrush(col);

                //Current word at the pointer
                // Get the selected text.
                TextSelection text = mainRTB.Selection;
                if (!text.IsEmpty)
                {
                    text.ApplyPropertyValue(TextElement.BackgroundProperty, brush);
                }
            }
        }
Beispiel #19
0
 private void Cb_Checked(object sender, RoutedEventArgs e)
 {
     if (leftButton.IsEnabled)
     {
         dt.Stop();
     }
     //System.Windows.Forms.ColorDialog cd = new System.Windows.Forms.ColorDialog();
     cd.ShowDialog();
     if (cd.Color != null)
     {
         if ((sender as CheckBox).Content.ToString() == "纯色")
         {
             //system.drawing.color 与system.windows.media.color互转
             singleColor = Color.FromArgb(cd.Color.A, cd.Color.R, cd.Color.G, cd.Color.B);
         }
         else
         {
             borderColor = Color.FromArgb(cd.Color.A, cd.Color.R, cd.Color.G, cd.Color.B);
         }
     }
     if (leftButton.IsEnabled)
     {
         dt.Start();
     }
 }
        private void color_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            string controlname = (sender as FrameworkElement).Name; //This name must match to key in config file.

            System.Windows.Shapes.Rectangle r = (System.Windows.Shapes.Rectangle)sender;

            //Get Current color
            SolidColorBrush scb     = r.Fill as SolidColorBrush;
            var             DrColor = System.Drawing.Color.FromArgb(scb.Color.A, scb.Color.R, scb.Color.G, scb.Color.B);

            //WPF RGB color slider
            ColorSelectorWindow csw = new ColorSelectorWindow();

            //csw.OldColor = scb;//new SolidColorBrush((color.Background as Brush).);
            //csw.ShowDialog();
            //r.Fill = csw.CurrentColor;
            //AllAppSettings.Set(controlname, csw.HexColor);

            //Windows Forms color picker tool
            System.Windows.Forms.ColorDialog cd = new System.Windows.Forms.ColorDialog();
            cd.FullOpen = true;
            cd.Color    = DrColor;
            cd.ShowDialog();
            System.Windows.Media.Color selcolor = new System.Windows.Media.Color();
            selcolor.A = cd.Color.A;
            selcolor.R = cd.Color.R;
            selcolor.G = cd.Color.G;
            selcolor.B = cd.Color.B;
            string hexcolor = "#FF" + selcolor.R.ToString("X2") + selcolor.G.ToString("X2") + selcolor.B.ToString("X2");

            r.Fill = new SolidColorBrush(selcolor);
            AllAppSettings.Set(controlname, hexcolor);
            cd.Dispose();
        }
Beispiel #21
0
        private void solidColorContainer_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (solidToggle.IsChecked ?? false)
            {
                if (e.ClickCount == 2)
                {
                    System.Windows.Forms.ColorDialog dialog = new System.Windows.Forms.ColorDialog();

                    if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        int argb = dialog.Color.ToArgb();

                        new Thread(() =>
                        {
                            var DataKit        = new DataKit();
                            var monitorSetting = (from c in DataKit.Realm.All <BackgroundSettingsByMonitor>() where c.MonitorDeviceName == MainWindow.MonitorDeviceName select c).First();

                            DataKit.Realm.Write(() =>
                            {
                                monitorSetting.SolidColor = (argb & 0x00FFFFFF).ToString("X6");
                            });
                        }).Start();

                        BrushConverter bc = new BrushConverter();
                        solidColorContainer.Background = (Brush)bc.ConvertFrom("#" + (argb & 0x00FFFFFF).ToString("X6"));
                        Debug.WriteLine("OKOKOKOKOK");
                    }
                }
            }
        }
        private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            System.Windows.Forms.ColorDialog  dialog = new System.Windows.Forms.ColorDialog();
            System.Windows.Forms.DialogResult r      = dialog.ShowDialog();
            string colorstr = "|CFF";

            if (r == System.Windows.Forms.DialogResult.OK)
            {
                colorstr += to16(dialog.Color);
            }
            this.color_text.Text = colorstr;
            Color color = new Color();

            color.R = dialog.Color.R;
            color.G = dialog.Color.G;
            color.B = dialog.Color.B;
            color.A = dialog.Color.A;
            // Brush brush =(Brush) new BrushConverter().ConvertFrom("#"+ to16(dialog.Color));
            Brush brush = new SolidColorBrush(color);

            //brush.Freeze();
            this.color_label.Background = brush;

            dialog.Dispose();
        }
Beispiel #23
0
        /// <summary>
        /// Displays the UI for value selection.
        /// </summary>
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            /*
             *          PropertiesUtils.PropertyWrapper pw;
             *          if ((pw = context.PropertyDescriptor as PropertiesUtils.PropertyWrapper) == null)
             *                  return value;
             *
             * DependencyObject depObj;
             * DependencyProperty depProp;
             * pw.GetWpfObjects(out depObj, out depProp);
             * if (depObj == null || depProp == null)
             *  return value;
             */
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                System.Windows.Forms.ColorDialog cd = new System.Windows.Forms.ColorDialog();
                if (cd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    System.Windows.Media.SolidColorBrush scb = new System.Windows.Media.SolidColorBrush();
                    scb.Color = System.Windows.Media.Color.FromArgb(
                        cd.Color.A,
                        cd.Color.R,
                        cd.Color.G,
                        cd.Color.B);
                    return(scb);
                }
            }

            return(value);
        }
 private void button_Click(object sender, EventArgs e)
 {
     System.Windows.Forms.ColorDialog cd = new System.Windows.Forms.ColorDialog();
     if (cd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         (sender as System.Windows.Forms.Button).BackColor = cd.Color;
     }
 }
Beispiel #25
0
 private void CustomColorPicker_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
     ColorPickButton.IsActived = true;
     colorDialog.ShowDialog();
     SetColor(colorDialog.Color);
     ColorPickButton.IsActived = false;
 }
Beispiel #26
0
 private void color_down(object sender, MouseButtonEventArgs e)
 {
     System.Windows.Forms.ColorDialog cd = new System.Windows.Forms.ColorDialog();
     if (cd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         DrawColor = _color.Fill = new SolidColorBrush(System.Windows.Media.Color.FromArgb(cd.Color.A, cd.Color.R, cd.Color.G, cd.Color.B));
     }
 }
Beispiel #27
0
 /// <summary>
 /// Show the color dialog for choosing from more colors
 /// </summary>
 /// <param name="sender">sender object</param>
 /// <param name="e">Event arguments</param>
 private void OnShowColorDialog(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.ColorDialog moreColorsDialog = new System.Windows.Forms.ColorDialog();
     if (moreColorsDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         this.SelectedColor = Color.FromArgb(moreColorsDialog.Color.A, moreColorsDialog.Color.R, moreColorsDialog.Color.G, moreColorsDialog.Color.B);
     }
 }
Beispiel #28
0
 private void pickColor(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
     if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         atomColor = new SolidColorBrush(Color.FromArgb(colorDialog.Color.A, colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B));
     }
 }
Beispiel #29
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.ColorDialog dialog = new System.Windows.Forms.ColorDialog();
     if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         this.Form.setWindowActiveColor(Color.FromArgb(dialog.Color.A, dialog.Color.R, dialog.Color.G, dialog.Color.B));
     }
 }
Beispiel #30
0
 private void rctColor12_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     System.Windows.Forms.ColorDialog dialog = new System.Windows.Forms.ColorDialog();
     if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         Color12.Fill = new SolidColorBrush(Color.FromArgb(Opacity, dialog.Color.R, dialog.Color.G, dialog.Color.B));
     }
 }
Beispiel #31
0
 private void btnColor_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
     if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         rtbEditor.Selection.ApplyPropertyValue(Inline.ForegroundProperty, new SolidColorBrush(Color.FromArgb(colorDialog.Color.A, colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B)));
     }
 }
 private void buttonChangeBack_click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.ColorDialog cd = new System.Windows.Forms.ColorDialog();
     if (cd.ShowDialog() != System.Windows.Forms.DialogResult.Cancel)
     {
         back_color = cd.Color;
         lableFontname_Copy.Content = back_color.Name;
     }
 }
Beispiel #33
0
 private void ColorRect_MouseDown(object sender, MouseButtonEventArgs e)
 {
     var cd = new ColorDialog();
     if (cd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         MainCanvas.DefaultDrawingAttributes.Color = Color.FromArgb(cd.Color.A, cd.Color.R, cd.Color.G, cd.Color.B);
         ColorRect.Fill = new SolidColorBrush(MainCanvas.DefaultDrawingAttributes.Color);
     }
 }
Beispiel #34
0
        private void Color_Click(object sender, RoutedEventArgs e)
        {
            Button b = sender as Button;
            System.Windows.Forms.ColorDialog colorPicker = new System.Windows.Forms.ColorDialog();
            colorPicker.Color = System.Drawing.Color.FromArgb(((SolidColorBrush)b.Background).Color.R, ((SolidColorBrush)b.Background).Color.G, ((SolidColorBrush)b.Background).Color.B);
            colorPicker.FullOpen = true;
            colorPicker.ShowDialog();

            b.Background = new SolidColorBrush(Color.FromRgb(colorPicker.Color.R, colorPicker.Color.G, colorPicker.Color.B));
        }
 public Color GetNewColor(Color current)
 {
     ColorDialog cd = new ColorDialog();
     cd.Color = current.ToWinFormColor();
     cd.AllowFullOpen = true;
     cd.FullOpen = true;
     cd.SolidColorOnly = true;
     cd.ShowDialog();
     return cd.Color.ToWPFColor();
 }
 private void ChooseColor_Click(object sender, RoutedEventArgs e)
 {
     var dialog = new System.Windows.Forms.ColorDialog();
     dialog.AnyColor = true;
     dialog.Color = System.Drawing.Color.FromArgb(Color.R, Color.G, Color.B);
     if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         Color = Color.FromArgb(255, dialog.Color.R, dialog.Color.G, dialog.Color.B);
     }
 }
Beispiel #37
0
        /// <summary>
        /// avaa uuden ColorDialogin josta voi valita värin.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Vari_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.ColorDialog colorDialog =
                       new System.Windows.Forms.ColorDialog();
            colorDialog.AllowFullOpen = true;
            colorDialog.Color = System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B);
            colorDialog.ShowDialog();

            color.A = colorDialog.Color.A;
            color.B = colorDialog.Color.B;
            color.G = colorDialog.Color.G;
            color.R = colorDialog.Color.R;
        }
Beispiel #38
0
 private void butHighLight_Click(object sender, RoutedEventArgs e)
 {
     var color = new System.Windows.Forms.ColorDialog()
     {
         Color = System.Drawing.Color.FromArgb(((SolidColorBrush)butHighLight.Background).Color.R, ((SolidColorBrush)butHighLight.Background).Color.G, ((SolidColorBrush)butHighLight.Background).Color.B),
         AnyColor = true,
         FullOpen = true,
         ShowHelp = true,
         SolidColorOnly = true
     };
     color.ShowDialog();
     ((SolidColorBrush)butHighLight.Background).Color = Color.FromArgb(0xFF, color.Color.R, color.Color.G, color.Color.B);
 }
Beispiel #39
0
        /// <summary>
        /// Open the widows forms color dialog
        /// </summary>
        /// <returns>the color in a string</returns>
        public static string ShowColorDialog()
        {
            using (System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog())
            {
                System.Windows.Forms.DialogResult dialogResult = colorDialog.ShowDialog();

                if (dialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    return ConvertColor(colorDialog.Color);
                }

                return string.Empty;
            }
        }
        private void Color_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Rectangle rectangle = sender as Rectangle;
            SolidColorBrush bg = rectangle.Fill as SolidColorBrush;

            System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
            colorDialog.FullOpen = true;
            colorDialog.Color = System.Drawing.Color.FromArgb(bg.Color.R, bg.Color.G, bg.Color.B);

            if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                rectangle.Fill = new SolidColorBrush(Color.FromRgb(colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B));
            }
        }
Beispiel #41
0
        public static System.Windows.Media.Color Pick()
        {
            System.Windows.Media.Color col = new System.Windows.Media.Color();

            using (System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog())
            {
                colorDialog.AllowFullOpen = true;
                colorDialog.FullOpen = true;
                System.Windows.Forms.DialogResult result = colorDialog.ShowDialog();

                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    col.A = colorDialog.Color.A;
                    col.B = colorDialog.Color.B;
                    col.G = colorDialog.Color.G;
                    col.R = colorDialog.Color.R;
                }
            }
            return col;
        }
        private void btnDisplayUploadColor_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.ColorDialog diag = new System.Windows.Forms.ColorDialog();

            if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                _settings.UploadColor = new ColorRGB(diag.Color.R, diag.Color.G, diag.Color.B);
        }
Beispiel #43
0
 private Brush ChooseColor()
 {
     System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
     colorDialog.FullOpen = true;
     colorDialog.ShowDialog();
     System.Drawing.Color color1 = colorDialog.Color;
     Color color = Colors.Red;
     color.A = color1.A;
     color.R = color1.R;
     color.G = color1.G;
     color.B = color1.B;
     Brush brush = new SolidColorBrush(color);
     return brush;
 }
 void rctColor_MouseUp(object sender, MouseButtonEventArgs e)
 {
     System.Windows.Forms.ColorDialog dialog = new System.Windows.Forms.ColorDialog();
     if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         rctColor.Fill = new SolidColorBrush(Color.FromArgb(0xFF, dialog.Color.R, dialog.Color.G, dialog.Color.B));
         if (isReadOnlyMode)
         {
             RenderMap();
         }
     }
 }
Beispiel #45
0
        private void OthersButton_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
            colorDialog.FullOpen = true;
            if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var color = colorDialog.Color;
                var wpfColor = Color.FromArgb(color.A, color.R, color.G, color.B);
                SelectedBrush = new SolidColorBrush(wpfColor);

                var commonColor = _CommonColors.SingleOrDefault(c => c.Value.Equals(wpfColor));
                SelectedValue = commonColor;
            }
        }
Beispiel #46
0
 /// <summary>
 /// Display Rhino's color selection dialog.
 /// </summary>
 /// <param name="color">
 /// [in/out] Default color for dialog, and will receive new color if function returns true.
 /// </param>
 /// <param name="includeButtonColors">
 /// Display button face and text options at top of named color list.
 /// </param>
 /// <param name="dialogTitle">The title of the dialog.</param>
 /// <returns>true if the color changed. false if the color has not changed or the user pressed cancel.</returns>
 public static bool ShowColorDialog(ref System.Drawing.Color color, bool includeButtonColors, string dialogTitle)
 {
   bool rc = false;
   try
   {
     int abgr = System.Drawing.ColorTranslator.ToWin32(color);
     rc = UnsafeNativeMethods.RHC_RhinoColorDialog(ref abgr, includeButtonColors, dialogTitle);
     if (rc)
       color = Runtime.Interop.ColorFromWin32(abgr);
   }
   catch (EntryPointNotFoundException)
   {
     if (!Runtime.HostUtils.RunningInRhino)
     {
       System.Windows.Forms.ColorDialog cd = new System.Windows.Forms.ColorDialog();
       cd.Color = color;
       if (cd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
       {
         rc = true;
         color = cd.Color;
       }
     }
   }
   return rc;
 }
        private Color? SelectColor()
        {
            var cd = new System.Windows.Forms.ColorDialog();
            if (cd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var color = Color.FromArgb(cd.Color.A,
                                           cd.Color.R,
                                           cd.Color.G,
                                           cd.Color.B);
                return color;
            }

            return null;
        }
        private void chooseColour_Click( object sender , RoutedEventArgs e )
        {
            System.Windows.Forms.ColorDialog colourDlg = new System.Windows.Forms.ColorDialog();
            colourDlg.AllowFullOpen = true;
            colourDlg.FullOpen = true;
            colourDlg.ShowDialog();

            Color newColour = new Color();
            newColour.A = colourDlg.Color.A;
            newColour.R = colourDlg.Color.R;
            newColour.G = colourDlg.Color.G;
            newColour.B = colourDlg.Color.B;

            colour.Fill = new SolidColorBrush( newColour );
        }
Beispiel #49
0
 /// <summary>
 /// Show the color dialog for choosing from more colors
 /// </summary>
 /// <param name="sender">sender object</param>
 /// <param name="e">Event arguments</param>
 private void OnShowColorDialog(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.ColorDialog moreColorsDialog = new System.Windows.Forms.ColorDialog();
     if (moreColorsDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         this.SelectedColor = Color.FromArgb(moreColorsDialog.Color.A, moreColorsDialog.Color.R, moreColorsDialog.Color.G, moreColorsDialog.Color.B);
     }
 }
        private void _buttonModifierColorWindow_Click(object sender, RoutedEventArgs e)
        {
            // Instancier une boite de dilogue de Winform
            System.Windows.Forms.ColorDialog dialogBox = new System.Windows.Forms.ColorDialog();

            // Affichage de la boite de dialogue
            if (dialogBox.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                TypeConverter converter = TypeDescriptor.GetConverter(typeof(Brush));
                //Converti la couleur en Hexa
                ((App)App.Current).personnalisation.BackGroundWindowColor = (Brush)converter.ConvertFrom(string.Concat("#", (dialogBox.Color.ToArgb() & 0x00FFFFFF).ToString("X6")));

                ((App)App.Current).personnalisation.saveBackGroundWindowColor(string.Concat("#", (dialogBox.Color.ToArgb() & 0x00FFFFFF).ToString("X6")));
            }
            this._colorToTestWindow.Background = ((App)App.Current).personnalisation.BackGroundWindowColor;
        }
        private void Modifier_ColorMove_Click_1(object sender, RoutedEventArgs e)
        {
            // Instancier une boite de dilogue de Winform
            System.Windows.Forms.ColorDialog dialogBox = new System.Windows.Forms.ColorDialog();

            // Affichage de la boite de dialogue
            if (dialogBox.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                TypeConverter converter = TypeDescriptor.GetConverter(typeof(Brush));
                //Converti la couleur en Hexa
                ((App)App.Current).personnalisation.ColorMove = Color.FromArgb(dialogBox.Color.A, dialogBox.Color.R, dialogBox.Color.G, dialogBox.Color.B);

                ((App)App.Current).personnalisation.saveColorMove(string.Concat(dialogBox.Color.A, "/", dialogBox.Color.R, "/", dialogBox.Color.G, "/", dialogBox.Color.B));
            }
            this._colorToTestMoveLogScreen.Background = new SolidColorBrush(((App)App.Current).personnalisation.ColorMove);
        }
Beispiel #52
0
 static Tuple<string, VoidDelegate> ColorChangeMenuTuple(AttributeBase attr) {
     return new Tuple<string, VoidDelegate>("set color", () => {
         var dialog = new System.Windows.Forms.ColorDialog();
         if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
             var color = dialog.Color;
             attr.Color = new Microsoft.Msagl.Drawing.Color(color.A, color.R, color.G, color.B);
         }
     });
 }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            // Instancier une boite de dilogue de Winform
            System.Windows.Forms.ColorDialog dialogBox = new System.Windows.Forms.ColorDialog();

            // Affichage de la boite de dialogue
            if (dialogBox.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                TypeConverter converter = TypeDescriptor.GetConverter(typeof(Brush));
                //Converti la couleur en Hexa
                ((App)App.Current).personnalisation.BackGroundLogScreenColor = (Brush)converter.ConvertFrom(string.Concat("#", (dialogBox.Color.ToArgb() & 0x00FFFFFF).ToString("X6")));

                RegistryKey regVersion;
                regVersion = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Sitaff2011\\1.0", true);
                regVersion.SetValue("BackGroundLogScreenColor", string.Concat("#", (dialogBox.Color.ToArgb() & 0x00FFFFFF).ToString("X6")));
                regVersion.Close();

                ((App)App.Current).personnalisation.InitLogScreen(this);
            }
            else
            {

            }
        }
 void rctLowColor_MouseUp(object sender, MouseButtonEventArgs e)
 {
     System.Windows.Forms.ColorDialog dialog = new System.Windows.Forms.ColorDialog();
     if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         rctLowColor.Fill = new SolidColorBrush(Color.FromArgb(0xF0, dialog.Color.R, dialog.Color.G, dialog.Color.B));
         //Parameters.StartColorRed = dialog.Color.R;
         //Parameters.StartColorGreen = dialog.Color.G;
         //Parameters.StartColorBlue = dialog.Color.B;
     }
 }
        public void SelectColor()
        {
            StrokeCollection _StrokeCollection = _currentInkCanvas.GetSelectedStrokes();
            if (_StrokeCollection.Count > 0)
            {
                System.Windows.Forms.ColorDialog _ColorDialog = new System.Windows.Forms.ColorDialog();
                if (_ColorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    foreach (Stroke _Stroke in _StrokeCollection)
                    {

                        Color _Color = Color.FromArgb(255, _ColorDialog.Color.R, _ColorDialog.Color.G, _ColorDialog.Color.B);

                        _Stroke.DrawingAttributes.Color = _Color;
                        //StreamGeometry _Geometry = _Stroke.GetGeometry();

                    }

            }
        }
Beispiel #56
0
        /// <summary>
        /// Invoked when the <see cref="addCustomColorMenuItem"/> is clicked.
        /// </summary>
        /// <param name="sender">The <see cref="MenuItem"/> where the event handler is attached.</param>
        /// <param name="e">The event data.</param>
        private void AddCustomColorMenuItemClick(object sender, RoutedEventArgs e)
        {
            ColorDialog dialog = new ColorDialog();
            dialog.AnyColor = true;
            dialog.FullOpen = true;
            dialog.CustomColors = ColorManager.Instance.AllColors
                .Where(c => c != Color.DefaultColor)
                .Select(c => c.ToInt())
                .ToArray();

            DialogResult result = dialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                Color color = new Color(dialog.Color.R, dialog.Color.G, dialog.Color.B);
                ColorManager.Instance.Add(color);
                this.timerWindow.Options.Color = color;
            }
        }
        private void OnFolderTextButtonClick(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.ColorDialog colorPicker = new System.Windows.Forms.ColorDialog();
            colorPicker.Color = System.Drawing.Color.FromArgb(((SolidColorBrush)FolderButton.Background).Color.R, ((SolidColorBrush)FolderButton.Background).Color.G, ((SolidColorBrush)FolderButton.Background).Color.B);
            colorPicker.FullOpen = true;
            colorPicker.ShowDialog();

            FolderTextButton.Background = new SolidColorBrush(Color.FromRgb(colorPicker.Color.R, colorPicker.Color.G, colorPicker.Color.B));
            FolderTextBrush = (SolidColorBrush)FolderTextButton.Background;
        }
 private void rctColor6_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     System.Windows.Forms.ColorDialog dialog = new System.Windows.Forms.ColorDialog();
     if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         rctColor6.Fill = new SolidColorBrush(Color.FromArgb(240, dialog.Color.R, dialog.Color.G, dialog.Color.B));
     }
 }
        // Phương thức cho phép người dùng chọn một màu từ bảng màu
        private SolidColorBrush editColor()
        {
            System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
            colorDialog.FullOpen = true;
            colorDialog.ShowDialog();

            System.Windows.Media.Color color = new System.Windows.Media.Color();
            color.A = colorDialog.Color.A;
            color.B = colorDialog.Color.B;
            color.G = colorDialog.Color.G;
            color.R = colorDialog.Color.R;

            SolidColorBrush colorBrush = new SolidColorBrush();
            colorBrush.Color = color;

            return colorBrush;
        }
Beispiel #60
0
 private void defaultcolorchooserbtn_Click(object sender, RoutedEventArgs e)
 {
     var cd = new System.Windows.Forms.ColorDialog();
     var initialcol = System.Drawing.Color.FromArgb(((SolidColorBrush)defaultcolourbox.Fill).Color.R, ((SolidColorBrush)defaultcolourbox.Fill).Color.G, ((SolidColorBrush)defaultcolourbox.Fill).Color.B);
     cd.Color = initialcol;
     var dr = cd.ShowDialog();
     if (dr == System.Windows.Forms.DialogResult.OK)
     {
         defaultcolourbox.Fill = new SolidColorBrush(Color.FromRgb(cd.Color.R, cd.Color.G, cd.Color.B));
     }
 }