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

  • SEARCH
  • Home
  • 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 417855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:37:17+00:00 2026-05-12T18:37:17+00:00

I want to be able to store a backgroundcolor for a panel in my

  • 0

I want to be able to store a backgroundcolor for a panel in my application in the database.

The value can be either a concrete color or empty, indicating it has been inherited from the parent.

I wanted to store this in an int-field that is non-nullable, by calling the System.Drawing.Color.ToArgb() method.

The return value of this method seems to be -1 for white, and -16777216 for black…

So I was thinking that for indicating the no color has been selected, I could store a positive integer. This would offer a very simple way to check whether an explicit color has been stored or no color has been stored.

Now I was wondering whether there is a legimitate reason why System.Drawing.Color.ToArgb() could ever return positive values. (What’s the range of possible return values for this function).

I haven’t been tampering around with the alpha channel, so I don’t know whether that would have influence….

If I’m not able to store a positive integer to indicate the abscence of an explicit color, I guess I will just have to make the field nullable….

  • 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-12T18:37:17+00:00Added an answer on May 12, 2026 at 6:37 pm

    Well, you get a 32-bit integer containing Alpha, Red, Green and Blue, each of them filling 8 bits.

    The alpha value is in the highest-order 8 bits so for every non-transparent color you have those at 0xFF (which automatically makes that integer negative, if it’s a signed integer).

    So if your alpha value drops below 128 (0x80) you will get positive color values.

    The range of possible return values for that function is indeed 0x00000000 to 0xFFFFFFFF, in other words: every possible 32-bit integer. For a signed int this is −2147483648 to +2147483647.

    In your case I’d definitely go with allowing NULL values, since that’s actually what you want here. If you drop the alpha value altogether you have another 8 bits for information, though. So you could then implement it checking for negative/non-negative values.

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

Sidebar

Related Questions

I want to be able to store information about a song that has been
I want to be able to store PHP code in an SQL Database and
I want to be able to store my database information in a pom.xml (as
I want to be able to store a decimal value in one column, and
I want to be able to store (not echo) some data that has been
In Rails application I want to be able to store schema-less objects -- JSON
I'm using Django and want to be able to store classes in a database
I want to be able to store objects in my database with a version.
I want to be able to store various Canvas items in seperate XAML files
I'll be very simple: I want to be able to store Java objects from

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.