Animated "fade-in" menues? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Animated "fade-in" menues?

Does anyone know how to make a custom menu fade-in when I press the right mouse button?

I suppose I need to open a pop-up window without background and paint it several times with different levels of the alpha channelthis is fine the first time I paint the window, but the next time I need the original background to paint over, and how can I be sure the background hasn't changed (aninmation or movement of the other windows)? I would want a way to repaint what's behind the new pop-up window...

Thanks for any suggestions!

Comments

  • JasonDJasonD Posts: 15Member
    : Does anyone know how to make a custom menu fade-in when I press the right mouse button?
    :
    : I suppose I need to open a pop-up window without background and paint it several times with different levels of the alpha channelthis is fine the first time I paint the window, but the next time I need the original background to paint over, and how can I be sure the background hasn't changed (aninmation or movement of the other windows)? I would want a way to repaint what's behind the new pop-up window...

    Take a look at the AnimateWindow Function:
    http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/animatewindow.asp
    Use the AW_BLEND constant. Perhaps this is what you are looking for.

    Jason Doucette
    http://www.jasondoucette.com/
    "[italic]If you don't win, its not a great tragedy - the worst that happens is that you lose a game.[/italic]" - [italic]Bobby Fischer[/italic]

  • Orup at workOrup at work Posts: 1Member
    [green]: : Does anyone know how to make a custom menu fade-in when I press
    : : the right mouse button?[/green]

    [blue]: Take a look at the AnimateWindow Function:
    : http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/animatewindow.asp
    : Use the AW_BLEND constant. Perhaps this is what you are looking for.
    :
    : Jason Doucette
    : http://www.jasondoucette.com/
    : "[italic]If you don't win, its not a great tragedy - the worst that happens is that you lose a game.[/italic]" - [italic]Bobby Fischer[/italic][/blue]
    Thanks a lot for the suggestion! I haven't tested the AnimatedWindow function yet but the article above lead me to another article on MSDN that explains the principles of layerered windows that the AnimateWindow function use to create blended/animated windows:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/layerwin.asp

    It's a very good explanation about the quite advanced functionality in Windows 2000/XP to create blended and transparent custom windows with good performence.

    To simply get a 70% alpha blended effect on any window you use:

    [code]// Set WS_EX_LAYERED on this window
    SetWindowLong(hwnd, GWL_EXSTYLE,
    GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
    // Make this window 70% alpha
    SetLayeredWindowAttributes(hwnd, 0, (255 * 70) / 100, LWA_ALPHA);[/code]
    Or create the window using the CreateWindowEx() function with the WS_EX_LAYERED bit set to skip SetWindowLong(). But using the UpdateLayeredWindow() function you can achieve much more advanced features painting in a background bitmap and letting Windows taking care of all update issues. Very neat! (in my own opinion...)

    Phl Melin (Orup at work)
    http://relmind.com/

  • JasonDJasonD Posts: 15Member
    : Thanks a lot for the suggestion! I haven't tested the AnimatedWindow function yet but the article above lead me to another article on MSDN that explains the principles of layerered windows that the AnimateWindow function use to create blended/animated windows:
    :
    : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/layerwin.asp
    :
    : It's a very good explanation about the quite advanced functionality in Windows 2000/XP to create blended and transparent custom windows with good performence.

    I just read the article; it's pretty good. Thanks for the information!

    Jason Doucette
    http://www.jasondoucette.com/
    "[italic]If you don't win, its not a great tragedy - the worst that happens is that you lose a game.[/italic]" - [italic]Bobby Fischer[/italic]

Sign In or Register to comment.