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();
}