手机
当前位置:查字典教程网 >编程开发 >C#教程 >Winform窗体效果实例分析
Winform窗体效果实例分析
摘要:本文实例分析了Winform窗体效果。分享给大家供大家参考。具体如下:usingSystem;usingSystem.Collections...

本文实例分析了Winform窗体效果。分享给大家供大家参考。具体如下:

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication4 { public partial class Form3 : Form { bool flag = false; public Form3() { InitializeComponent(); flag = true; } #region user32.dll //导入user32.dll [System.Runtime.InteropServices.DllImport("user32")] //声明API函数 private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags); #endregion #region 常量 //正面_水平方向 const int AW_HOR_POSITIVE = 0x0001; //负面_水平方向 const int AW_HOR_NEGATIVE = 0x0002; //正面_垂直方向 const int AW_VER_POSITIVE = 0x0004; //负面_垂直方向 const int AW_VER_NEGATIVE = 0x0008; //由中间四周展开或 const int AW_CENTER = 0x0010; //隐藏对象 const int AW_HIDE = 0x10000; //显示对象 const int AW_ACTIVATE = 0x20000; //拉幕滑动效果 const int AW_SLIDE = 0x40000; //淡入淡出渐变效果 const int AW_BLEND = 0x80000; #endregion #region 判断方向 public int IsHorOrVer(int pos) { int rtn = 0; //判断是正方向还是反方向 if (pos.Equals(0)) { //判断是横向还是纵向 if (flag) rtn = AW_HOR_POSITIVE; else rtn = AW_VER_POSITIVE; } else if (pos.Equals(1)) { //判断是横向还是纵向 if (flag) rtn = AW_HOR_NEGATIVE; else rtn = AW_VER_NEGATIVE; } return rtn; } #endregion private void button1_Click(object sender, EventArgs e) { //动画——窗体向上拖拉 AnimateWindow(this.Handle, 1000, AW_SLIDE | AW_HIDE | IsHorOrVer(1)); //动画——窗体向下拖拉 AnimateWindow(this.Handle, 1000, AW_SLIDE | AW_ACTIVATE | IsHorOrVer(0)); //动画——窗体淡出特效 AnimateWindow(this.Handle, 1000, AW_BLEND | AW_HIDE | IsHorOrVer(1)); //动画——窗体淡入特效 AnimateWindow(this.Handle, 1000, AW_BLEND | AW_ACTIVATE | IsHorOrVer(0)); //动画——窗体由四周向中心缩小直至消失 AnimateWindow(this.Handle, 1000, AW_CENTER | AW_HIDE | IsHorOrVer(1)); //动画——窗体由中心向四周扩展 AnimateWindow(this.Handle, 1000, AW_CENTER | AW_ACTIVATE | IsHorOrVer(0)); } } }

希望本文所述对大家的C#程序设计有所帮助。

【Winform窗体效果实例分析】相关文章:

C# WinForm中Panel实现用鼠标操作滚动条的实例方法

c#实现sunday算法实例

C#生成注册码的实例代码

c# 抓取Web网页数据分析

C# WinForm窗口最小化到系统托盘

基于C#委托的深入分析

C# 透明窗体制作实现方法比较分析

c# 对windows用户和组操作实例

c# 关闭窗体时提示的小例子

WinForm窗体调用WCF服务窗体卡死问题

精品推荐
分类导航