473,385 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ICO to GIF? (transparant)

I'm trying to convert an icon handle to GIF.

Something like:
Public Function GetImageFromIconHandle(ByVal hIcon As Int32) As Int32
Dim ico As Icon = Icon.FromHandle(hIcon)
Dim x As New Drawing.IconConverter
'x.ConvertTo(ico,typeof(System.Drawing.Imaging.Ima geFormat.Gif) )
End Function

x.ConvertTo(ico, <requires a system.type> )

I don't know how to do that.
Important is that a transparent icon should remain transparent.

hIcon is a valid 16x16 icon.
Dec 7 '05 #1
6 3574
Have you tried typeof(Bitmap) ?

--
Daniel Fisher(lennybacon)
http://www.lennybacon.com
"Edwin Knoppert" <ne**@hellobasic.com> wrote in message
news:43**********************@text.nova.planet.nl. ..
I'm trying to convert an icon handle to GIF.

Something like:
Public Function GetImageFromIconHandle(ByVal hIcon As Int32) As Int32
Dim ico As Icon = Icon.FromHandle(hIcon)
Dim x As New Drawing.IconConverter
'x.ConvertTo(ico,typeof(System.Drawing.Imaging.Ima geFormat.Gif) )
End Function

x.ConvertTo(ico, <requires a system.type> )

I don't know how to do that.
Important is that a transparent icon should remain transparent.

hIcon is a valid 16x16 icon.

Dec 7 '05 #2
That would not work but..

i already converted to bmp and i used that code.
But the backcolor remains black while i added:
Dim bmp As Bitmap = ico.ToBitmap
bmp.MakeTransparent(Color.Black)
Return bmp

The image remains the same though.
Better see a real example with a transparent ico > gif.

Your suggestion:
For the type i used: x.ConvertTo(ico, bmp.GetType)
But i don't know what to use to draw to user, and even to expect a
transparent gif since i still use a bitmap object (GIF is bitmap so i should
give it a chance).

Currently the BMP is shown:
Response.ContentType = "image/gif"
Dim xx As System.Drawing.Imaging.ImageFormat
' send the image to the viewer
bmp.Save(Response.OutputStream, xx.Gif)

bmp.Dispose()
Response.End()

"Daniel Fisher(lennybacon)" <in**@lennybacon.com> schreef in bericht
news:Ol****************@TK2MSFTNGP14.phx.gbl...
Have you tried typeof(Bitmap) ?

--
Daniel Fisher(lennybacon)
http://www.lennybacon.com
"Edwin Knoppert" <ne**@hellobasic.com> wrote in message
news:43**********************@text.nova.planet.nl. ..
I'm trying to convert an icon handle to GIF.

Something like:
Public Function GetImageFromIconHandle(ByVal hIcon As Int32) As Int32
Dim ico As Icon = Icon.FromHandle(hIcon)
Dim x As New Drawing.IconConverter
'x.ConvertTo(ico,typeof(System.Drawing.Imaging.Ima geFormat.Gif) )
End Function

x.ConvertTo(ico, <requires a system.type> )

I don't know how to do that.
Important is that a transparent icon should remain transparent.

hIcon is a valid 16x16 icon.


Dec 7 '05 #3
Making an image transparent in .NET is a rather complicated process, which I
don't quite understand. Here is a page that I was referred to by someone in
a newsgroup which is supposed to work. It is written in C#. I am a VB.NET
coder, and I couldn't get it to work in that, but I think that is due to the
unmanaged code capabilities of C#. I have not tried the code in C#, so I am
assuming it would work if I did it in C#. See what it does for you. (If you
do figure out a way to get it to work in VB.NET, could you let me know?)
Here is the URL:

http://ewbi.blogs.com/develops/2005/...klines_22.html

Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Edwin Knoppert" <ne**@hellobasic.com> wrote in message
news:43**********************@text.nova.planet.nl. ..
That would not work but..

i already converted to bmp and i used that code.
But the backcolor remains black while i added:
Dim bmp As Bitmap = ico.ToBitmap
bmp.MakeTransparent(Color.Black)
Return bmp

The image remains the same though.
Better see a real example with a transparent ico > gif.

Your suggestion:
For the type i used: x.ConvertTo(ico, bmp.GetType)
But i don't know what to use to draw to user, and even to expect a
transparent gif since i still use a bitmap object (GIF is bitmap so i
should give it a chance).

Currently the BMP is shown:
Response.ContentType = "image/gif"
Dim xx As System.Drawing.Imaging.ImageFormat
' send the image to the viewer
bmp.Save(Response.OutputStream, xx.Gif)

