so I'm trying to make it so that text over the BackColor will change depending on how Light/dark the BackColor is, so that you can see the text.
So say I pick a dark color then the text should be white, but if I pick a white color then the text should be dark.
This is what I have done so far but it doesn't seem to work:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Using colorDialog As New ColorDialog
If colorDialog.ShowDialog() = DialogResult.OK Then
My.Settings.TextBackground = colorDialog.Color
UpdateTextBack(sender, e)
End If
End Using
End sub
Private Sub UpdateTextBack(sender As Object, e As EventArgs)
HTML_Edit.RichTextBox1.BackColor = My.Settings.TextBackground
Text_Edit.RichTextBox1.BackColor = My.Settings.TextBackground
Button2.BackColor = My.Settings.TextBackground
If My.Settings.TextBackground.GetBrightness < 0.5 Then
Button1.ForeColor = Color.White
Else
Button2.ForeColor = Color.Black
End If
End Sub
Aucun commentaire:
Enregistrer un commentaire