Ejemplo n.º 1
0
 void OnNewColor(NewColorArgs e)
 {
     currentColor = e.NewColor;
     if (NewColor != null)
     {
         NewColor(this, e);
     }
 }
Ejemplo n.º 2
0
        void InitializeColorTextBoxString(Color color, string sender)
        {
            bool  useTransparent = false;
            Color knownColor     = Color.Empty;
            bool  bKnownColor    = true;

            if (sender == "CustomTab" || sender == null)
            {
                bKnownColor = ColorUtil.IsKnownColor(color, ref knownColor, useTransparent);
            }
            else
            {
                knownColor = color;
            }

            if (bKnownColor)
            {
                color = knownColor;
                // update color in dropdown part
                colorTextBox.Text = color.Name;
            }
            else
            {               // Format rgb string
                string sep = ",";
                string rgb = color.R.ToString() + sep + color.G.ToString() + sep + color.B.ToString();
                colorTextBox.Text = rgb;
            }

            colorDropDown.CurrentColor   = color;
            colorTextBox.SelectionLength = 0;
            colorTextBox.SelectionStart  = colorTextBox.Text.Length + 1;

            // Fire event to whoever is listening
            if (sender != null)
            {
                NewColorArgs nca = new NewColorArgs(color);
                OnNewColor(nca);
            }
        }
Ejemplo n.º 3
0
 void OnNewColor(NewColorArgs e)
 {
     currentColor = e.NewColor;
       if ( NewColor != null )
     NewColor(this, e);
 }
Ejemplo n.º 4
0
        void InitializeColorTextBoxString(Color color, string sender)
        {
            bool useTransparent = false;
              Color knownColor = Color.Empty;
              bool bKnownColor = true;
              if ( sender == "CustomTab" || sender == null )
            bKnownColor = ColorUtil.IsKnownColor(color, ref knownColor, useTransparent);
              else
            knownColor = color;

              if ( bKnownColor )
              {
            color = knownColor;
            // update color in dropdown part
            colorTextBox.Text = color.Name;
              }
              else
              {   // Format rgb string
            string sep = ",";
            string rgb = color.R.ToString() + sep + color.G.ToString() + sep + color.B.ToString();
            colorTextBox.Text = rgb;

              }

              colorDropDown.CurrentColor = color;
              colorTextBox.SelectionLength = 0;
              colorTextBox.SelectionStart = colorTextBox.Text.Length + 1;

              // Fire event to whoever is listening
              if ( sender != null )
              {
            NewColorArgs nca = new NewColorArgs(color);
            OnNewColor(nca);
              }
        }