Winform窗体效果实例分析
- 作者: 达?矢抾哆拉?
- 来源: 51数据库
- 2021-10-07
本文实例分析了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#程序设计有所帮助。
推荐阅读
- C#通过fleck实现wss协议的WebSocket多人Web实时聊天(附源码)
- 团队城市未满足要求:MSBuildTools12.0_x86_Path 存在
- 使用 MSBuild.exe 在发布模式下构建 C# 解决方案
- 当我发布 Web 应用程序时,AfterPublish 脚本不运行
- 构建时 T4 转换的产品仅在下一个构建中使用
- ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json
- 新的 .csproj 格式 - 如何将整个目录指定为“链接文件"到子目录?
- 如何将条件编译符号(DefineConstants)传递给 msbuild
- MSBuild 支持 Visual Studio 2017 RTM 中的 T4 模板
- NuGet 包还原找不到包,没有源
热点文章
团队城市未满足要求:MSBuildTools12.0_x86_Path 存在
0
使用 MSBuild.exe 在发布模式下构建 C# 解决方案
0
当我发布 Web 应用程序时,AfterPublish 脚本不运行
0
构建时 T4 转换的产品仅在下一个构建中使用
0
ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json
0
新的 .csproj 格式 - 如何将整个目录指定为“链接文件"到子目录?
0
如何将条件编译符号(DefineConstants)传递给 msbuild
0
MSBuild 支持 Visual Studio 2017 RTM 中的 T4 模板
0
NuGet 包还原找不到包,没有源
0
使用 C# 6.0 功能运行 TFS 构建
0