• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 333
  • Last Modified:

transparent gifs have blue lines on winform vb.net?

Hello experts, I dont know why this is happening, but all my transparent gif on my win form have blue lines around the border.  I took the same image and put it on a web page and it looks fine. I have been messing around with image editting tools trying to get my images right, but I think the problem is the win form.  I am using an image list for all my images could that be the problem?
0
tentavarious
Asked:
tentavarious
  • 22
  • 17
1 Solution
 
Bob LearnedCommented:
WinForms does not, by it's very nature, support "true" transparency, unfortunately.  So, you get weird effects like you described.

Bob
0
 
tentavariousAuthor Commented:
Ok, so how could i change the background of the image, to match the back ground of the form.
0
 
Bob LearnedCommented:
Where are you drawing this image?

Bob
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
tentavariousAuthor Commented:
Within a toolbar on my winform.
0
 
tentavariousAuthor Commented:
Actually, I am using a image list first.
0
 
Bob LearnedCommented:
If you don't add the image to the ImageList, but draw it directly on the ToolBar button (<-- assumption), does it draw correctly?

Bob
0
 
tentavariousAuthor Commented:
Don't you have to use an image list with a toolbar?  Anyways I can add an picture box on the form with the same image and it show up fine.  The problem seems to lie in using the image list.
0
 
Bob LearnedCommented:
1) How large are the images?

2) If they are 16 x 16 or 32 x 32, then you can use .ico with transparent colors.

Bob
0
 
tentavariousAuthor Commented:
I could shrink them down to 32 X 32, how can I make my gifs into icons?
0
 
Bob LearnedCommented:
1) .NET has an image editor.

2) Add New Item | Icon

3) Copy and paste the image from the GIF to the icon file

4) You will get an Image menu.  

5) Some important menu items are Image | New Image Type, Current Icon Image Types ->, and Delete Image type.  

6) There are rudimentary tools that you can use to either edit an existing image, or create your own icons.

Bob
0
 
tentavariousAuthor Commented:
forgive me for I am slow, but I am having problems with the icon editor, how exactly do I paste my gif to the newly created icon file?  And I am not seeing the menu items you have listed.
0
 
Bob LearnedCommented:
What .NET version do you have?

Bob
0
 
tentavariousAuthor Commented:
I am using visual studio.net 2003
0
 
Bob LearnedCommented:
Take a look at this .jpg showing the Image Editor:

   https://filedb.experts-exchange.com/incoming/ee-stuff/51-Image-Editor.jpg

Bob
0
 
tentavariousAuthor Commented:
Ok, I got that far, but I am not sure how to paste a transparent gif into this file.
0
 
Bob LearnedCommented:
1) Open the file in a program that can copy the GIF file (i.e. M$ Paint)
2) Copy the image
3) Go to the Image Editor, can paste.

Bob
0
 
tentavariousAuthor Commented:
Ok, I got the gif into a icon.  I added the icon to the image list and I still get the blue line its about 1px wide.  I have no idea why this isn't working.
0
 
Bob LearnedCommented:
1) Did you edit the background of the icon to use transparency, and not depending on the GIF to do that?  

2) Does the icon show the line?

3) Here is a place to upload any example images, forms, etc:

http://ee-stuff.com/Expert/Upload/upload.php?Question=21831389

Bob
0
 
tentavariousAuthor Commented:
I tried both methods and neither worked.  I uploaded one of the images causing the problem.
0
 
Bob LearnedCommented:
>>I uploaded one of the images causing the problem.
Interesting, I only see the .jpg file that I uploaded.

Bob
0
 
tentavariousAuthor Commented:
Ok, do I need anything other then the question number?  I tried uploading it again.  It should be a pdf.gif
0
 
Bob LearnedCommented:
I guess you need to tell me what file ID (fid) is.  That site is a work-in-progress, so it takes some time, but it a pretty cool way of sharing.  

After you upload, you should get a URL back, like this:
   http://www.ee-stuff.com/Expert/Upload/getFile.php?fid=54

Bob
0
 
tentavariousAuthor Commented:
Yep, my question number is there then i browse to the file and click upload it seems to be working.
0
 
tentavariousAuthor Commented:
Oh, I am getting an invalid file type.  It is a .gif so I dont know why that would be.
0
 
tentavariousAuthor Commented:
Yeah the file is 1.91k in size and its a gif,  it doesnt seem to be going through
0
 
Bob LearnedCommented:
If you notice the upload screen, the allowed file types are zip, tiff, txt, png, jpg, pdf.  I posted a question to the page creator about the .gif file type.

Bob
0
 
tentavariousAuthor Commented:
I guess when I used the filter in openfiledialog gifs were allowed.  I can convert to jpg
0
 
Bob LearnedCommented:
JPGs can leave remnants, can you convert to .PNG? Windows XP M$ Paint can save a .PNG.

Bob
0
 
tentavariousAuthor Commented:
0
 
Bob LearnedCommented:
Here are the steps that I used to create the icon:

1) Navigated to http://images.google.com/images?svnum=100&hl=en&lr=lang_en&newwindow=1&q=pdf+icon+32
2) Make sure that the 43 x 38 pixels - 1k  - gif, www.bielek.com image is visible.
3) Hit the <PrtScn> button to grab the image
4) Open Micro$oft Paint
5) Paste the screen shot into Paint.
6) Highlight the image inside the box for the selected icon image, at a size of 32 x 32, and copy that to the clipboard.
7) From the VB.NET 2003 IDE, select the 'Add New Item | Icon' option.
8) Select 'Image | New Image Type' to add a new image type=32 x 32, 256 colors.
9) Select 'Image | Current Icon Image Types' to select the 32 x 32, 16 color image.
10) Select 'Image | Delete Image Type' to remove the 16 color image, and left the 256 color image.
11) Select 'Edit | Paste' to paste the image copied from Paint.
12) Click on the paint can tool
13) Select the transparent color from the color palette (the color shown in a screen button)
14) Paint the background with the transparent color
15) Use the pencil tool for tighter control
16) Select 'File | Save Icon1.ico As...' to save the .ico file with the real file name.

Bob
0
 
tentavariousAuthor Commented:
Yep, i did all that.  Now try adding that icon to a imagelist then binding the imagelist to a toolbar control and see what you get.  I followed all your steps exactly and I have blue outline around the image.
0
 
Bob LearnedCommented:
You are going to have to show me what you mean, cuz I can't seem to duplicate this.

Bob
0
 
tentavariousAuthor Commented:
Ok, the lines are only 1 px thick.  I created a .png of my application toolbar.  How do I get to the upload page again?
0
 
Bob LearnedCommented:
Look up to get the same link (from 05/09/2006)  ^^^^^

Bob
0
 
tentavariousAuthor Commented:
Dope, sorry its Monday.
0
 
tentavariousAuthor Commented:
0
 
Bob LearnedCommented:
1) The images for the buttons look stretched.

2) What is the ImageSize for the ImageList

3) Are all the images 32 x 32 icons?

Bob
0
 
tentavariousAuthor Commented:
Nope, some are smaller then others
0
 
tentavariousAuthor Commented:
That solved it, I just have to make sure they are the same as the imagelist properities
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 22
  • 17
Tackle projects and never again get stuck behind a technical roadblock.
Join Now