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();
        }
Exemplo n.º 2
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();
        }
        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();
        }
Exemplo n.º 4
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_concreteColorDialog != null)
         {
             _concreteColorDialog.Dispose();
             _concreteColorDialog = null;
         }
     }
 }
        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();
        }