Click here to Skip to main content
13,397,892 members (42,781 online)
Click here to Skip to main content
Add your own
alternative version


208 bookmarked
Posted 12 Apr 2006


, 12 Apr 2006
Rate this:
Please Sign up or sign in to vote.
An icon control that zooms and fades-in when your mouse hovers over it, which creates interesting visual effects if your application uses icons instead of buttons.

Sample Image


For an application that uses icons instead of buttons, perhaps there might be a need to add some fancy effects rather than only showing a rising icon (when hovering). This control gives you an interesting visual effect, which makes an icon to zoom when the mouse hovers over it. Also, there is a Blur property that will cause the icon to be rendered transparent (without a single line of code!); of course, you may turn it off.


You can start using this control by following these two simple steps:

  1. Add the control to the toolbox (if you don't know how to do it, right click on the Toolbox, choose Add/Remove items, find Iconits.dll, and press OK).
  2. Now that you have seen the control on the toolbox (Iconits), you can start using it. However, these properties are essential:
    Property nameTypeDescription
    BlurBooleanSet to true if you want the transparency effect, set to false otherwise.
    IconBitmapSet the icon from any available image.
    IconSizeSizeIcon initial size.
    SizeSizeIcon actual size when mouse hovers over it.
    TooltipTextStringIcon's tooltip text which pops up when the mouse hovers over it for some seconds.

Alpha class

The trick on how the image becomes slightly transparent is done by creating three additional bitmaps instead of the original image. These additional bitmaps, with different opacity (0.25, 0.5, 0.75), will make the effect of the icon slightly fading.

The idea of generating bitmaps instead of direct rendering is, of course, speed. Another reason is, only three images are necessary and that is not too much. So, we develop a class which generates a new bitmap with a different opacity level from the available image:

public static Bitmap returnAlpha(Bitmap bmp, int alpha)
    Color col; 
    Bitmap bmp2=new Bitmap(bmp);
    for (int i=0;i<bmp.Width;i++)
          for (int j=0;j<bmp.Height;j++) 
            if (col.A>0)
      return bmp2;

It simply iterates through the image and redraws the image with a new transparency level, and, of course, you don't need to redraw the pixel which is already transparent (Alpha=0).

Optimization Issues

Optimization is a critical issue when you develop such controls that employ heavy computations. In this case, the problems are speed and image flickering since GDI+'s DrawImage is used. Double buffering is implemented so that the animation will displayed smoothly. Another issue, slow speed, only occurs if you do a direct rendering of the transparent image. We build additional bitmaps for this reason, which causes another drawback, the use of additional memory.


  • v0.1 (9 April 2006): Initial release.

    Implemented alpha transparency, and zoom on mouse-hover.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Indonesia Indonesia
Yojana Hanif was love to code, he is just graduated from Institut Teknologi Sepuluh Nopember Surabaya Indonesia.

You may also be interested in...

Comments and Discussions

GeneralMy vote of 5 Pin
keritingNZ18-Aug-12 7:37
memberkeritingNZ18-Aug-12 7:37 
Generalprofblem if transparent Pin
jinfrics23-Sep-09 19:51
memberjinfrics23-Sep-09 19:51 
Generalvery good job [modified] Pin
iowhfojfljLEJFSFLJafa12-Sep-07 0:45
memberiowhfojfljLEJFSFLJafa12-Sep-07 0:45 
GeneralFurther simplification Pin
blackholeat17-Jan-07 18:50
memberblackholeat17-Jan-07 18:50 
GeneralRe: Further simplification Pin
sly59623-Apr-07 16:18
membersly59623-Apr-07 16:18 
QuestionWhat kind of icon does one want to import Pin
gordingin19-Nov-06 5:02
membergordingin19-Nov-06 5:02 
GeneralResource Question Pin
gordingin19-Nov-06 4:52
membergordingin19-Nov-06 4:52 
Generalso cool Pin
amin keshani12-Oct-06 2:05
memberamin keshani12-Oct-06 2:05 
General[LONG] Big update with everybody contributions Pin
Lelhu18-Sep-06 8:05
memberLelhu18-Sep-06 8:05 
GeneralRe: [LONG] Big update with everybody contributions Pin
femme8-Mar-07 11:42
memberfemme8-Mar-07 11:42 
QuestionMemory Problem fixed? Pin
K32118-Aug-06 1:31
memberK32118-Aug-06 1:31 
QuestionRe: Memory Problem fixed? Pin
swtechno18-Aug-06 5:23
memberswtechno18-Aug-06 5:23 
GeneralExcellent!! But maybe an addition.... Pin
K32117-Aug-06 21:30
memberK32117-Aug-06 21:30 
GeneralBug + Fix: Iconit after visibility change Pin
Kel_24-Jul-06 23:37
memberKel_24-Jul-06 23:37 
GeneralBug + Fix: BackColor problem Pin
Pink Floyd10-May-06 13:07
memberPink Floyd10-May-06 13:07 
GeneralA question Pin
MengChih25-Apr-06 0:20
memberMengChih25-Apr-06 0:20 
AnswerRe: A question Pin
Pink Floyd10-May-06 13:08
memberPink Floyd10-May-06 13:08 
GeneralRe: A question Pin
MengChih15-May-06 0:08
memberMengChih15-May-06 0:08 
Generalvery creative work ! Pin
BillWoodruff24-Apr-06 16:25
memberBillWoodruff24-Apr-06 16:25 
Generaltooltip behavior Pin
agarcian21-Apr-06 8:25
memberagarcian21-Apr-06 8:25 
GeneralRe: tooltip behavior Pin
jayoscar23-Apr-06 21:48
memberjayoscar23-Apr-06 21:48 
GeneralRe: tooltip behavior Pin
Pink Floyd11-May-06 5:04
memberPink Floyd11-May-06 5:04 
GeneralA more efficient alpha routeen... Pin
Jon Rista20-Apr-06 18:21
memberJon Rista20-Apr-06 18:21 
GeneralRe: A more efficient alpha routeen... Pin
Jon Rista20-Apr-06 18:38
memberJon Rista20-Apr-06 18:38 
GeneralRe: A more efficient alpha routeen... Pin
jayoscar21-Apr-06 1:30
memberjayoscar21-Apr-06 1:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180216.1 | Last Updated 12 Apr 2006
Article Copyright 2006 by hanifku
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid