Delphi 2010 image on Tbutton fading/blinking -


when set imageindex , images property of button (from imagelist component/pngs), start program , click button, image blinking slowly/ fading in , out. how prevent , seems problem?

reviving old topic...

after searching solution on internet , found nothing, took in tcustombutton code.

it happens that, internaly, button control on windows has imagelist 6 images, follows:

index 0: normal image
index 1: hot image (when mouse moving on button)
index 2: pressed image (while hold mouse button d own)
index 3: disabled image
index 4: selected image (when button has focus, not pressed nor mouse on it)
index 5: (the 1 need , can't specified in tbutton control; we'll talk it)

in tbutton control in delphi, can set imagelist "images" property, , can set "imageindex", "hotimageindex", "pressedimageindex", "disabledimageindex" , "selectedimageindex".

properties set, tbutton control creates image list, , copy indexes specified in properties image list in "images" property new created image list, in order specified above.

problem is, when focus control, win 7 aero has effect fades in , out highlight color (a little animation), , used 6th image it's internal image list fade in , out also, impossible supply "fade" image index tbutton control, have created simple solution working myself, have call in runtime. (you derive new class tcustombutton , create new control can set new selectedfadeimageindex example, didnt).

created procedure:

    procedure makebuttonimagestopblinking(abutton: tcustombutton);     var       buttonimagelist: tbuttonimagelist;       icon: hicon;     begin       sendmessage(abutton.handle, bcm_getimagelist, 0, lparam(@buttonimagelist));       icon := imagelist_geticon(buttonimagelist.himl, 0, ild_normal);       imagelist_addicon(buttonimagelist.himl, icon);       destroyicon(icon);     end;


so, when window created (on oncreate event), call makebuttonimagestopblinking suppling each button has image it's parameter, , works.

sry revving such old topic, seems no answer anyware (or wasn't able search properly).

edit: setting doublebufferd true work, stop little animation button focus. solution above, can leave doublebuffered false , you'll (animation aero , no fading out image).


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -