How to make button background transparent?

28,270

Solution 1

Give this a shot.

'Making Existing Button Transparent
btnKasa.FlatStyle = Windows.Forms.FlatStyle.Flat
btnKasa.FlatAppearance.BorderSize = 0
btnKasa.FlatAppearance.MouseDownBackColor = Color.Transparent
btnKasa.FlatAppearance.MouseOverBackColor = Color.Transparent
btnKasa.BackColor = Color.Transparent

Solution 2

Another option that I came up with is to call:

SetStyle(ControlStyles.SupportsTransparentBackColor, True)

when the form is created (e.g. in the constructor after InitializeComponent()). The button's BackColor is set to Transparent, as well (this can be done in code behind or in the properties).

Share:
28,270
Hoh
Author by

Hoh

SQL and VB.NET Developer Regular streamer at LiveCoding.tv where I am creating various projects of mine. You can also see me "playing" with HTML and CSS from time to time.

Updated on July 05, 2022

Comments

  • Hoh
    Hoh almost 2 years

    I have created one button and applied image (.png with transparent background) on it.
    enter image description here
    My button background is set on transparent but as you can see the background color is still there.
    How can I make this work as it should?

  • Hoh
    Hoh over 9 years
    This could be a solution also, but that just make all button background in form to be transparent. +1 anyway
  • phrebh
    phrebh over 6 years
    This can also be done through the property sheet. +1 for giving the properties I was looking for.