当前位置:网站首页>C#窗体的淡入淡出功能(项目工程源码)
C#窗体的淡入淡出功能(项目工程源码)
2022-04-22 12:54:00 【IT技术猿猴】
先给大家看一下效果,感觉还可以

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//淡出特效隐藏
if (Win32.AnimateWindow(this.Handle, 2300, Win32.AW_BLEND | Win32.AW_HIDE)) {
//淡入特效显示
Win32.AnimateWindow(this.Handle, 2300, Win32.AW_BLEND | Win32.AW_ACTIVATE);
}
}
}
public class Win32
{
/// <summary>
/// 执行动画
/// </summary>
/// <param name="whnd">控件句柄</param>
/// <param name="dwtime">动画时间</param>
/// <param name="dwflag">动画组合名称</param>
/// <returns>bool值,动画是否成功</returns>
[DllImport("user32.dll")]
public static extern bool AnimateWindow(IntPtr whnd, int dwtime, int dwflag);
/// <summary>
/// 从左到右显示
/// </summary>
public const Int32 AW_HOR_POSITIVE = 0x00000001;
/// <summary>
/// 从右到左显示
/// </summary>
public const Int32 AW_HOR_NEGATIVE = 0x00000002;
/// <summary>
/// 从上到下显示
/// </summary>
public const Int32 AW_VER_POSITIVE = 0x00000004;
/// <summary>
/// 从下到上显示
/// </summary>
public const Int32 AW_VER_NEGATIVE = 0x00000008;
/// <summary>
/// 若使用了AW_HIDE标志,则使窗口向内重叠,即收缩窗口;否则使窗口向外扩展,即展开窗口
/// </summary>
public const Int32 AW_CENTER = 0x00000010;
/// <summary>
/// 隐藏窗口,缺省则显示窗口
/// </summary>
public const Int32 AW_HIDE = 0x00010000;
/// <summary>
/// 激活窗口。在使用了AW_HIDE标志后不能使用这个标志
/// </summary>
public const Int32 AW_ACTIVATE = 0x00020000;
/// <summary>
/// 使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时,这个标志就被忽略
/// </summary>
public const Int32 AW_SLIDE = 0x00040000;
/// <summary>
/// 透明度从高到低
/// </summary>
public const Int32 AW_BLEND = 0x00080000;
}
}
版权声明
本文为[IT技术猿猴]所创,转载请带上原文链接,感谢
https://blog.csdn.net/baobingji/article/details/124332891
边栏推荐
- Write your own compiler: build a syntax tree through syntax compilation and realize intermediate code generation
- Interpreting closures from structured context
- 制裁压力下,俄罗斯计划通过友好国家平行进口电子产品
- 钢箱梁顶推作用下底板腹板局部应力 abaqus模型
- R language ggplot2 visualization: calculate the number of missing values of each data column in the dataframe, and visualize the missing values of each data column using a stacked bar plot (set the co
- 这个开源项目是要把我笑死吗?
- ES6解构赋值之数组的解构赋值
- 从结构化上下文解读闭包
- Under the pressure of sanctions, Russia plans to import electronic products in parallel through friendly countries
- Excel字符串拼接
猜你喜欢

Chinese characters and screenshots suitable for the test boundary are selected

Ros2 learning notes (IX) learn the bag recording of ros2 from turnlesim

线程相关问题

R language splits dataframe into two or more dataframe actual combat (splitting tables): Using R native method, data Table, dplyr and other schemes

ROS2学习笔记(十)从turtlesim学习ROS2的工作空间

动态规划 字符的最短距离

書城項目注册頁面和郵箱驗證

Share a recent tag

April 21, 2022 s s s m framework integration @ lesson 1 s s m environment configuration & focus on practical operation. Summary in practice. The results are not shown here.

vnpy本地导入csv数据
随机推荐
11. Container with the most water
R语言将dataframe数据从长表(long)变为宽表(wide)实战:tidyr包的spread函数、cdata包的pivot_to_rowrecs函数、data.table包dcast函数
. net treasure API: outputformatter, format output object
@PreAuthorize注解做权限校验
制裁压力下,俄罗斯计划通过友好国家平行进口电子产品
R语言ggplot2可视化X轴因子变量自定义排序,而不是按照默认的字母顺序排序实战
Scientific research - SCI hub course
Partagez quelques conseils pratiques que vous avez accumulés sur un projet mobile récemment écrit
What equipment is needed for VR panoramic shooting? What does it do?
尝试opencv裂缝检测
396. 旋转函数
【JZ48 最长不含重复字符的子字符串】
17. 电话号码的字母组合
Desai wisdom number - line chart (dynamic line chart): price adjustment of gasoline and diesel in recent 1 year
ROS2学习笔记(十)从turtlesim学习ROS2的工作空间
21. 合并两个有序链表
Chinese characters and screenshots suitable for the test boundary are selected
17. Letter combination of telephone number
matlab 桥梁跨径组合问题GUI图形界面完成
Generation process of executable file