Click here to Skip to main content
15,886,806 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: GDI+ vs DirectX Pin
Christian Graus6-Nov-02 22:23
protectorChristian Graus6-Nov-02 22:23 
GeneralInstallation tool Pin
Patrick Lassalle6-Nov-02 10:25
Patrick Lassalle6-Nov-02 10:25 
GeneralRe: Installation tool Pin
Heath Stewart6-Nov-02 19:43
protectorHeath Stewart6-Nov-02 19:43 
GeneralRe: Installation tool Pin
Patrick Lassalle7-Nov-02 6:13
Patrick Lassalle7-Nov-02 6:13 
GeneralRe: Installation tool Pin
Daniel Turini7-Nov-02 7:20
Daniel Turini7-Nov-02 7:20 
GeneralRe: Installation tool Pin
Heath Stewart7-Nov-02 9:51
protectorHeath Stewart7-Nov-02 9:51 
GeneralRe: Installation tool Pin
Patrick Lassalle7-Nov-02 23:20
Patrick Lassalle7-Nov-02 23:20 
GeneralConverting an Icon to Image...with Alpha Blending Pin
Heath Stewart5-Nov-02 13:34
protectorHeath Stewart5-Nov-02 13:34 
Converting an Icon to an Image is easy: Image img = ico.ToBitmap() - except when you need alpha blending. After digging through the IL for Icon.ToBitmap(), the concept is simple and helped me find some .NET docs that discussed off-screen rending with alpha channels. The following code should work:
Image img = new Bitmap(16, 16, PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(img);
g.CompositingMode = CompositingMode.SourceCopy;
g.DrawIcon(Icon.FromHandle(hIcon), 0, 0);
g.Dispose();

If I display img in a PictureBox or draw it in a form's graphics object, the alpha channel is all black. If, instead, I draw the icon directly on the form, the alpha channel is blended accordingly.

I've also tried filling the graphics object for the Bitmap img with SystemColors.Control (default for Form, etc.) and then drawing the icon after setting the compositing mode, but that doesn't work either.

Has anyone successfully done this? I'm trying to make a wrapper component for SHGetFileInfo which works pretty well except for the whole alpha blending problem described above. TIA

"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
GeneralRe: Converting an Icon to Image...with Alpha Blending Pin
Heath Stewart6-Nov-02 8:29
protectorHeath Stewart6-Nov-02 8:29 
GeneralUPDATE Statements Pin
Derek Lakin4-Nov-02 22:17
Derek Lakin4-Nov-02 22:17 
GeneralC# vs VC++ Pin
Stefan Bolder2-Nov-02 22:41
sussStefan Bolder2-Nov-02 22:41 
GeneralRe: C# vs VC++ Pin
ian mariano3-Nov-02 7:56
ian mariano3-Nov-02 7:56 
GeneralRe: C# vs VC++ Pin
Kevin McFarlane4-Nov-02 3:48
Kevin McFarlane4-Nov-02 3:48 
GeneralRe: C# vs VC++ Pin
Kevin McFarlane4-Nov-02 3:44
Kevin McFarlane4-Nov-02 3:44 
GeneralRe: C# vs VC++ Pin
Boogie6-Nov-02 12:38
Boogie6-Nov-02 12:38 
GeneralRe: C# vs VC++ Pin
Kevin McFarlane7-Nov-02 5:41
Kevin McFarlane7-Nov-02 5:41 
GeneralStreamReading Cyrillic (windows) Encoding Pin
devmaximus2-Nov-02 14:22
devmaximus2-Nov-02 14:22 
GeneralRe: StreamReading Cyrillic (windows) Encoding Pin
Stephane Rodriguez.2-Nov-02 19:18
Stephane Rodriguez.2-Nov-02 19:18 
GeneralRe: StreamReading Cyrillic (windows) Encoding Pin
Richard Deeming4-Nov-02 2:40
mveRichard Deeming4-Nov-02 2:40 
GeneralRe: StreamReading Cyrillic (windows) Encoding Pin
Anonymous4-Nov-02 8:56
Anonymous4-Nov-02 8:56 
GeneralRe: StreamReading Cyrillic (windows) Encoding Pin
Anonymous4-Nov-02 11:24
Anonymous4-Nov-02 11:24 
GeneralRe: StreamReading Cyrillic (windows) Encoding Pin
devmaximus4-Nov-02 11:56
devmaximus4-Nov-02 11:56 
Questionimage encoder? Pin
Stefan Bolder2-Nov-02 0:17
sussStefan Bolder2-Nov-02 0:17 
AnswerRe: image encoder? II Pin
Stefan Bolder2-Nov-02 0:41
sussStefan Bolder2-Nov-02 0:41 
GeneralRe: image encoder? II Pin
Stephane Rodriguez.2-Nov-02 1:52
Stephane Rodriguez.2-Nov-02 1:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.