make background color transaparent

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi all..
let's suppose that we have a file (word1.doc)
i have managed to extract the icon from the file by using
 
Hi Theodore,

This is what I tried
///
Dim btmap As Bitmap
Dim icn As Icon

Me.pbox.Image = Nothing
icn = New Icon("C:\MSGBOX03.ICO")
btmap = icn.ToBitmap
btmap.MakeTransparent(Color.Yellow)

Dim extractedIcon As System.Drawing.Icon
extractedIcon = icn.FromHandle(btmap.GetHicon)

Me.pbox.CreateGraphics.DrawIcon(extractedIcon, pbox.Width / 4,
pbox.Height / 4)

\\\

This worked meaning, the icon that showed up did have the Yellow color
masked. I am not sure why it did not work for you. Let me know if I missed
anything and I will try to help.
 
hi sarika
thx for the answer...
this seems to be the same as the one that i am describing...
i will try it again tomorrow...cos now i am not at work..
but i will give u a couple of more info..
1. the code i am writing is on a code behind aspx.vb file...
2. i am extracting the icon from a file... saving it to disk and then
passing it as an imageUrl to a web tree node (infragistics ultrawebtree)
3. when i am using the same code,in a vb project, but istead of saving the
icon - by using the memoryStream- i am adding it to the collection of an
image control... no black background is shown at the first place !! (and
therefore no need for maketransparent method)..
anyway ,thx once more
i will try to accomplish it tomorrow...
if u have any more ideas..plz let me know !:)
theodore
 
it didnt work herfried :SS
what i do is the following
1. extract the file icon out of a file (residing on the hard disk)
2. feed the function with the icon
3. save the bitmap that the function returns on the disk
4. get an icon from that bitmap
5. save the icon on the disk

unfortuately both the bmp and the ico still have the black background
......

ps: i am not sure that i am feeding the procedure with a 32 bit icon... is
there a way to find out ?


Herfried K. Wagner said:
juststarter said:
[Extracting an icon]
Unfortunately the black backcolor remains. Is there a way to get rid of it
?

<URL:http://dotnetrix.co.uk/misc.html>
-> "Get Alpha Bitmap from 32 bit Icon."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top