imagelist with label, why does it keep shrinking images

I am using an imagelist with a label control, basically doing custom rolleover affect. However, if I use an imagelist and try and write the image to the label it keeps shrinking the image to 16x16, even when the image in the list is actually 21 high by 65 wide, why is this and how can I stop it, basically display image at its default size?

-------------Problems Reply------------

The problem comes from the ImageList. It has a property ImageSize that has a big impact on the List itself.

If you take a look at design time into the images of your ImageList, they will all show up their real width and height values. But by compile time the images will be stored within the list using the given ImageSize. So all images within a ImageList will be already stretched to the given size at runtime.

Attention: If you change the ImageSize at runtime all images will be removed from the list!

To solve your problem you have two possibilities:

  1. If all of your images are of the same size, set this size to your ImageList at design-time.
  2. If you have images of different sizes you should add them to your Resources.resx file and access them from there, cause here they will be saved as is and access is also fairly easy like Properties.Resources.MyPictureFile
Category:c# Views:0 Time:2010-07-06

Related post

  • auto resize content of label 2010-04-30

    I have a label in my program that displays an image. The problem is, if an image is selected that is larger than the label, only part of the image is displayed. How do I display the entire image? image = new ImageIcon(movpath); l5=new JLabel(image);

  • Best practice for naming convention of UI controls for referencing in code-behind? 2008-09-21

    What is the best practice for naming UI controls (textboxes, drop-downs, etc.) on forms and reports for reference in the code-behind pages? I develop a lot of reports and forms in my office. I have several web applications providing about 80+ "live"

  • How to put the legend out of the plot 2011-01-15

    I have a series of 20 plots (not subplots) to be made in a single figure. I want the legend to be outside of the box. At the same time, I do not want to change the axes, as the size of the figure gets reduced. Kindly help me for the following queries

  • Animate UILabel not smooth 2011-06-14

    I am trying to animate a UIlabel to first grow larger, then shrink back to its original frame. Enlarging work as expected, but not shrinking. When I shrink the label with the below code, the size adjusts first before the origin is shifted. This cause

  • iOS UILabel not redrawing to a new size 2011-08-21

    I have a set of UILabels that are shown in the cells of a TableView. When the user touches the cell, the label expands to show all the text I've put in there instead of a two-line truncated version. The animation and expanding works, but when I press

  • How to resize DevExpress controls 2011-09-21

    I have a DevExpress LayoutControl set inside a WinForms Form. I would like the LayoutControl to resize horizontally when the form is resized, or at least make the LayoutControl resizable by the user. I have seen on DevExpress's page suggestions to ch

  • How to zoom when scroll UIScrollView 2012-03-08

    I add few labels in UIScrollView and I want when I scroll, the the middle label font size can become bigger. And the previous middle label font size shrinks to smaller. And the change happens gradually. Like below. Label 1 move to left shrink smaller

  • hi i need to know how to make a partition on my hard drive without format the unit 2012-03-24

    hi im a brand new owner of a laptop with windows 7 and i want to know how to make a partition on my hard drive. in advance for your help thanks --------------Solutions------------- That's just the first step. After you have shrunk the primary (boot)

  • How to use standard field type file in joomla 2.5 2012-04-25

    I am trying to upload a file and i have used joomla xml form in joomla 2.5 version. This form inserts image name in database. but file is not uploaded. Is there any tutorial for use of standard field type file in joomla form. --------------Solutions-

  • Win7 Ultimate - Fails Activation after Installing Visio 2010 2013-10-14

    HI- I had a fully activated and verified and genuine copy of Win7 Ultimate installed from a shrunk-wrapped and solid retail box. This copy of Win7 Ultimate had worked for months with no issues and accepted updates perfectly. I also had a verified cop

  • Hide white space in Access reports 2014-11-19

    Hi I have an Access 2010 report which I need to hide blank spaces. I use the following code to hide the data on the report if it is blank. If IsNull(Me.WitnessName2) Then Me.WitnessName2.Visible = False Me.WitnessAddress2.Visible = False Me.WitnessAd

  • can shrink propery in Access 2010 address label merge does not work 2012-10-05

    I am creating a simple name-and-address-labels report. I have Access 2010. The blank line ([Address2], which only occasionally contains information) continues to appear when blank, even though the "Can Shrink" and "Can Grow" properties have been set

  • How do you shrink a concatenated line of an address in a label report? 2012-10-12

    How do you shrink a concatenated line/concatenated lines in an address in a label report? e.g. I have the following fields in a query: Company BldgAddress:BldgNo&BldgNoExt&" "Bldg StreetAddress:StreetNo&StreetNoExt&" "StreetName Subur

  • Disc labels that are out of "My Documents" on the desktop take up the entire window. When I try to reduce the size, it shrinks to a small bullet like icon. 2013-05-20

    I have disc labels in my documents but when I click "restore down" the label shrinks to a small bullet, what's causing this? It takes up the entire window or reduces to a small icon. I like to see the desktop in he background and be able to work with

  • How do you shrink more than 1 consecutive line of an address in a label report? 2013-09-14

    I know 2 ways of shrinking lines of an address in a label report, but neither seems to be able to handle 2 or more consecutive lines. Does anyone know of a way to do this? Thanks for any help. --------------Solutions------------- I have discovered th

  • wxPython : How do I shrink the size of Button to the width of the label text? 2014-05-09

    I have a FlexGridSizer that I add a bunch of TextCtrl to, some of which are for users to enter a path, so I have a Button in the adjacent column to the right of those TextCtrl boxes. The label text is ... and I only call AddGrowableCol on the columns

  • Silverlight - Creating a rectangle that grows/shrinks to accomodate text of a label within it 2012-01-23

    Pretty straight forward. I have a rectangle with a label over top of it. I'f like to know how to get the rectangle to scale to fit the text. my XAML: <Grid x:Name="LayoutRoot" Background="White" Height="158" Width="264"> <Rectangle Height="2

  • PieChart label with a single slice 2008-12-11

    I'm working with the PieChart and PieSeries components in Flex, and have ran into an issue. When the labelPosition property of a PieSeries is set to 'inside' and there is only one slice in the pie, the label doesn't get displayed. Looking at the docs

  • VB.NET: label vs picturebox 2009-07-01

    What is more lightweight control, a label, or a picturebox? (label can contain image too). I will have a form with 110 icons displayed in separate controls and I'm deciding if I should display them in pictureboxes, or a labels. In VB6, there was an I

Copyright (C), All Rights Reserved.

processed in 0.114 (s). 11 q(s)