Results 1 to 3 of 3

Thread: [2.0] How do the default colors work?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,547

    [2.0] How do the default colors work?

    Sorry, but if I don't ask this, it is going to drive me nuts.

    I found myself today looking at System.Drawing.Color and looked at the default colors and followed them a bit but I don't get how they are resolved.

    Color.AliceBlue
    csharp Code:
    1. public static Color AliceBlue
    2. {
    3.     get
    4.     {
    5.         return new Color(KnownColor.AliceBlue);
    6.     }
    7. }

    Color(KnownColor)
    csharp Code:
    1. internal Color(KnownColor knownColor)
    2. {
    3.     this.value = 0x0L;
    4.     this.state = StateKnownColorValid;
    5.     this.name = null;
    6.     this.knownColor = (short) knownColor;
    7. }

    Where does it resolve what the known colors value is?

    I checked Color.A to see if when you access it, it resolves it, But it doesn't...

    csharp Code:
    1. public byte A
    2. {
    3.     get
    4.     {
    5.         return (byte) ((this.Value >> 0x18) & 0xffL);
    6.     }
    7. }


    Where is the known color resolved?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] How do the default colors work?

    KnownColor is an enumeration. The Color structure simply uses a switch statement or the like to create Color values from KnownColor values.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,547

    Re: [2.0] How do the default colors work?

    Quote Originally Posted by jmcilhinney
    KnownColor is an enumeration. The Color structure simply uses a switch statement or the like to create Color values from KnownColor values.
    But where? I followed the Get{} for White and it didn't lead me to a switch or anything.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width