How to make all labels backcolor as transparent in VB.NET in Visual Studio

If you have a winform with a background image then you would notice that the label background colour will not match the background so it will look like this.



NB: You can also use the properties to make the label Transparent. The Transparent option is available in the Web colors.


Step 1

But you can easily do it in the code by this code

tlblName.BackColor= Color.Transparent

Step 2

If you have a number of labels on the form then you can loop through each and make the background  colour transparent.








Here is a code to make the background of the label as transparent.

For Each formLabel As Label In Me.Controls.OfType(Of Label)()
            formLabel.BackColor = Color.Transparent
        Next formLabel