?
Solved

transparent gifs have blue lines on winform vb.net?

Posted on 2006-04-28
40
Medium Priority
?
313 Views
Last Modified: 2008-02-01
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
Comment
Question by:tentavarious
  • 22
  • 17
39 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16566274
WinForms does not, by it's very nature, support "true" transparency, unfortunately.  So, you get weird effects like you described.

Bob
0
 

Author Comment

by:tentavarious
ID: 16586161
Ok, so how could i change the background of the image, to match the back ground of the form.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16587283
Where are you drawing this image?

Bob
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tentavarious
ID: 16589620
Within a toolbar on my winform.
0
 

Author Comment

by:tentavarious
ID: 16595779
Actually, I am using a image list first.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16596056
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
 

Author Comment

by:tentavarious
ID: 16596637
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16597888
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
 

Author Comment

by:tentavarious
ID: 16597947
I could shrink them down to 32 X 32, how can I make my gifs into icons?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16597994
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
 

Author Comment

by:tentavarious
ID: 16599612
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16609654
What .NET version do you have?

Bob
0
 

Author Comment

by:tentavarious
ID: 16614200
I am using visual studio.net 2003
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16621745
Take a look at this .jpg showing the Image Editor:

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

Bob
0
 

Author Comment

by:tentavarious
ID: 16630261
Ok, I got that far, but I am not sure how to paste a transparent gif into this file.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16632121
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
 

Author Comment

by:tentavarious
ID: 16632775
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16633297
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
 

Author Comment

by:tentavarious
ID: 16638874
I tried both methods and neither worked.  I uploaded one of the images causing the problem.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16638981
>>I uploaded one of the images causing the problem.
Interesting, I only see the .jpg file that I uploaded.

Bob
0
 

Author Comment

by:tentavarious
ID: 16639572
Ok, do I need anything other then the question number?  I tried uploading it again.  It should be a pdf.gif
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16640325
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
 

Author Comment

by:tentavarious
ID: 16641320
Yep, my question number is there then i browse to the file and click upload it seems to be working.
0
 

Author Comment

by:tentavarious
ID: 16641335
Oh, I am getting an invalid file type.  It is a .gif so I dont know why that would be.
0
 

Author Comment

by:tentavarious
ID: 16641355
Yeah the file is 1.91k in size and its a gif,  it doesnt seem to be going through
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16641479
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
 

Author Comment

by:tentavarious
ID: 16641675
I guess when I used the filter in openfiledialog gifs were allowed.  I can convert to jpg
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16641745
JPGs can leave remnants, can you convert to .PNG? Windows XP M$ Paint can save a .PNG.

Bob
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16642192
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
 

Author Comment

by:tentavarious
ID: 16642592
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16681834
You are going to have to show me what you mean, cuz I can't seem to duplicate this.

Bob
0
 

Author Comment

by:tentavarious
ID: 16682018
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16682425
Look up to get the same link (from 05/09/2006)  ^^^^^

Bob
0
 

Author Comment

by:tentavarious
ID: 16682647
Dope, sorry its Monday.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 800 total points
ID: 16683545
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
 

Author Comment

by:tentavarious
ID: 16683973
Nope, some are smaller then others
0
 

Author Comment

by:tentavarious
ID: 16684087
That solved it, I just have to make sure they are the same as the imagelist properities
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question