[SOLVED] Color.FromName problem

Answered
0
0

Hi,

create a CheckBox and put this code

Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
If sender.Checked = False Then
sender.BackColor = System.Drawing.Color.FromName("@buttonFace")
Else
sender.BackColor = System.Drawing.Color.FromName("@invalid")
End If
End Sub

 

the color don’t change if I use Color.FromName, if I use Color.FromArgb or a fixed color as Color.Red, it’s work

Next, in the first case it work if you remove @ char from buttonFace,

but this don’t work for the color @invalid to invalid.

the strange thing is that in design it works with this code:

Me.CheckBox1.BackColor = System.Drawing.Color.FromName(“@invalid”)

but not a runtime, the argb  is all 0,0,0,0

I use VBNET and wisej 1.4.95.0

regards

Cristian

  • You must to post comments
Best Answer
0
0

For theme colors use Application.Theme.GetColor(“buttonFace”). System.Drawing doesn’t know how to handle theme named colors.

  • You must to post comments
0
0

Hi Luca

perfect!

thank you

Cristian

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.