views:

835

answers:

3

Hi, Is there any way to use this kind of format in .Net (C#)? I want to use the same skin format that uTorrent uses in my app, but i can't get the transparent background. Any ideas? Thanks for your time.

+2  A: 

The PixelFormat enumeration lists the formats of 'bitmaps' you can create in .Net, so you'd want PixelFormat.Format32bppArgb:

http://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat.aspx

http://msdn.microsoft.com/en-us/library/3z132tat.aspx

However I'm not entirely sure that the BMP file format supports transparency - so you would have to save the file as perhaps a PNG file instead.

samjudson
sam is correct. BMP does not support an alpha channel. Transparency in bitmaps is usually done the chroma-key way (select one color to be 100% transparent).PNG will be the optimal choice here.
Boo
A: 

Still, I can't get the same effect.

Matías
Did you make any progress on this?
pabloide86
+3  A: 

You need to do two things:

  • Copy your bitmap onto the form as background.
  • Call the UpdateLayeredWindow (user32.dll) to enable per-pixel alpha transparency.

The code is a liitle bit bulky, but here is a very nice sample application with source code: Per Pixel Alpha Blend in C#

Ishmaeel
thanks, I will try that
Matías