Hex Color to RGB

G

Guest

Hi

Visual Basic 6 uses for the color format something like &H0000000&
How can I convert a color of this format to RGB for use in the .NET
I need this because the data I use are already stored in a database for use
in a Visual Basic 6 Application.

Thanks in advance
 
P

Phill. W

Diomatas said:
Visual Basic 6 uses for the color format something like &H0000000&
How can I convert a color of this format to RGB for use in the .NET

Color.FromArgb( Integer ) is the most likely candidate, as in

Dim c as Color _
= Color.FromArgb( &H000000& )

Or, of you have access to the RGB components instead,

c = Color.FromArgb( R, G, B )

HTH,
Phill W.
 
H

Herfried K. Wagner [MVP]

Diomatas said:
Visual Basic 6 uses for the color format something like &H0000000&
How can I convert a color of this format to RGB for use in the .NET
I need this because the data I use are already stored in a database for
use
in a Visual Basic 6 Application.

'Dim c As Color = Color.FromArgb(&H0000000)'

For OLE colors:

'Dim c As Color = ColorTranslator.FromOle(&H0000000)'.

'Color' has 'R', 'G', and 'B' properties.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top