Winform窗体效果实例分析
作者:我心依旧 时间:2023-12-12 04:44:08
本文实例分析了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,窗体
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
解决@RequestBody使用不能class类型匹配的问题
2023-04-20 19:28:10
![](https://img.aspxhome.com/file/2023/5/96825_0s.png)
c#爬虫爬取京东的商品信息
2022-12-03 14:38:11
Java应用开源框架实现简易web搜索引擎
2023-08-22 20:20:54
Android gradle打包并自动上传的方法
2022-01-23 06:50:37
![](https://img.aspxhome.com/file/2023/9/138909_0s.jpg)
springboot反爬虫组件kk-anti-reptile的使用方法
2022-01-09 14:12:59
![](https://img.aspxhome.com/file/2023/6/85896_0s.png)
Java中Jackson快速入门
2023-01-18 10:24:44
JAVA中的final关键字用法实例详解
2021-06-25 12:10:08
Java 实战项目之精品养老院管理系统的实现流程
2022-05-30 08:18:11
![](https://img.aspxhome.com/file/2023/7/125247_0s.jpg)
Android实现通用筛选栏
2021-10-16 05:31:42
![](https://img.aspxhome.com/file/2023/3/117073_0s.gif)
详解Java中的ForkJoin
2023-05-09 15:22:20
![](https://img.aspxhome.com/file/2023/9/106089_0s.webp)
Android中post请求传递json数据给服务端的实例
2022-04-21 01:51:18
Android 文件存储系统原理
2021-12-24 05:10:57
Android开发实现抽屉菜单
2022-09-01 11:47:09
![](https://img.aspxhome.com/file/2023/3/137973_0s.jpg)
mybatis注解与xml常用语句汇总
2022-05-17 18:39:47
利用C#快速查出哪些QQ好友空间屏蔽了自己
2023-10-07 22:14:28
![](https://img.aspxhome.com/file/2023/0/106430_0s.jpg)
java开发_图片截取工具实现原理
2023-10-23 22:52:06
![](https://img.aspxhome.com/file/2023/0/74880_0s.png)
java基于AES对称加密算法实现的加密与解密功能示例
2023-02-07 13:34:47
SpringBoot重写addResourceHandlers映射文件路径方式
2022-05-26 19:02:40
![](https://img.aspxhome.com/file/2023/3/66183_0s.jpg)
android开发权限询问的示例代码
2021-07-29 00:16:26
全面分析Java文件上传
2021-12-09 13:22:52
![](https://img.aspxhome.com/file/2023/5/62515_0s.png)