Example #1
0
 private void GradientDialog_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (GradientDialog.GradientChanged != null)
     {
         GradientDialog.GradientChanged(this, new GradientEventArgs(this._save ? "save" : "undo", 0, null, 0, 0, 0));
     }
 }
Example #2
0
 private void agButton_Click(object sender, EventArgs e)
 {
     if (GradientDialog.GradientChanged != null)
     {
         GradientDialog.GradientChanged(this, new GradientEventArgs("A", -1, GradientDialog._blends[0], 0, 0, 0));
     }
 }
Example #3
0
 public static ColorBlend GetGradient(ColorBlend originalBlend)
 {
     using (var form = new GradientDialog())
     {
         form.SetColorBlend(originalBlend);
         if (form.ShowDialog() == DialogResult.OK)
         {
             return form.GetColorBlend();
         }
     }
     return null;
 }
Example #4
0
 public static ColorBlend GetGradient(ColorBlend originalBlend)
 {
     using (GradientDialog gradientDialog = new GradientDialog())
     {
         gradientDialog.SetColorBlend(originalBlend);
         if (gradientDialog.ShowDialog() == DialogResult.OK)
         {
             return(gradientDialog.GetColorBlend());
         }
     }
     return(null);
 }
Example #5
0
        public static void ShowGradient(int blendIndex, ColorBlend[] blends, int[] backgrounds, int[] traceColors, int[] spectrumFill, string parent)
        {
            GradientDialog._blends       = new ColorBlend[blends.GetUpperBound(0)];
            GradientDialog._blendIndex   = Math.Abs(blendIndex);
            GradientDialog._blends       = blends;
            GradientDialog._backgrounds  = backgrounds;
            GradientDialog._traceColors  = traceColors;
            GradientDialog._spectrumFill = spectrumFill;
            if (GradientDialog._form == null || GradientDialog._form.IsDisposed)
            {
                GradientDialog._form = new GradientDialog();
            }
            GradientDialog._form.TopMost = true;
            GradientDialog._form.Text    = parent + " color editor";
            string a = parent.Substring(0, 1);

            GradientDialog._form.saButton.BackColor = ((a != "S") ? SystemColors.Control : Color.LightGreen);
            GradientDialog._form.wfButton.BackColor = ((a != "W") ? SystemColors.Control : Color.LightGreen);
            GradientDialog._form.agButton.BackColor = ((a != "A") ? SystemColors.Control : Color.LightGreen);
            if (a != "S")
            {
                GradientDialog._form.trackBar.Top = GradientDialog._form.groupBox1.Top + 4;
            }
            else
            {
                GradientDialog._form.trackBar.Top = GradientDialog._form.groupBox1.Top + GradientDialog._form.groupBox1.Height - GradientDialog._form.picBox.Height - GradientDialog._form.trackBar.Height - 4;
            }
            GradientDialog._form.picBox.Top = GradientDialog._form.trackBar.Top + GradientDialog._form.trackBar.Height;
            for (int i = 1; i <= 5; i++)
            {
                RadioButton radioButton = (RadioButton)GradientDialog._form.Controls["btn" + i.ToString()];
                radioButton.Checked = false;
                if (i == GradientDialog._blendIndex)
                {
                    radioButton.Checked = true;
                }
            }
            GradientDialog._form.okButton.Enabled = false;
            if (!GradientDialog._form.Visible)
            {
                GradientDialog._form.ShowDialog();
            }
            else
            {
                GradientDialog._form.Activate();
            }
        }
Example #6
0
 private void signalGradientChanged()
 {
     this.okButton.Enabled = true;
     if (base.Visible && GradientDialog.GradientChanged != null)
     {
         int num = GradientDialog._blendIndex - 1;
         GradientDialog._blends[num]       = GradientDialog._form.GetColorBlend();
         GradientDialog._traceColors[num]  = this.traceButton.BackColor.ToArgb();
         GradientDialog._backgrounds[num]  = this.backgroundButton.BackColor.ToArgb();
         GradientDialog._spectrumFill[num] = GradientDialog._form.cmbFill.SelectedIndex;
         string text = this.Text.Substring(0, 1);
         if (text == " ")
         {
             text = "S";
         }
         GradientDialog.GradientChanged(this, new GradientEventArgs(text, GradientDialog._blendIndex, GradientDialog._blends[num], GradientDialog._backgrounds[num], GradientDialog._traceColors[num], GradientDialog._spectrumFill[num]));
     }
 }