窗口淡入淡出效果

来源:互联网 发布:淘宝网店加盟职是真假 编辑:程序博客网 时间:2024/04/30 11:16

创建窗口时,如果需要淡入淡出效果,可以使用

animatewindow 系统api

参数如下

BOOL AnimateWindow(
  HWND
hwnd,     // handle to the window to animate
  DWORD dwTime// duration of animation
  DWORD dwFlags  // animation type
);

Parameters

hwnd
Specifies a handle to the window to animate.
dwTime
Specifies how long it takes to play the animation, in milliseconds. Typically, an animation takes 200 milliseconds to play.
dwFlags
Specifies the type of animation. This parameter can be one or more of the following flags. FlagDescriptionAW_SLIDEUses slide animation. By default, roll animation is used. This flag is ignored when used with the AW_CENTER flag. AW_ACTIVATEActivates the window. Do not use this flag with AW_HIDE. AW_BLENDUses a fade effect. This flag can be used only if hwnd is a top-level window. AW_HIDEHides the window. By default, the window is shown. AW_CENTERMakes the window appear to collapse inward if the AW_HIDE flag is used or expand outward if the AW_HIDE flag is not used. AW_HOR_POSITIVEAnimate the window from left to right. This flag can be used with roll or slide animation. It is ignored when used with the AW_CENTER flag.AW_HOR_NEGATIVEAnimate the window from right to left. This flag can be used with roll or slide animation. It is ignored when used with the AW_CENTER flag.AW_VER_POSITIVEAnimate the window from top to bottom. This flag can be used with roll or slide animation. It is ignored when used with the AW_CENTER flag. AW_VER_NEGATIVEAnimate the window from bottom to top. This flag can be used with roll or slide animation. It is ignored when used with the AW_CENTER flag.

 

有一点需要注意

其实上面都已经提到

就是当窗口关闭时

必须需要用到AW_HIDE|AW_CENTER两个参数来实现否则看不到效果

 

原创粉丝点击