Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Quality of picturebox is very bad when loaded from imagelist

Posted on 2006-07-06
7
Medium Priority
?
1,241 Views
Last Modified: 2012-08-14
Hi there,

can anyone help?

I am using Visual Studio 2003, and i have loaded a png file 32 x 32 into an imagelist and then in my code i do

uxCollapsePictureBox.Image = imageList2.Images[0];

It does work but the image is very bad, i have set the Depth to 32 bit.

If i just load the image directly into the picturebox through properties rather than using an imagelist it very nice...

Am i missing something?

Thanks in advance

Ian
0
Comment
Question by:ianinspain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 

Author Comment

by:ianinspain
ID: 17051819
Actually the i have just checked again and the image is fine but it has a blue sort of border around it...

Its a round picture and all around the edge is blue

Thanks

Ian
0
 
LVL 12

Expert Comment

by:topdog770
ID: 17052485
I'm guessing that you are using blue as the transparency color.

Unforunately, the transparencykey color is displayed when a client machine is set to display 32 bit colors.

To confirm that this is the problem, adjust your display settings to show 16 bit colors or less and the blue border should disappear.
0
 

Author Comment

by:ianinspain
ID: 17056783
Hi .. thanks for reply.. No i have tried to change the transparency color and also tried setting my display to 16 bit colors... but its still the same...

Ian
0
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!

 
LVL 11

Accepted Solution

by:
vo1d earned 2000 total points
ID: 17059016
use a resource file instead of an image list.
have you setuped your imagelist dimension to 32x32?
0
 

Author Comment

by:ianinspain
ID: 17147095
Yes i did....  but a resource file sounds a better idea ....
0
 

Author Comment

by:ianinspain
ID: 17147107
You don't have any code to read from a resource file do you?

I am using Visual studio 2003
0
 
LVL 12

Expert Comment

by:topdog770
ID: 17147157
To use this code.. I added a bitmap to the project and set it to 'embedded resource'

                  Stream imgStream = null;
                  Assembly a = Assembly.GetExecutingAssembly();
                  // attach to stream to the resource in the manifest
                  imgStream = a.GetManifestResourceStream  --> full namespace needed ("MY.PROJECT.NAMESPACE.Entertainment.BasicSplash.bmp");

  // side bonus.. this code gets around the 32bit color transparency bug in .net
                  if( !(null==imgStream) )
                  {                    
                        // create a new bitmap from this stream and
                        // add it to the arraylist
                        bitmap = Bitmap.FromStream( imgStream ) as Bitmap;
                        bitmap.MakeTransparent(bitmap.GetPixel(0,0));
                        this.BackgroundImage = bitmap;
                        this.TransparencyKey = bitmap.GetPixel(0,0);
                        imgStream.Close();
                        imgStream = null;
                  }      
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

610 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