bmp.Dispose()
Response.End()

"Daniel Fisher(lennybacon)" <in**@lennybacon.com> schreef in bericht
news:Ol****************@TK2MSFTNGP14.phx.gbl...
Have you tried typeof(Bitmap) ?

--
Daniel Fisher(lennybacon)
http://www.lennybacon.com
"Edwin Knoppert" <ne**@hellobasic.com> wrote in message
news:43**********************@text.nova.planet.nl. ..
I'm trying to convert an icon handle to GIF.

Something like:
Public Function GetImageFromIconHandle(ByVal hIcon As Int32) As Int32
Dim ico As Icon = Icon.FromHandle(hIcon)
Dim x As New Drawing.IconConverter
'x.ConvertTo(ico,typeof(System.Drawing.Imaging.Ima geFormat.Gif) )
End Function

x.ConvertTo(ico, <requires a system.type> )

I don't know how to do that.
Important is that a transparent icon should remain transparent.

hIcon is a valid 16x16 icon.



Dec 7 '05 #4
Thanks, will take a peek tomorrow :)

It's a bit odd though, both types support tranparancy.
So some conversion unit could 'know' what get's transparent (imo).
Conversion to plain BMP first is prob.not ok.
However dotnet has a maketransparent method, and i was hoping this would
work at least.
I did not see any difference.

But hey.. what do i know? :)
"Nathan Sokalski" <nj********@hotmail.com> schreef in bericht
news:ea****************@TK2MSFTNGP15.phx.gbl...
Making an image transparent in .NET is a rather complicated process, which
I don't quite understand. Here is a page that I was referred to by someone
in a newsgroup which is supposed to work. It is written in C#. I am a
VB.NET coder, and I couldn't get it to work in that, but I think that is
due to the unmanaged code capabilities of C#. I have not tried the code in
C#, so I am assuming it would work if I did it in C#. See what it does for
you. (If you do figure out a way to get it to work in VB.NET, could you
let me know?) Here is the URL:

http://ewbi.blogs.com/develops/2005/...klines_22.html

Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Edwin Knoppert" <ne**@hellobasic.com> wrote in message
news:43**********************@text.nova.planet.nl. ..
That would not work but..

i already converted to bmp and i used that code.
But the backcolor remains black while i added:
Dim bmp As Bitmap = ico.ToBitmap
bmp.MakeTransparent(Color.Black)
Return bmp

The image remains the same though.
Better see a real example with a transparent ico > gif.

Your suggestion:
For the type i used: x.ConvertTo(ico, bmp.GetType)
But i don't know what to use to draw to user, and even to expect a
transparent gif since i still use a bitmap object (GIF is bitmap so i
should give it a chance).

Currently the BMP is shown:
Response.ContentType = "image/gif"
Dim xx As System.Drawing.Imaging.ImageFormat
' send the image to the viewer
bmp.Save(Response.OutputStream, xx.Gif)

bmp.Dispose()
Response.End()

"Daniel Fisher(lennybacon)" <in**@lennybacon.com> schreef in bericht
news:Ol****************@TK2MSFTNGP14.phx.gbl...
Have you tried typeof(Bitmap) ?

--
Daniel Fisher(lennybacon)
http://www.lennybacon.com
"Edwin Knoppert" <ne**@hellobasic.com> wrote in message
news:43**********************@text.nova.planet.nl. ..
I'm trying to convert an icon handle to GIF.

Something like:
Public Function GetImageFromIconHandle(ByVal hIcon As Int32) As Int32
Dim ico As Icon = Icon.FromHandle(hIcon)
Dim x As New Drawing.IconConverter
'x.ConvertTo(ico,typeof(System.Drawing.Imaging.Ima geFormat.Gif) )
End Function

x.ConvertTo(ico, <requires a system.type> )

I don't know how to do that.
Important is that a transparent icon should remain transparent.

hIcon is a valid 16x16 icon.



Dec 7 '05 #5
Don't let that make you feel too bad, my first attempt at transparency was
to use the MakeTransparent method, too. To be honest, I think that there
should be a method (or maybe a predefined Color, or maybe a separate class
that inherits something from GDI+ that is used for making transparent
images) that makes it simpler. Maybe if we're lucky that make one in a
future release of .NET, because if you think about it, transparency is used
in almost all gif images, I mean, when was the last time you saw a button or
logo that was completely rectangular?
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dn**********@azure.qinip.net...
Thanks, will take a peek tomorrow :)

It's a bit odd though, both types support tranparancy.
So some conversion unit could 'know' what get's transparent (imo).
Conversion to plain BMP first is prob.not ok.
However dotnet has a maketransparent method, and i was hoping this would
work at least.
I did not see any difference.

