Form2.cs
上传用户:liupy888
上传日期:2022-08-10
资源大小:734k
文件大小:3k
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Case01_3
- {
- public partial class Form2 : Form
- {
- public const Int32 AW_HOR_POSITIVE = 0x00000001; //自左向右显示窗体
- public const Int32 AW_HOR_NEGATIVE = 0x00000002; //自右向左显示窗体
- public const Int32 AW_VER_POSITIVE = 0x00000004; //自上而下显示窗体
- public const Int32 AW_VER_NEGATIVE = 0x00000008; //自下而上显示窗体
- public const Int32 AW_CENTER = 0x00000010; //窗体向外扩展
- public const Int32 AW_HIDE = 0x00010000; //隐藏窗体
- public const Int32 AW_ACTIVATE = 0x00020000; //激活窗体
- public const Int32 AW_SLIDE = 0x00040000; //使用滚动动画类型
- public const Int32 AW_BLEND = 0x00080000; //使用淡入效果
- //声明AnimateWindow函数
- [System.Runtime.InteropServices.DllImportAttribute("user32.dll")]
- private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
- public Form2()
- {
- InitializeComponent();
- }
- private void Form2_Load(object sender, EventArgs e)
- {
- if (this.Text == "自左向右滚动窗体动画效果")
- {
- AnimateWindow(this.Handle, 2000, AW_HOR_POSITIVE);
- }
- if (this.Text == "自左向右滑动窗体动画效果")
- {
- AnimateWindow(this.Handle, 2000, AW_SLIDE + AW_HOR_POSITIVE);
- }
- if (this.Text == "自右向左滚动窗体动画效果")
- {
- AnimateWindow(this.Handle, 2000, AW_HOR_NEGATIVE);
- }
- if (this.Text == "自右向左滑动窗体动画效果")
- {
- AnimateWindow(this.Handle, 2000, AW_SLIDE + AW_HOR_NEGATIVE);
- }
- if (this.Text == "自上向下滚动窗体动画效果")
- {
- AnimateWindow(this.Handle, 2000, AW_VER_POSITIVE);
- }
- if (this.Text == "自上向下滑动窗体动画效果")
- {
- AnimateWindow(this.Handle, 2000, AW_SLIDE + AW_VER_POSITIVE);
- }
- if (this.Text == "自下向上滚动窗体动画效果")
- {
- AnimateWindow(this.Handle, 2000, AW_VER_NEGATIVE);
- }
- if (this.Text == "自下向上滑动窗体动画效果")
- {
- AnimateWindow(this.Handle, 2000, AW_SLIDE + AW_VER_NEGATIVE);
- }
- if (this.Text == "向外扩展窗体动画效果")
- {
- AnimateWindow(this.Handle, 2000, AW_SLIDE + AW_CENTER);
- }
- if (this.Text == "淡入窗体动画效果")
- {
- AnimateWindow(this.Handle, 2000, AW_BLEND);
- }
-
- }
- }
- }