示例#1
0
        private void CriaEstilos()
        {
            cPanelEstilos.Controls.Clear();
            JToken jEstilos = root.SelectToken("EstruturaCores.Estrutura.Estilos");

            foreach (var item in jEstilos)
            {
                JToken mEst = ((Newtonsoft.Json.Linq.JProperty)item).First();

                UPanelColor mPanel = new UPanelColor
                {
                    CorTextoARGB = mEst.SelectToken("Texto").ToString(),
                    CorBordaARGB = mEst.SelectToken("Borda").ToString(),
                    CorFundoARGB = mEst.SelectToken("Fundo").ToString(),
                    Texto        = "Estilo " + ((Newtonsoft.Json.Linq.JProperty)item).Name,
                    Width        = 300,
                    Height       = 30,
                    Name         = "cPanelCoresEstilo" + ((Newtonsoft.Json.Linq.JProperty)item).Name,
                    Tag          = mEst.Path,
                };
                mPanel.Top = ((mPanel.Height + 2) * cPanelEstilos.Controls.Count);

                cPanelEstilos.Controls.Add(mPanel);
                mControls.Add(mPanel.Name, mPanel);
                mPanel.Refresh();
            }
        }
示例#2
0
        private void CButtonEstilo_Click(object sender, EventArgs e)
        {
            if (root != null)
            {
                JToken    jEstilos = root.SelectToken("EstruturaCores.Estrutura.Estilos");
                JProperty mEst     = (JProperty)((JContainer)jEstilos).Last;

                UPanelColor mPanel = new UPanelColor
                {
                    CorTextoARGB = "255,255,255",
                    CorBordaARGB = "255,0,0",
                    CorFundoARGB = "255,255,255",
                    Texto        = "Estilo " + (int.Parse(mEst.Name) + 1).ToString().PadLeft(2, '0'),
                    Width        = 300,
                    Height       = 30,
                    Name         = "cPanelCoresEstilo" + (int.Parse(mEst.Name) + 1).ToString().PadLeft(2, '0'),
                    Tag          = "EstruturaCores.Estrutura.Estilos." + (int.Parse(mEst.Name) + 1).ToString().PadLeft(2, '0')
                };
                mPanel.Top = ((mPanel.Height + 2) * cPanelEstilos.Controls.Count);

                cPanelEstilos.Controls.Add(mPanel);
                mControls.Add(mPanel.Name, mPanel);
                mPanel.Click += CPanelColor_Click;
                mPanel.Refresh();

                ((JObject)jEstilos).Add(new JProperty((int.Parse(mEst.Name) + 1).ToString().PadLeft(2, '0'), JToken.Parse(@"{}")));


                this.AtualizaJSONPanel(mPanel);
            }
        }
示例#3
0
        private void AtualizaJSONPanel(UPanelColor mPanel)
        {
            JToken     jCores = root.SelectToken(mPanel.Tag.ToString());
            JContainer jCol   = ((Newtonsoft.Json.Linq.JContainer)jCores);

            if (jCores.SelectToken("Texto") == null)
            {
                ((JObject)jCores).Add(new JProperty("Texto", mPanel.CorTextoARGB));
            }
            else
            {
                jCores["Texto"] = mPanel.CorTextoARGB;
            }

            if (jCores.SelectToken("Borda") == null)
            {
                ((JObject)jCores).Add(new JProperty("Borda", mPanel.CorBordaARGB));
            }
            else
            {
                jCores["Borda"] = mPanel.CorBordaARGB;
            }

            if (jCores.SelectToken("Fundo") == null)
            {
                ((JObject)jCores).Add(new JProperty("Fundo", mPanel.CorFundoARGB));
            }
            else
            {
                jCores["Fundo"] = mPanel.CorFundoARGB;
            }
        }
示例#4
0
        private void MudaCorControle(Control control)
        {
            foreach (Control mControl in control.Controls)
            {
                this.MudaCorControle(mControl);
            }
            if (control.Tag != null)
            {
                JToken jCores = root.SelectToken(control.Tag.ToString());

                UPanelColor mPanel = (UPanelColor)control;
                if (jCores.SelectToken("Texto") != null)
                {
                    mPanel.CorTextoARGB = jCores.SelectToken("Texto").ToString();
                }
                if (jCores.SelectToken("Borda") != null)
                {
                    mPanel.CorBordaARGB = jCores.SelectToken("Borda").ToString();
                }
                if (jCores.SelectToken("Fundo") != null)
                {
                    mPanel.CorFundoARGB = jCores.SelectToken("Fundo").ToString();
                }
                mControls.Add(control.Name, mPanel);
            }
        }
示例#5
0
        private void CPanelColor_Click(object sender, EventArgs e)
        {
            UPanelColor control = (UPanelColor)sender;

            if (control.Cores != null)
            {
                cLabelTexto.BackColor = control.Cores.Texto == null?Color.FromArgb(0, 0, 0, 0) : control.Cores.Texto;

                cLabelBorda.BackColor = control.Cores.Borda == null?Color.FromArgb(0, 0, 0, 0) : control.Cores.Borda;

                cLabelFundo.BackColor = control.Cores.Fundo == null?Color.FromArgb(0, 0, 0, 0) : control.Cores.Fundo;

                gControl = (UPanelColor)sender;
                this.MostraJSON();
            }
        }
示例#6
0
        private void MudaCorPanel(UPanelColor mPanel, Label mLabel)
        {
            Color mCor;

            if (mPanel != null)
            {
                if (mLabel.Name == "cLabelTexto")
                {
                    mCor = mPanel.Cores.Texto;
                }
                else if (mLabel.Name == "cLabelBorda")
                {
                    mCor = mPanel.Cores.Borda;
                }
                else
                {
                    mCor = mPanel.Cores.Fundo;
                }
                if (mCor.A != 0)
                {
                    cColorDialog.Color = mLabel.BackColor;
                    if (cColorDialog.ShowDialog() == DialogResult.OK)
                    {
                        mLabel.BackColor = cColorDialog.Color;
                        if (mLabel.Name == "cLabelTexto")
                        {
                            mPanel.Cores.Texto = cColorDialog.Color;
                        }
                        else if (mLabel.Name == "cLabelBorda")
                        {
                            mPanel.Cores.Borda = cColorDialog.Color;
                        }
                        else
                        {
                            mPanel.Cores.Fundo = cColorDialog.Color;
                        }
                        this.MostraJSON();
                        mPanel.Refresh();
                    }
                }
            }
        }