Jump to content
Sign in to follow this  
picea892

resize icon on the fly

Recommended Posts

picea892

Hi

Thought I'd see if there was a better way of doing this. I can provide code for the options I've explored if needed but think this is simple enough to just describe it.

What I want to do is resize an icon when the mouse hovers over it similar to a Mac interface. I have successfully done this three different ways but am still not satisfied with the quality of the icon or the amount of flicker.

Option#1

Description: Create icon at 32x32 onhover delete icon and create 48x48 icon.

result: good quality icons but with flicker

Option#2

Description: Create icon at 48x48 and resize guictrl to 32x32 before showing. On mousehover, GUICtrlSetPos resized to 48x48

result: 32x32 sized icon has poor quality, flicker is probably best for the options

Option#3

Description: Create icon at 32x32 onhover GUICtrlSetData and create 48x48 icon.

result: good quality icons but with flicker

Is there any other way to do this? I think I'm leaning towards option 3 at this point.

Thanks in advance for any advice

Share this post


Link to post
Share on other sites
WideBoyDixon

Without seeing the UI it's tricky but perhaps you could create both icons at the beginning and show/hide on mousehover. That is, have two icons and when the mouse hovers over the first one, hide it and show the other one (or simply show the other one over the top).

WBD

Share this post


Link to post
Share on other sites
picea892

I'll give it a try.

Never have much luck with hiding guictrls and showing them again. I guess I could move the icons off the screen and make the swap when needed.

Thanks

Share this post


Link to post
Share on other sites
Richard Robertson

You'll need to handle drawing yourself to prevent flicker. Windows will redraw the background of a standard control before drawing the foreground. That is unavoidable.

Share this post


Link to post
Share on other sites
picea892

How do I draw it myself? Do you mean something like _WinAPI_DrawIconEx

Share this post


Link to post
Share on other sites
Richard Robertson

You'll need to do custom drawing of the entire control. I'm not the person to ask about drawing in AutoIt. I never work with AutoIt's GUI code.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×