Results 1 to 6 of 6

Thread: Icon always appears stretched

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2008
    Posts
    129

    Icon always appears stretched

    When I load a 256 color icon into a picturebox with loadpicture, it always stretches the icon. Could anyone tell me why this is happening?

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Icon always appears stretched

    Picturebox doesn't stretch images unless you use PaintPicture method so if you set Autosize = True then control will be resized to fit image.
    On the other hand, if you are using Image control (note: not Picturebox) then make sure Stretch propety is False.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2008
    Posts
    129

    Re: Icon always appears stretched

    I uploaded a test project. Look at the icon in explorer and you will see it is not stretched. Then open vb and run the project. The icon appears stretched.

    I am not using PaintPicture and it is not an image control.
    Attached Files Attached Files

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Icon always appears stretched

    The problem is that your icon is 48x48 pixels, which is a format that VB does not understand - it only supports 16x16 and 32x32, with up to 24-bit colour (so no alpha channel).

    I've attached an updated version of the icon, which includes the original and the two other sizes. Your program will show the 32x32 version in the picturebox, and (if you add code for it or set the properties) will show the 16x16 version for the form icon.
    Attached Files Attached Files

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Dec 2008
    Posts
    129

    Re: Icon always appears stretched

    I have more icons to convert. Could you tell me what program you used and how to do it?

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Icon always appears stretched

    You just need a decent icon editing program, there are many available.

    A popular (and very good) one is MicroAngelo, but that costs money. There are many free ones available, and it is possible to find high quality ones for free - such as my personal preference, IcoFX. You can find these two (and many more) by doing a web search for "Icon editor".


    In IcoFx you can add a new icon to the file by clicking the "Insert New Image" button, then select the size/colors for the new icon (by default it copies the icon you've got selected at the time, automatically adjusting the colors/size as apt). Other decent icon editors offer similar functionality, just via a different button/menu.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width