Jump to content
Xtreme .Net Talk

Recommended Posts

  • Administrators
Posted

It is actually converting to a full ARGB format rather than just RGB (the A is the alpha channel).

If you only require the RGB components you could always mask out the A part

Dim c As Color = Color.Red
Dim i, j As Int32
i = c.ToArgb
j = c.ToArgb
i = i And &HFFFFFF

MessageBox.Show(j.ToString("X"))
MessageBox.Show(i.ToString("X"))

the above code does the same as before but j is the full ARGB and i will just be the RGB values.

Out of interest what will you be doing with the Hex values? If you plan on converting back to a colour with the Color.FromARGB() function then you are better of using the full 32-bit ARGB value.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...