DrewNaylor / UXL-Launcher

An app launcher meant to launch Microsoft Office 2010, 2013, 2016, 2019 desktop software/apps, including ones from Office 365. Not associated with Microsoft.
Apache License 2.0
7 stars 1 forks source link

Allowing applications to create a pre-themed control using the current theme's properties would be useful. #203

Closed DrewNaylor closed 3 years ago

DrewNaylor commented 3 years ago

As it stands, controls aren't themed if they're added to a form after the theme is applied. Maybe there could be a class that has something like this:

Public Class PreThemedControls

Public Shared Function Button()

Dim PreThemedButton As New Button

PreThemedButton.BackColor = ThemeProperties.ButtonBackColor

PreThemedButton.ForeColor = ThemeProperties.ButtonForeColor

PreThemedButton.FlatStyle = ThemeProperties.ButtonFlatStyle

If PreThemedButton.FlatStyle = FlatStyle.Flat Then
(flat stuff like the button border and mouse down colors)
End If

(anything else that's required)

Return PreThemedButton

End Function

End Class

Then in the form:

(other stuff for the form)

Private Sub AddNewButton_Click( (button click event handler) )

Dim NewButton As New Button

If My.Settings.AllowThemes = True Then
NewButton = PreThemedControls.Button
End If

NewButton.Text = "new pre-themed button"

Form.Controls.Add(NewButton)

End Sub

(the rest of the form class)