Results 1 to 2 of 2

Thread: [RESOLVED] Image with Transparent baclground button on window form

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Location
    Texas
    Posts
    246

    Resolved [RESOLVED] Image with Transparent baclground button on window form

    I have a button my my form and for the Image property for the button I used a png. The png has a transparent background but when I view the form it shows a white background around the image.

    I've googled on how to make the image but haven't really found any code that works. This is the last thing I've tried.

    Form_Load
    Code:
    SetStyle(ControlStyles.SupportsTransparentBackColor, True)
    Me.BackColor = Color.Transparent
    Me.Button2.BackColor = Color.Transparent
    Does anyone know how I can make the image transparent?

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Location
    Texas
    Posts
    246

    Re: Image with Transparent baclground button on window form

    I found an answer to my question. This is the property settings on how to do it. I thought I would post this because there may be others with the same question. It took me a long time to find it. No code needed.

    Image = optionalPNGImage //should be 32bpp (alpha channel enabled)
    BackColor = Color.Transparent;
    FlatStyle = FlatStyle.Flat;
    FlatAppearance.BorderSize = 0;
    FlatAppearance.MouseDownBackColor = Color.Transparent;
    FlatAppearance.MouseOverBackColor = Color.Transparent;
    ForeColor = System.Drawing.Color.White;
    Text = "Hello";

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width