Exemplo n.º 1
0
        private void btn_clk(object sender, RoutedEventArgs e)
        {
            ColorDialog colorDialog = new ColorDialog();
            var         btn         = sender as Button;

            if (btn == this.theory_color_btn)
            {
                colorDialog.SelectedColor = Color.FromArgb(t_color.A, t_color.R, t_color.G, t_color.B);
            }
            else if (btn == this.mgf_color_btn)
            {
                colorDialog.SelectedColor = Color.FromArgb(m_color.A, m_color.R, m_color.G, m_color.B);
            }
            else if (btn == this.other_color_btn)
            {
                colorDialog.SelectedColor = Color.FromArgb(o_color.A, o_color.R, o_color.G, o_color.B);
            }
            colorDialog.Owner = this;
            if ((bool)colorDialog.ShowDialog())
            {
                Color selected_color = colorDialog.SelectedColor;
                if (btn == this.theory_color_btn)
                {
                    t_color = OxyColor.FromArgb(selected_color.A, selected_color.R, selected_color.G, selected_color.B);
                    this.theory_color_btn.Background = new SolidColorBrush(Color.FromArgb(this.t_color.A, this.t_color.R, this.t_color.G, this.t_color.B));
                }
                else if (btn == this.mgf_color_btn)
                {
                    m_color = OxyColor.FromArgb(selected_color.A, selected_color.R, selected_color.G, selected_color.B);
                    this.mgf_color_btn.Background = new SolidColorBrush(Color.FromArgb(this.m_color.A, this.m_color.R, this.m_color.G, m_color.B));
                }
                else if (btn == this.other_color_btn)
                {
                    o_color = OxyColor.FromArgb(selected_color.A, selected_color.R, selected_color.G, selected_color.B);
                    this.other_color_btn.Background = new SolidColorBrush(Color.FromArgb(this.o_color.A, this.o_color.R, this.o_color.G, this.o_color.B));
                }
            }
        }
Exemplo n.º 2
0
        private void sel_Color(object sender, RoutedEventArgs e)
        {
            ColorDialog colorDialog = new ColorDialog();
            var         btn         = sender as Button;

            if (btn == this.A_btn)
            {
                colorDialog.SelectedColor = Color.FromArgb(A_color.A, A_color.R, A_color.G, A_color.B);
            }
            else if (btn == this.B_btn)
            {
                colorDialog.SelectedColor = Color.FromArgb(B_color.A, B_color.R, B_color.G, B_color.B);
            }
            else if (btn == this.C_btn)
            {
                colorDialog.SelectedColor = Color.FromArgb(C_color.A, C_color.R, C_color.G, C_color.B);
            }
            else if (btn == this.X_btn)
            {
                colorDialog.SelectedColor = Color.FromArgb(X_color.A, X_color.R, X_color.G, X_color.B);
            }
            else if (btn == this.Y_btn)
            {
                colorDialog.SelectedColor = Color.FromArgb(Y_color.A, Y_color.R, Y_color.G, Y_color.B);
            }
            else if (btn == this.Z_btn)
            {
                colorDialog.SelectedColor = Color.FromArgb(Z_color.A, Z_color.R, Z_color.G, Z_color.B);
            }
            else if (btn == this.M_btn)
            {
                colorDialog.SelectedColor = Color.FromArgb(M_color.A, M_color.R, M_color.G, M_color.B);
            }
            else if (btn == this.I_btn)
            {
                colorDialog.SelectedColor = Color.FromArgb(I_color.A, I_color.R, I_color.G, I_color.B);
            }
            else if (btn == this.O_btn)
            {
                colorDialog.SelectedColor = Color.FromArgb(O_color.A, O_color.R, O_color.G, O_color.B);
            }
            colorDialog.Owner = this;
            if ((bool)colorDialog.ShowDialog())
            {
                Color selected_color = colorDialog.SelectedColor;
                if (btn == this.A_btn)
                {
                    A_color = OxyColor.FromArgb(selected_color.A, selected_color.R, selected_color.G, selected_color.B);
                    this.A_btn.Background = new SolidColorBrush(Color.FromArgb(this.A_color.A, this.A_color.R, this.A_color.G, this.A_color.B));
                }
                else if (btn == this.B_btn)
                {
                    B_color = OxyColor.FromArgb(selected_color.A, selected_color.R, selected_color.G, selected_color.B);
                    this.B_btn.Background = new SolidColorBrush(Color.FromArgb(this.B_color.A, this.B_color.R, this.B_color.G, this.B_color.B));
                }
                else if (btn == this.C_btn)
                {
                    C_color = OxyColor.FromArgb(selected_color.A, selected_color.R, selected_color.G, selected_color.B);
                    this.C_btn.Background = new SolidColorBrush(Color.FromArgb(this.C_color.A, this.C_color.R, this.C_color.G, this.C_color.B));
                }
                else if (btn == this.X_btn)
                {
                    X_color = OxyColor.FromArgb(selected_color.A, selected_color.R, selected_color.G, selected_color.B);
                    this.X_btn.Background = new SolidColorBrush(Color.FromArgb(this.X_color.A, this.X_color.R, this.X_color.G, this.X_color.B));
                }
                else if (btn == this.Y_btn)
                {
                    Y_color = OxyColor.FromArgb(selected_color.A, selected_color.R, selected_color.G, selected_color.B);
                    this.Y_btn.Background = new SolidColorBrush(Color.FromArgb(this.Y_color.A, this.Y_color.R, this.Y_color.G, this.Y_color.B));
                }
                else if (btn == this.Z_btn)
                {
                    Z_color = OxyColor.FromArgb(selected_color.A, selected_color.R, selected_color.G, selected_color.B);
                    this.Z_btn.Background = new SolidColorBrush(Color.FromArgb(this.Z_color.A, this.Z_color.R, this.Z_color.G, this.Z_color.B));
                }
                else if (btn == this.M_btn)
                {
                    M_color = OxyColor.FromArgb(selected_color.A, selected_color.R, selected_color.G, selected_color.B);
                    this.M_btn.Background = new SolidColorBrush(Color.FromArgb(this.M_color.A, this.M_color.R, this.M_color.G, this.M_color.B));
                }
                else if (btn == this.I_btn)
                {
                    I_color = OxyColor.FromArgb(selected_color.A, selected_color.R, selected_color.G, selected_color.B);
                    this.I_btn.Background = new SolidColorBrush(Color.FromArgb(this.I_color.A, this.I_color.R, this.I_color.G, this.I_color.B));
                }
                else if (btn == this.O_btn)
                {
                    O_color = OxyColor.FromArgb(selected_color.A, selected_color.R, selected_color.G, selected_color.B);
                    this.O_btn.Background = new SolidColorBrush(Color.FromArgb(this.O_color.A, this.O_color.R, this.O_color.G, this.O_color.B));
                }
            }
        }