System.Drawing.Color.ToString C# (CSharp) 메소드

ToString() 공개 메소드

public ToString ( ) : string
리턴 string
        public override string ToString()
        {
            if ((state & StateNameValid) != 0 || (state & StateKnownColorValid) != 0)
            {
                return nameof(Color) + " [" + Name + "]";
            }
            else if ((state & StateValueMask) != 0)
            {
                return nameof(Color) + " [A=" + A.ToString() + ", R=" + R.ToString() + ", G=" + G.ToString() + ", B=" + B.ToString() + "]";
            }
            else
            {
                return nameof(Color) + " [Empty]";
            }
        }

Usage Example

        public Route(string s)
        {
            if (s.Length > 0)
            {
                rs = s;
                Random rndm = new Random();
                //color = RandomColor();
                color = RandomColorHSV(rndm.Next(), 0.5, 0.95);
                Console.WriteLine("RandomColor {0}", color.ToString());
                //color = Color.

                string[] ns = s.Split();
                nodes = new int[ns.Length];

                //if (ns.Length < 2) { throw new Exception("Route must have at least 2 nodes length"); }
                for (int i = 0; i < ns.Length; i++)
                {
                    nodes[i] = int.Parse(ns[i]);
                }
            }
            else {
                Console.WriteLine("Empty route");
                throw new Exception("Empty route");
            }
        }
All Usage Examples Of System.Drawing.Color::ToString