Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 545057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:43:16+00:00 2026-05-13T10:43:16+00:00

I’ve looked around, but don’t see this question – maybe its too easy, but

  • 0

I’ve looked around, but don’t see this question – maybe its too easy, but I don’t have it.

If I have file containing color values like:

255,
65535,
65280 ( I think this is green)

is there a way to either:

  1. convert these to a System.Drawing.Color type or….better yet..
  2. have .NET accept them as is to represent the color?

thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:43:16+00:00Added an answer on May 13, 2026 at 10:43 am

    From your comments on an earlier version of this answer it seems that each number in the file represents one colour, and that these are packed bytes:

    65280 (= 0xFF00) -> (0, 255, 0)
    65535 (= 0xFFFF) -> (255, 255, 0)
    

    So you want the low byte in the first (red?) part of the triple, and the next higher byte in the second (blue?) part of the triple. I am guessing that values over 65535 would go into the third byte of the triple.

    You can do this easily using bit masking and bit shift operators:

    int r = n && 0xFF;
    int g = (n >> 8) & 0xFF;
    int b = (n >> 16) & 0xFF;
    

    i.e. shift it right by 8 bits each time, and select out the bottom 8 bits.

    NOTE: You can also do this directly using Color.FromArgb(Int32), which saves you from having to do the unpacking. But this will only work if the numbers in your file are packed in the right way. They would need to be in AARRGGBB format. For example, 255 (0x000000FF) = Blue, 65280 (0x0000FF00) = Green, 16711680 (0x00FF0000) = Red. I am not sure whether your numbers are in the right order which is why I have covered the explicit unpacking technique.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This could be a duplicate question, but I have no idea what search terms
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.