当前注册人数422581人 邮箱: 密码: 注册新用户 忘记密码
首页 C/C++/MFC C# ASP.NET VB.NET MATLAB Android   站内搜索 下载代码说明/积分规则
为什么要注册?

1. 可以直接免费从本站下载代码,防止邮件发送不到您的邮箱,或登录不了国外网站

2. 可以设定关键字,当有您关心的代码收录时,邮件通知您

3. 对这里的代码进行评分和评论

4. 可以和大家一起分享你的源代码,得到更多的建议

Fading Forms In and Out

Form窗口淡入淡出效果源代码(重叠透明)

2008年01月25日
C#, C# 2.0, Windows, .NET, .NET 2.0, Visual Studio, GDI+, Dev, Design
这个程序实现.net中form窗口的淡入淡出效果,实现语言是C#,在窗口弹出/打开和关闭的时候,就会实现这种淡入淡出的效果。另外,如果,最小化、恢复,或者失去焦点、得到焦点的时候,都会以半透明等方式出现。
相关知识
//Performs fade increment.

private void timer_Tick(object sender, EventArgs e)
{
    double fadeChangePerTick = timer.Interval * 1.0 / 1000 / fadeTime;

    //Check to see if it is time to stop the timer

    if (Math.Abs(targetOpacity - this.Opacity) < fadeChangePerTick)
    {
        //There is an ugly black flash if you set the Opacity to 1.0

        if (targetOpacity == 1) this.Opacity = .999;
        else this.Opacity = targetOpacity;
        
        //Process held Windows Message.

        base.WndProc(ref heldMessage);
        heldMessage = new Message();
        
        //Stop the timer to save processor.

        timer.Stop();
    }
    else if (targetOpacity > this.Opacity) this.Opacity += fadeChangePerTick;
    else if (targetOpacity < this.Opacity) this.Opacity -= fadeChangePerTick;
}
源代码原文下载:
Fading Forms In and Out I have had need in the past to cause my forms to perform fade transitions from one opacity to another. It was usually on load, close and window state changes. * fades in on open. * fades out on close. * partially fades out on focus lost. * fades in on focus. * fades out on minimize. * fades in on restore.

源码图片

点击链接查看大图
从本站下载附件及源代码(1个附件,已经成功下载632次)

最值得关注的外文源代码

Generic TCP/IP Client/Server
Instantly Changing Language in the Form
Not OLE .Net/WPF container of MFC applications
graybox-A pop-up window that doesn't suck
评论(评论是增加积分的一个有效途径)
字数在300字内
请如实评论
本源代码共评论118次,此处显示最近20次评论! 查看所有评论

loongsyh  2020年10月05日
thanks!
goodliness  2017年05月09日
顶顶顶!
hcbin  2014年11月30日
高档!
乔微尔  2014年10月17日
谢谢分享!
若柳芊妍  2014年04月30日
学习学习
么有蜡笔的小新  2014年04月30日
谢谢分享
Actatonce  2014年04月10日
非常好的资源,谢谢分享。
weizw  2013年08月11日
使用timer?
dongwei187  2013年05月04日
此功能让程序更有美感和动感,给人以视觉的享受。
lamborghini  2013年05月01日
zhl_download1  2012年11月22日
不错
heeter  2012年10月28日
感谢分享
656561836  2012年09月10日
下来学习一下
deepsky  2012年06月26日
下载下来学习一下
sinbel  2012年02月20日
挺好的
wenyan1232  2012年02月10日
很好
747685707  2011年12月28日
下载下来学习一下
baituxigua  2011年12月02日
hjbj
jijie  2011年11月28日
学习学习
reading  2011年11月21日
学习
字数在300字内
请如实评论
200万国内源码搜索
CopyRight (C) codesoso.com 2007-2009 All Rights Reserved zhihuishi   免责声明