欢迎光临 Rick 's BLOG
日志首页  | C# .Net编程  | 原创作品  | 生活点滴  | C\C++相关  | 多媒体相关※ERMP  | VB相关  | 其它运维与编程  |  留言簿
C#中byte[]字节数组复制的5种常用方法 C#实现WebApi接口数据传输加密方案
未知  C# 中实现几种幻灯片中的窗口特效
[ 发布日期:3年前 (2024-01-05) ]   [ 来自:本站原创 ] [分类:C# .Net编程]

  • 淡入淡出
  • 变大变小
  • 缓升缓降


实现的代码片段参考如下:

淡入淡出
[复制到剪贴板]
public Form1()
{
InitializeComponent();
Opacity = 0;
timer1.Interval = 10;
timer1.Start();
}
private
void timer1_Tick(object sender, EventArgs e)
{

if (
isShow)
{
if (
Height < height)
{
Height += 1;
}
else
{
timer1.Stop();
}
}
else
{
if (
ClientSize.Height > 0)
{
Height -= 1;
}
else
{
timer1.Stop();
Close();
}
}
}
?>


变大变小
[复制到剪贴板]
public Form2()
{
InitializeComponent();
height = Height;

Size = new Size(Width, 0);
timer1.Interval = 10;
timer1.Start();
}

private
void timer1_Tick(object sender, EventArgs e)
{

if (
isShow)
{
if (
Height < height)
{
Height += 1;
}
else
{
timer1.Stop();
}
}
else
{
if (
ClientSize.Height > 0)
{
Height -= 1;
}
else
{
timer1.Stop();
Close();
}
}
}
?>


缓升缓降
[复制到剪贴板]
public Form3()
{
InitializeComponent();
timer1.Interval = 10;
}
private
void Form3_Load(object sender, EventArgs e)
{
Location = new Point(screenRect.Width - Width, screenRect.Height);
timer1.Start();
}
private
void timer1_Tick(object sender, EventArgs e)
{
if (
isShow)
{
if (
Location.Y > screenRect.Height-Height)
{
Location = new Point(Location.X, Location.Y - 1);
}
else
{
timer1.Stop();
}
}
else
{
if (
Location.Y < screenRect.Height )
{
Location = new Point(Location.X, Location.Y + 1);
}
else
{
timer1.Stop();
Close();
}
}

}
?>
如果文章对您有帮助,给个赞赏吧!
引用通告地址 (0):
复制引用地址https://www.rickw.cn/trackback/332
复制引用地址https://www.rickw.cn/trackback/332/GBK
[ 分类:C# .Net编程  | 查看:3750 ]

暂时没有评论,快来发表一个评论吧。
发表评论
作者:   用户:[访客] 
评论:

表  情
禁止表情 | 禁止UBB | 禁止图片 | 识别链接
对不起,你没有权限上传附件!
验证:
 
PoweredBy R-Blog V1.00 © 2004-2026 WWW.RICKW.CN, Processed in second(s) , 5 queries    京ICP备17058477号-5