Solved

Picturebox & ImageList

Posted on 2006-06-21
6
3,021 Views
Last Modified: 2008-01-09
I have a picturebox that I want to swap image during hover, leave, enter.  I placed my images onto an ImageList set at 170x90 and colordepth32bit.  When the hove code excute, the image is distorted and doesnt display well.

code snippit:
private void OnMouseHover(object sender, System.EventArgs e)
{
//does not work - images distorted
pictureBoxOption1.Image = imageList.Images[1];

//works
pictureBoxOption1.Image =Image.FromFile("rollover.png");
}

I dont want to read from file at runtime.  How do I fix this?

thanks in advance
0
Comment
Question by:ramrocket
[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
  • 3
  • 2
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16953675
1) What is the size for the images indicated by the ImageList?

2) What is the SizeMode for the PictureBox?

Bob
0
 

Author Comment

by:ramrocket
ID: 16953692
170x90 & normal
0
 
LVL 11

Expert Comment

by:vo1d
ID: 16953698
i assume you are using net2, correct?
that is a known strange behaviour of the net2 imagelist.
try this:
setup a clean new imagelist with the size and the colordepth you need BEFORE you insert the images to it.

if that dont work, use a resource file instead.
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:ramrocket
ID: 16953771
I have done the 1st option - it didnt work.  how do you use resource and programactically retrieve the image?
0
 
LVL 11

Accepted Solution

by:
vo1d earned 100 total points
ID: 16953841
in your projectpath, goto Properties. there is a resources.resx file.
doubleclick on it.
on the designer of that file, goto Add Resource->Add Existing File... .
choose the images you need.
after adding it, you got acces to that images with its name as property.
try:
yourappnamespace.Properties.Resources.YourImageName

the return type is bitmap.
0
 

Author Comment

by:ramrocket
ID: 16953872
I use embedd resources.

thanks that works
0

Featured Post

Technology Partners: 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 introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

688 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