dirty system.drawing.systemicons

Hello.  As part of my application I need to ask for passwords at certain stages and so have rolled my own messagebox-like window complete with textbox for the password.  However when I try to use a system icon to complete the messagebox look, it renders with a ragged black all around it as if its transparency is not correct....  

Firstly I used the .ToBitMap() method to load the image directly into the image control but that didn't work.  I thought perhaps it needed to remain an Icon for the transparency to work correctly so I then tried adding it in its Icon form to an image list like this:

ilmain.images.add(system.drawing.systemicons.question)

I tried making the image list's transparent colour both Black and Transparent but the ragged "black" around the system icon still remains.  I also tried double buffering the form, but to no avail.

Anyone know how to get one of these icons to render cleanly

Its a small issue I know, but irritating.  I just want to use an Icon :S

Thanks in advance,

Fergal


Answer this question

dirty system.drawing.systemicons

  • Andrew Middleton

    I should add that:

    1. On Windows 2000 interface, the icon seems fine (lesser amount of colours in the icon)
    2. The application I am having problems with has VisualStyles enabled.

  • awm129

    use DrawIcon() to draw directly on the form.
    If you want to create a bitmap from the icon then use the method on my site:
    http://dotnetrix.co.uk/misc.html --> Get Alpha Bitmap from 32 bit Icon

  • sladoid

    Thank you Mick, the DrawIcon method works a treat.
  • dirty system.drawing.systemicons