Re: Bitmap to Icon



What I'm doing is reading an .ico file then converting it to a bitmap which I
then resize. I make the background color transparent then convert it back to
an icon file. The resulting bitmap after resizing shows ok with the
background color black transparent but the resulting icon doesn't have the
background color black transparent.

"Ken Tucker [MVP]" wrote:

> Hi,
>
> Dim bm As New Bitmap(16, 16)
>
> Dim g As Graphics = Graphics.FromImage(bm)
>
> g.Clear(Color.Black)
>
> g.DrawEllipse(Pens.White, 0, 0, 16, 16)
>
> bm.MakeTransparent(Color.Black)
>
> Dim ico As Drawing.Icon
>
> ico = Drawing.Icon.FromHandle(bm.GetHicon)
>
> Me.Icon = ico
>
>
>
> Ken
>
> ----------------------
>
> "Dennis" <Dennis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:AB3327BE-8C84-4350-9645-89013882D072@xxxxxxxxxxxxxxxx
> I have created a bitmap and set the transparency color to black;
>
> mybitmap.MakeTransparent(Color.Black)
> myicon = Icon.FromHandle(bm.GetHicon)
>
> This creates the icon ok but the background color black is not transparent.
>
> How do I create an Icon from this bitmap that has also the color black
> transparent?
>
>
> --
> Dennis in Houston
>
>
>
.



Relevant Pages

  • Having trouble with picture control VS.NET Unmanaged C++.
    ... I've dropped a picture control onto a dialog & loaded a bitmap using a ... The "Transparent" property of the picture ... bitmap somehow to get the background color to be transparent? ...
    (microsoft.public.win32.programmer.ui)
  • Re: How to make an eraser -- need new CompositingMode?
    ... brush of the background color, set the SmoothingMode to AntiAlias and ... My background is alpha 0 (transparent). ... > create a Graphics from that Bitmap, and draw into it a path gradient fill ...
    (microsoft.public.dotnet.framework.drawing)
  • Making systray icon color transparent!
    ... I have a notify icon and have been trying to make the background color ... But do .ico files allow a transparent color? ... the image for the notify icon it askes for type .ico. ...
    (microsoft.public.dotnet.languages.csharp)
  • Setting the transparency color of a bitmap
    ... I have a method i found for setting the background of a bitmap ... transparent but its slow must be an easier way than saving the image ... then setting all the pixels to the background color. ... graphics.Clear and the transparent color but no luck, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Filled polygons print to PDF as opaque
    ... I cross posted this question to the Adobe Acrobat Windows users forum. ... transparent patterns) and the PDF driver uses PostScript to do the heavy ... your implication is that I'm stuck with a bitmap if I want ... Brush m_BG = new SolidBrush; ...
    (microsoft.public.dotnet.framework.drawing)