|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Converting BitMap to IconI have a bitmap and make the color transparent;
mybitmap.MakeTransparent(Color.Black) When I save it as a Icon, the black color is not transparent. However, if I save it as a bitmap then display it using windows explorer, the black color is in fact transparent. Could it be that the bitmap is not an alpha bitmap that causes the icon to not have the black color transparent? -- Dennis in Houston Hi,
Even when I save a icon with its back color as color.transparent it shows up with a black background in windows explorer. Dim bm As New Bitmap(16, 16) Dim ico As Icon Dim g As Graphics = Graphics.FromImage(bm) g.Clear(Color.Transparent) g.FillEllipse(Brushes.Red, 0, 0, 16, 16) g.Dispose() Dim ptr As IntPtr = bm.GetHicon ico = Icon.FromHandle(ptr) Me.Icon = ico Dim fs As New System.IO.FileStream("Test.ico", IO.FileMode.Create) ico.Save(fs) fs.Close() Ken ----------------------------- "Dennis" <Den***@discussions.microsoft.com> wrote in message I have a bitmap and make the color transparent;news:9247C07B-8759-4737-9760-E84C25851E62@microsoft.com... mybitmap.MakeTransparent(Color.Black) When I save it as a Icon, the black color is not transparent. However, if I save it as a bitmap then display it using windows explorer, the black color is in fact transparent. Could it be that the bitmap is not an alpha bitmap that causes the icon to not have the black color transparent? -- Dennis in Houston Thanks I'll try it.
-- Show quoteHide quoteDennis in Houston "Ken Tucker [MVP]" wrote: > Hi, > > Even when I save a icon with its back color as color.transparent it > shows up with a black background in windows explorer. > > Dim bm As New Bitmap(16, 16) > > Dim ico As Icon > > Dim g As Graphics = Graphics.FromImage(bm) > > g.Clear(Color.Transparent) > > g.FillEllipse(Brushes.Red, 0, 0, 16, 16) > > g.Dispose() > > Dim ptr As IntPtr = bm.GetHicon > > ico = Icon.FromHandle(ptr) > > Me.Icon = ico > > Dim fs As New System.IO.FileStream("Test.ico", IO.FileMode.Create) > > ico.Save(fs) > > fs.Close() > > > > Ken > > ----------------------------- > > "Dennis" <Den***@discussions.microsoft.com> wrote in message > news:9247C07B-8759-4737-9760-E84C25851E62@microsoft.com... > I have a bitmap and make the color transparent; > > mybitmap.MakeTransparent(Color.Black) > > When I save it as a Icon, the black color is not transparent. However, if I > save it as a bitmap then display it using windows explorer, the black color > is in fact transparent. Could it be that the bitmap is not an alpha bitmap > that causes the icon to not have the black color transparent? > > -- > Dennis in Houston > > > This creates an icon with a red circle and black background. I want to take
an existing bitmap and convert it into an icon with a transparent backcolor. -- Show quoteHide quoteDennis in Houston "Ken Tucker [MVP]" wrote: > Hi, > > Even when I save a icon with its back color as color.transparent it > shows up with a black background in windows explorer. > > Dim bm As New Bitmap(16, 16) > > Dim ico As Icon > > Dim g As Graphics = Graphics.FromImage(bm) > > g.Clear(Color.Transparent) > > g.FillEllipse(Brushes.Red, 0, 0, 16, 16) > > g.Dispose() > > Dim ptr As IntPtr = bm.GetHicon > > ico = Icon.FromHandle(ptr) > > Me.Icon = ico > > Dim fs As New System.IO.FileStream("Test.ico", IO.FileMode.Create) > > ico.Save(fs) > > fs.Close() > > > > Ken > > ----------------------------- > > "Dennis" <Den***@discussions.microsoft.com> wrote in message > news:9247C07B-8759-4737-9760-E84C25851E62@microsoft.com... > I have a bitmap and make the color transparent; > > mybitmap.MakeTransparent(Color.Black) > > When I save it as a Icon, the black color is not transparent. However, if I > save it as a bitmap then display it using windows explorer, the black color > is in fact transparent. Could it be that the bitmap is not an alpha bitmap > that causes the icon to not have the black color transparent? > > -- > Dennis in Houston > > >
Need to sort ListView columns that contain dates
Accessing dlls at runtime C# to VB crossover questions hide control based on SQLS2K column level permission Update Element in ArrayList Structure Large fonts setting (120DPI) GetType and ApplicationClass About MessageQueue Problem Using JPG stills to make a "Video" file Public vs Shared |
|||||||||||||||||||||||