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 6872403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:55:24+00:00 2026-05-27T03:55:24+00:00

These numbers are stored in the Database. They origionate from Delphi code. Although I

  • 0

enter image description here

These numbers are stored in the Database. They origionate from Delphi code. Although I assume they follow some kind of standard. I have tried Color.FromArgb(255);

But i know for a fact that the first is RED (in the delphi side), where as in ASP.NET it thinks its blue Color [A=0, R=0, G=0, B=255]

I want these numbers into Hexidecimal anyway. I.e. #000000 , #FFFF99 etc etc

Anyone know how to conver these Integers (see DB Picture) to Hexidecimal.

  • 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-27T03:55:25+00:00Added an answer on May 27, 2026 at 3:55 am

    Delphi colors (TColor) are XXBBGGRR when not from a palette or a special color.

    See this article for more detail on the format (And other special cases). The article pointed by Christian.K also contains some details on the special cases.

    Standard colors

    To convert to a standard color you should use something like :

    var color = Color.FromArgb(0xFF, c & 0xFF, (c >> 8) & 0xFF, (c >> 16) & 0xFF);
    

    To convert to hex, :

    string ColorToHex(Color color)
    {
        return string.Format("#{0:X2}{1:X2}{2:X2}",
            color.R, color.G, color.B);
    }
    

    System colors

    For system colors (negative values in your database), they are simply the windows constants masked by 0x80000000.

    Thanks to David Heffernan for the info.

    Sample code

    Color DelphiColorToColor(uint delphiColor)
    {
        switch((delphiColor >> 24) & 0xFF)
        {
            case 0x01: // Indexed
            case 0xFF: // Error
                return Color.Transparent;
    
            case 0x80: // System
                return Color.FromKnownColor((KnownColor)(delphiColor & 0xFFFFFF));
    
            default:
                var r = (int)(delphiColor & 0xFF);
                var g = (int)((delphiColor >> 8) & 0xFF);
                var b = (int)((delphiColor >> 16) & 0xFF);
                return Color.FromArgb(r, g, b);
        }
    }
    
    void Main()
    {
        unchecked
        {
            Console.WriteLine(DelphiColorToColor((uint)(-2147483646)));
            Console.WriteLine(DelphiColorToColor(
                    (uint)KnownColor.ActiveCaption | 0x80000000
                ));
            Console.WriteLine(DelphiColorToColor(0x00FF8000));
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing an algorithm to generate combinations of items from a database. They
I have a PHP array with numbers of ID's in it. These numbers are
Is there a standard idiom for comparing version numbers? I can't just use a
I'm maintaining a low-traffic shop website that stores credit card numbers in the database.
I am moving some scripts from a Linux box to a Windows box, but
My page shows posts stored in my Database through a loop. Each post is
I'm importing a database dump from one Oracle 10g installation into another. The source
I'm developing a database which includes contact information. PhoneNumbers are stored in a separate
I have an SQLite database stored in the assets resources of one application used
I am pulling dates out of an Oracle database. They are set on a

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.