Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

[PLAIN]Reading Color values from registry won't work? Help! [resolved][/PLAIN]

 

Hello,

I created some entries in the registry where I want to save my colors.

 

It saves it in the registry as

 

Name: Background

Type: REG_DWORD

Data: ff400000

 

When I try to read it with

 

regKey = Registry.LocalMachine.OpenSubKey("Software\testprogram\colors", True)

msgbox(regKey.GetValue("background"))

 

I am getting a value of -12345902

 

I can't figure out how to get the "ff400000" value

then the other problem is how can I put it back as a background

color

 

Me.BackColor = "ff400000" won't work..

 

Can someone help me with these 2 little problems.

Thanks so much.

Edited by mrdutchie
  • Leaders
Posted

here's way 1 ( the value you get is the Integer value of the ffxxxx )

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Me.BackColor = Color.FromArgb(-12345902)
   End Sub

  • Leaders
Posted

also you can convert html colors etc ...


   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

       Dim c As ColorTranslator

       Dim i As Color = c.FromHtml("#ff400000")
       Me.BackColor = i

   End Sub

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...