Re: add icon to resource and use different sizes by Pieter
Pieter
Thu Oct 20 02:35:22 CDT 2005
Thanks for the info. Any idea how I can do this at designtime? For instance:
I have buttons, and the image-property must be set to the icon. I would like
to set these at designtime, but there doesn't seem to be a way to add
specify there the size?
Thanks a lot anyways!
Pieter
"Tim Scott" <timscott@gmail.com> wrote in message
news:1129739317.343818.65620@g44g2000cwa.googlegroups.com...
> Pieter,
>
> The icon class has several constructors that take as arguments an
> existing icon, and a preferred size:
>
> Initializes a new instance of the Icon class and attempts to find a
> version of the icon that matches the requested size.
> [Visual Basic] Public Sub New(Icon, Size)
>
> Initializes a new instance of the Icon class from a resource in the
> specified assembly.
> [Visual Basic] Public Sub New(Type, String)
>
> Initializes a new instance of the Icon class and attempts to find a
> version of the icon that matches the requested size.
> [Visual Basic] Public Sub New(Icon, Integer, Integer)
>
> You should be able to pass it the Icon that you loaded from your
> resource, plus the desired size. MSDN docs say that is uses an icon of
> the closest size. If you need a 48x48 and one isn't there, then it
> might use the 32x32. If you need a 48x48, you will have to use
> Graphics.DrawImage and stretch the image during drawing.
>
> I hope this helps, please let me know how it turns out.
>
> -- Tim
>