469,927 Members | 1,766 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Toolbar Images with "Dirty Edges"

I've been trying to get a standard toolbar to play nice with some nice icons
that I have. When I put them on a button or anything they look perfect, but
through an imagelist and on a toolbar they all have this blue aura around
them. I assume that is from the transparency, but I don't understand why
almost any other control displays them properly.. There really is no
replacement for the toolbar (without paying!), so I hope someone can tell me
how to get these icons to behave! I have them in ICO and PNG format, both
product the same "dirty edge" effect when placed on a toolbar button...

If anyone has any suggestions for a low cost commercial toolbar control, I'm
not opposed to buying something to make this look nice..

Thanks!

--
- Mitchell

Nov 21 '05 #1
7 2743
Hi Mitchell,

Have you tried to set the ImageList's ColorDepth to 32bit and imagesize to
a large one(e.g. 32,32) which may make the icon more "nice"?
Also since the icon is usually 32x32 or even 16x16 pixels, which have
little pixels to present the image, so if we add a large picture into the
imagelist as a icon which may cause the icon distortion.

If you still have any concern, please feel free to post there.
Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #2
The imagelist does not play nice with Alpha. Icons are generally OK, but it
depends on the icons format.

Load the images into the imagelist at runtime and you will get better
results, but the alpha will still be slightly bluish.
You'll also notice that the images in the imagelist only play nicely with
some controls, set a labels image to one of the imagelist alpha images and
you will really see ugly results.

As a workaround you can create icons from the png images at runtime and then
add them to the imagelist(labels still wont like them).
\\\
Dim ico As Icon
Dim bmp As New Bitmap("someimage.png")
ico = Icon.FromHandle(bmp.GetHicon)
ImageList1.Images.Add(ico)
bmp.Dispose()
ico.Dispose()
///
It would probably be better to add the pngs as Embedded Resource rather than
have them distrubuted seperately.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
""Peter Huang" [MSFT]" <v-******@online.microsoft.com> wrote in message
news:qr**************@cpmsftngxa10.phx.gbl...
Hi Mitchell,

Have you tried to set the ImageList's ColorDepth to 32bit and imagesize to
a large one(e.g. 32,32) which may make the icon more "nice"?
Also since the icon is usually 32x32 or even 16x16 pixels, which have
little pixels to present the image, so if we add a large picture into the
imagelist as a icon which may cause the icon distortion.

If you still have any concern, please feel free to post there.
Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 21 '05 #3
I guess the imagelist is just too dysfunctional where alpha is concerned for
my use. I have the images in both ICO (all dimensions) and PNG format and
none of them look even half way decent using an imagelist to attach them to
a toolbar..

I just wanted to make sure that it wasn't just me!

Thanks guys!

--
- Mitchell Vincent

"Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in
message news:eJ**************@TK2MSFTNGP15.phx.gbl...
The imagelist does not play nice with Alpha. Icons are generally OK, but
it depends on the icons format.

Load the images into the imagelist at runtime and you will get better
results, but the alpha will still be slightly bluish.
You'll also notice that the images in the imagelist only play nicely with
some controls, set a labels image to one of the imagelist alpha images and
you will really see ugly results.

As a workaround you can create icons from the png images at runtime and
then add them to the imagelist(labels still wont like them).
\\\
Dim ico As Icon
Dim bmp As New Bitmap("someimage.png")
ico = Icon.FromHandle(bmp.GetHicon)
ImageList1.Images.Add(ico)
bmp.Dispose()
ico.Dispose()
///
It would probably be better to add the pngs as Embedded Resource rather
than have them distrubuted seperately.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
""Peter Huang" [MSFT]" <v-******@online.microsoft.com> wrote in message
news:qr**************@cpmsftngxa10.phx.gbl...
Hi Mitchell,

Have you tried to set the ImageList's ColorDepth to 32bit and imagesize
to
a large one(e.g. 32,32) which may make the icon more "nice"?
Also since the icon is usually 32x32 or even 16x16 pixels, which have
little pixels to present the image, so if we add a large picture into the
imagelist as a icon which may cause the icon distortion.

If you still have any concern, please feel free to post there.
Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.


Nov 21 '05 #4
If you use the code I suggested to load the png images, as icons, into the
imagelist at runtime then they will look just fine in a toolbar.
You could easily update the code to use the images added as Embedded
Resource, and make a Method of it.

i.e.
\\\
Private Sub Form_Load(ByVal sender As Object, e As EventArgs) _
Handles MyBase.Load
ImageListAddResourcePng(ImageList1,"Image1.png")
ImageListAddResourcePng(ImageList1,"Image2.png")
End Sub

Private Sub ImageListAddResourcePng(ByVal imgList as ImageList , _
ByVal ResourceName As String)
Dim bmp As Bitmap = New Bitmap(Me.GetType, ResourceName)
Dim ico As Icon = Icon.FromHandle(bmp.GetHicon)
imgList.Images.Add(ico)
bmp.Dispose()
ico.Dispose()
End Sub
///

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Mitchell Vincent" <mi*************@community.nospam> wrote in message
news:eR******************@TK2MSFTNGP15.phx.gbl...
I guess the imagelist is just too dysfunctional where alpha is concerned
for my use. I have the images in both ICO (all dimensions) and PNG format
and none of them look even half way decent using an imagelist to attach
them to a toolbar..

I just wanted to make sure that it wasn't just me!

Thanks guys!

--
- Mitchell Vincent

Nov 21 '05 #5
If you use the code I suggested to load the png images, as icons, into the
imagelist at runtime then they will look just fine in a toolbar.
You could easily update the code to use the images added as Embedded
Resource, and make a Method of it.

i.e.
\\\
Private Sub Form_Load(ByVal sender As Object, e As EventArgs) _
Handles MyBase.Load
ImageListAddResourcePng(ImageList1,"Image1.png")
ImageListAddResourcePng(ImageList1,"Image2.png")
End Sub

Private Sub ImageListAddResourcePng(ByVal imgList as ImageList , _
ByVal ResourceName As String)
Dim bmp As Bitmap = New Bitmap(Me.GetType, ResourceName)
Dim ico As Icon = Icon.FromHandle(bmp.GetHicon)
imgList.Images.Add(ico)
bmp.Dispose()
ico.Dispose()
End Sub
///

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Mitchell Vincent" <mi*************@community.nospam> wrote in message
news:eR******************@TK2MSFTNGP15.phx.gbl...
I guess the imagelist is just too dysfunctional where alpha is concerned
for my use. I have the images in both ICO (all dimensions) and PNG format
and none of them look even half way decent using an imagelist to attach
them to a toolbar..

I just wanted to make sure that it wasn't just me!

Thanks guys!

--
- Mitchell Vincent

Nov 21 '05 #6
Hi Mitchell,

Have you tried Mick's suggestion?
If you still have any concern, please feel free to post here.

Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #7
Hi Mitchell,

Have you tried Mick's suggestion?
If you still have any concern, please feel free to post here.

Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Aryeh M. Friedman | last post: by
5 posts views Thread by Alain Filiatrault | last post: by
15 posts views Thread by aussie rules | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.