Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27517

VS 2012 How to change themes/skins of controls programmatically?

$
0
0
Hello again everyone, long time no post.
Is there a way you can change between themes on VB.Net?
I planned something for my application, where the user should have the ability to change from the default skin that VB.Net offers for the controls to a costumized skin.
I have a custom skin, which I grabbed from the Internet. It's just a class that has several controls drawn programmatically, instead of Windows drawing them on his own.
I have a form where I have 3 radio buttons, whose when checked will change to theme that they correspond to. So far I'm only trying with the Default Theme and a customized theme (Modern Theme).
Here's a piece of code which I thought would work:

Code:

If rbDefaultTheme.Checked = False And rbSoftTheme.Checked = False And rbModernTheme.Checked = True Then
                Me.ComboBox1 = New WindowsApplication4.ReactorComboBox
                Me.ComboBox1.FormattingEnabled = True
                Me.ComboBox1.Location = New System.Drawing.Point(12, 273)
                Me.ComboBox1.Name = "ComboBox1"
                Me.ComboBox1.Size = New System.Drawing.Size(121, 21)
                Me.ComboBox1.TabIndex = 13
            ElseIf rbDefaultTheme.Checked = True And rbSoftTheme.Checked = False And rbModernTheme.Checked = False Then
              Me.ComboBox1 = New System.Windows.Forms.ComboBox()
                Me.ComboBox1.FormattingEnabled = True
                Me.ComboBox1.Location = New System.Drawing.Point(12, 273)
                Me.ComboBox1.Name = "ComboBox1"
                Me.ComboBox1.Size = New System.Drawing.Size(121, 21)
                Me.ComboBox1.TabIndex = 13
            End If

I think I found out why this doesn't work, when I run the debug and click the radio buttons the combobox does not change its appearance or layout for that matter.
I went into the designer (and I do mean the designer, not the Design!) and I found the following line:

Code:

Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
So does this mean that the variable ComboBox1 will have be of the type System.Windows.Forms.ComboBox?
I can't believe this, because I've already seen several apps where the user can choose the skin of the application itself. Hell, even Windows has this...
I must be on the wrong approach. May anyone point me the right path please?

Viewing all articles
Browse latest Browse all 27517

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>