Click here to Skip to main content
15,895,462 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
Hi all,

I have added an .gif with transparent background to my winforms application and have noticed it creates a white border around my logo is there a way to remove this?
Posted
Comments
Sinisa Hajnal 22-Sep-14 6:17am    
White border is probably background color of your window as seen through transparent parts of your logo image...can you verify this?
BillWoodruff 22-Sep-14 6:17am    
Did you create this graphic; if so, what did you use to create it ? If you created it, did you use anti-aliasing (feathering) on its border ?

How have you added the graphic ? Did you assign it to the 'Image property of a 'PictureBox, or make it the BackGroundImage of some Control ?
Ivan Lubbe 22-Sep-14 8:22am    
I created it myself in photoshop. Yes i believe anti-aliasing was on when i created it. I added it via pictureEdit Box (dev-express component for visual studio) I managed to get a temporary work around but not ideal at all. I have changed the background to the same colour as seen in my applications GUI

1 solution

You are not alone in being bedeviled by Gif's notorious "white halo" effect.

I have no idea how the DevExpress component behaves and whether it "respects" the 1-bit color-index transparency of .Gif files, or not.

Did you consider producing a 32-bit .png file that has a "real" Alpha channel ... assuming you did not choose .Gif for its animation facility ... ?

I've had fair results with .png's with transparency where I carefully clean-up the border of the content layer (without anti-aliasing), then take a screen snap of the UI, set that snap as the background layer of the PhotoShop document (one layer below the content layer), then use the Magic Wand to select the background in the content layer, and use Select/Feather to create the anti-aliasing.

But, in general, as I think you might know, Win Forms just ain't that good with any use of transparency. For transparency, WPF is where you want to go.

Here's a good resource on optimizing settings for transparent Gif files in PhotoShop: [^].

Here's another link that may, or may not, be helpful: [^].

Gotcha's to watch for with trying-to-be transparent Gifs are: any scaling, or re-sampling of the Gif image.
 
Share this answer
 
Comments
Ivan Lubbe 23-Sep-14 2:32am    
Thank you so much for the assistance :D I originally had it as a .jpg then i read up that i required a .gif for transparency. I used the .png and followed your instructions and after a few attempts i finally got it sorted! Thanks again.

Ivan

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900