AnimateWindow
WINDOWS提供了一个很有意思的函数:AnimateWindow。
之前我想实现像MSN,QQ这些收到邮件的时候动画方式,从地下升上来的显示一个窗口,感觉很麻烦,自己去写代码,效果很不理想,今天无意中发现了一个函数AnimateWindow,能很好的实现这个功能。并且网上找了一个例子:
// 主窗体:
unit Unit1; interface uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls; type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation // 动画显示窗体:
uses Unit2; var
mesfrm:tform2; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject);
begin
mesfrm:=tform2.Create(application);
mesfrm.Show;
end; procedure TForm1.Button2Click(Sender: TObject);
begin
mesfrm.close;
end; end. unit Unit2; interface uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs; type
TForm2 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
procedure Show;
procedure close;
end; var
Form2: TForm2; implementation {$R *.dfm} function ShowWindows(WHandle:HWND;DispMode:Integer): Boolean;
var Flag:array [..] of Int64;
begin
if DispMode= then begin
//显示
Flag[]:=AW_ACTIVATE+AW_HOR_POSITIVE+AW_VER_POSITIVE+AW_SLIDE;//左上至右下 滑行效果
Flag[]:=AW_ACTIVATE+AW_HOR_NEGATIVE+AW_VER_POSITIVE+AW_SLIDE;//右上至左下 滑行效果
Flag[]:=AW_ACTIVATE+AW_CENTER+AW_SLIDE; // 中心向四周 滑行效果
Flag[]:=AW_ACTIVATE+AW_HOR_POSITIVE+AW_SLIDE; //左 至右 滑行效果
Flag[]:=AW_ACTIVATE+AW_HOR_NEGATIVE+AW_SLIDE; //右至左 滑行效果
Flag[]:=AW_ACTIVATE+AW_VER_POSITIVE+AW_SLIDE; //上至下 滑行效果
Flag[]:=AW_ACTIVATE+AW_HOR_POSITIVE+AW_VER_POSITIVE+AW_BLEND;//左上至右下 淡入淡出
Flag[]:=AW_ACTIVATE+AW_HOR_NEGATIVE+AW_VER_POSITIVE+AW_BLEND;//右上至左下 淡入淡出
Flag[]:=AW_ACTIVATE+AW_HOR_POSITIVE+AW_BLEND; //左至右 淡入淡出
Flag[]:=AW_ACTIVATE+AW_HOR_NEGATIVE+AW_BLEND; //右至左 淡入淡出
Flag[]:=AW_ACTIVATE+AW_VER_POSITIVE+AW_BLEND; //上至下 淡入淡出
Flag[]:=AW_ACTIVATE+AW_CENTER+AW_BLEND; //中心向四周 淡入淡出
end;
if DispMode= then begin
//关闭
Flag[]:=AW_HIDE+AW_HOR_POSITIVE+AW_VER_NEGATIVE+AW_SLIDE;//左上至右下 滑行效果
Flag[]:=AW_HIDE+AW_HOR_NEGATIVE+AW_VER_NEGATIVE+AW_SLIDE;//右上至左下 滑行效果
Flag[]:=AW_HIDE+AW_CENTER+AW_SLIDE; // 中心向四周 滑行效果
Flag[]:=AW_HIDE+AW_HOR_POSITIVE+AW_SLIDE; //左 至右 滑行效果
Flag[]:=AW_HIDE+AW_HOR_NEGATIVE+AW_SLIDE; //右至左 滑行效果
Flag[]:=AW_HIDE+AW_VER_NEGATIVE+AW_SLIDE; //上至下 滑行效果
Flag[]:=AW_HIDE+AW_HOR_POSITIVE+AW_VER_NEGATIVE+AW_BLEND;//左上至右下 淡入淡出
Flag[]:=AW_HIDE+AW_HOR_NEGATIVE+AW_VER_NEGATIVE+AW_BLEND;//右上至左下 淡入淡出
Flag[]:=AW_HIDE+AW_HOR_POSITIVE+AW_BLEND; //左至右 淡入淡出
Flag[]:=AW_HIDE+AW_HOR_NEGATIVE+AW_BLEND; //右至左 淡入淡出
Flag[]:=AW_HIDE+AW_VER_POSITIVE+AW_BLEND; //上至下 淡入淡出
Flag[]:=AW_HIDE+AW_CENTER+AW_BLEND; //中心向四周 淡入淡出
end;
Randomize;
Result := AnimateWindow(WHandle,,Flag[Random()]);
end; { TForm2 } procedure TForm2.close;
begin
// if AnimateWindow( Handle,200,AW_VER_POSITIVE+AW_HIDE)=false then
if ShowWindows(Handle,)=false then
begin
showmessage('窗体退出出错');
free;
end;
inherited close;
end; procedure TForm2.Show;
begin
top:=;
left:=;
// if AnimateWindow(Handle,200,AW_VER_NEGATIVE)=false then
if ShowWindows(Handle,)=false then
begin
showmessage('窗体显示出错');
free;
end;
inherited show;
end; end.
http://www.cnblogs.com/barryhong/archive/2009/04/26/1443798.html
AnimateWindow的更多相关文章
- C#.NET使用AnimateWindow制作淡入淡出特殊效果的窗体
使用AnimateWindow制作淡入淡出效果的窗体 命名空间: using System.Runtime.InteropServices; API函数: [DllImport("user3 ...
- AnimateWindow 阻塞当前线程问题
今天查了蛮多的,虽然不是系统的学习,收获也不小.下面说一下我的解决方法: 问题一:采用 AnimateWindow API实现消息窗体FormMsg的动画出现,但由于该方法会阻塞当前线程,造成其他窗体 ...
- Delphi使用Windows API函数AnimateWindow实现窗体特效
{**********************************************************************API函数 AnimateWindow 使用:函数功能:窗 ...
- 调用AnimateWindow API来实现弹出效果
下面是实例的cs代码 public partial class frm_Main : Form { //使用Windows Api AnimateWindow [DllImport("use ...
- AnimateWindow类
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- 使用AnimateWindow来实现窗口淡入淡出(主要有四种动画,滚动,滑动,折叠或展开,和淡入淡出)
如果是在VC6下进行编译,应引入下面的预编译宏,注意放在windows.h的前面#undef WINVER #define WINVER 0x500为什么要引入上面的宏呢?看看winuse ...
- 【C#】组件发布:MessageTip,轻快型消息提示窗
-------------201610212046更新------------- 更新至2.0版,基本完全重写,重点: 改为基于原生LayeredWindow窗体和UpdateLayeredWindo ...
- 转:Delphi 6 实用函数
来自: daocaoren0824, 时间: -- ::, ID: 再给你一份 程序员实用函数 {▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎} {▎ ▎} {▎ 大 ...
- winform下如何实现右下角弹窗效果
[DllImport("user32")] private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, in ...
随机推荐
- QTabWidget添加自定义样式
一.参考文章:http://bbs.csdn.net/topics/390632657?page=1 setStyleSheet("QTabWidget::pane{border-width ...
- cf493B Vasya and Wrestling
B. Vasya and Wrestling time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- JFrame画图基础和事件监听
消息框 JOptionPane.showMessageDialog(mine.this, "删除不成功!"); 画图 class MyJPanel extends JPanel / ...
- 转:Excel转换XML工具<一>
http://blog.csdn.net/candle806/article/details/7441695最近在整理测试用例,所以想找一个合适的工具来完成对测试需求.测试用例的管理.对比了一翻,发现 ...
- 设计: ListView 接口,and the missing read-only interfaces in java collection framework
Java的集合框架以其成功易用的设计征服了很多人(包括我),并且教科书式的诠释了泛型的应用方式. 我也是被 Joshua Bloch 的书引领入门,从中得益良多.我当然不会认为自己在设计上比他懂得更多 ...
- ZOJ 3430 Detect the Virus 【AC自动机+解码】
解码的那些事儿,不多说. 注意解码后的结果各种情况都有,用整数数组存储,char数组会超char类型的范围(这个事最蛋疼的啊)建立自动机的时候不能用0来判断结束. #include <cstdi ...
- Spring redirect直接返回项目根文件夹
return "redirect:/";
- 基于Hadoop的大数据平台实施记——整体架构设计[转]
http://blog.csdn.net/jacktan/article/details/9200979 大数据的热度在持续的升温,继云计算之后大数据成为又一大众所追捧的新星.我们暂不去讨论大数据到底 ...
- [Regular Expressions] Introduction
var str = "Is this This?"; //var regex = new RegExp("is", "gi"); var r ...
- Android自定义控件(三)——有弹性的ListView
上一次我们试验了有弹性的ScrollView.详情 这一次,我们来试验有弹性的ScrollView. 国际惯例,效果图: 主要代码: import android.content.Context; i ...