But hey.. what do i know? :)
"Nathan Sokalski" <nj********@hotmail.com> schreef in bericht
news:ea****************@TK2MSFTNGP15.phx.gbl...
Making an image transparent in .NET is a rather complicated process,
which I don't quite understand. Here is a page that I was referred to by
someone in a newsgroup which is supposed to work. It is written in C#. I
am a VB.NET coder, and I couldn't get it to work in that, but I think
that is due to the unmanaged code capabilities of C#. I have not tried
the code in C#, so I am assuming it would work if I did it in C#. See
what it does for you. (If you do figure out a way to get it to work in
VB.NET, could you let me know?) Here is the URL:

http://ewbi.blogs.com/develops/2005/...klines_22.html

Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Edwin Knoppert" <ne**@hellobasic.com> wrote in message
news:43**********************@text.nova.planet.nl. ..
That would not work but..

i already converted to bmp and i used that code.
But the backcolor remains black while i added:
Dim bmp As Bitmap = ico.ToBitmap
bmp.MakeTransparent(Color.Black)
Return bmp

The image remains the same though.
Better see a real example with a transparent ico > gif.

Your suggestion:
For the type i used: x.ConvertTo(ico, bmp.GetType)
But i don't know what to use to draw to user, and even to expect a
transparent gif since i still use a bitmap object (GIF is bitmap so i
should give it a chance).

Currently the BMP is shown:
Response.ContentType = "image/gif"
Dim xx As System.Drawing.Imaging.ImageFormat
' send the image to the viewer
bmp.Save(Response.OutputStream, xx.Gif)

bmp.Dispose()
Response.End()

"Daniel Fisher(lennybacon)" <in**@lennybacon.com> schreef in bericht
news:Ol****************@TK2MSFTNGP14.phx.gbl...
Have you tried typeof(Bitmap) ?

--
Daniel Fisher(lennybacon)
http://www.lennybacon.com
"Edwin Knoppert" <ne**@hellobasic.com> wrote in message
news:43**********************@text.nova.planet.nl. ..
> I'm trying to convert an icon handle to GIF.
>
> Something like:
> Public Function GetImageFromIconHandle(ByVal hIcon As Int32) As Int32
> Dim ico As Icon = Icon.FromHandle(hIcon)
> Dim x As New Drawing.IconConverter
> 'x.ConvertTo(ico,typeof(System.Drawing.Imaging.Ima geFormat.Gif) )
> End Function
>
> x.ConvertTo(ico, <requires a system.type> )
>
> I don't know how to do that.
> Important is that a transparent icon should remain transparent.
>
> hIcon is a valid 16x16 icon.
>
>



Dec 7 '05 #6
Try abbicon pro
http://www.abbsoft.com/abbiconpro

create icons from images in 27 formats. supports make icon transparent.

Dec 29 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Philipp Brune | last post by:
Hi all, the following problem occured to me and I hope somebody can help me : I need to implement an encrypted File download with a PHP script on the server side and a c# client application....
5
by: Benjamin Esham | last post by:
Hello all, I have a very wide image that I want positioned in the extreme top left of the page. If the browser window is too narrow to contain the whole thing, that's fine-- the image should...
1
by: Darren Clark | last post by:
I need a server control for asp.net that has server events ... but only displays as a hyperlink.. or text lnk somethink that behaves like the ImageButton would be good... with click events and...
2
by: Jesper | last post by:
Hi, The ImageList class holds a property named TransparentColor and the Color class defines a color named Transparent. Where are these colors in the bitmap editor. I cant see how I can...
0
by: HamuNaptra | last post by:
Hi, I have a form which contains more than 15 linklabels, all of them have a transparant backcolor. The form itself has a backgroundimage. Now when I show the form, it takes a moment to...
2
by: Jaikumar | last post by:
Hi, 1) I have created one windows application, In the main form ( form1) i have added one usercontrol (usercontrol1), In that user control i am drawing one image. 2) In the UserControl1 i am...
3
by: Xee | last post by:
When making a Smartdevice program and putting in a transparant picture, the part that "used to be transparant" is white. Is there something I can do about this?
1
by: AA Arens | last post by:
In a form, how to have inserted a logo that has a transparant backgroundond? I inserted such a logo but the background is white. Bart (v 2003)
1
by: Jeroen Timmers | last post by:
Hi, I'm trying to place a control onto a form behind a picturebox. Some area's of this picturebox are defined as transparant. Now I run into the problem of not seeing the controls anymore. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.