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

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个附件,已经成功下载257次)

最值得关注的外文源代码

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字内
请如实评论
本源代码共评论51次,此处显示最近20次评论! 查看所有评论

ITMEN  2010年08月26日
呵呵 学习下;正好可以应用到我的工作中;
Rocca  2010年08月02日
学习学习,很好,谢谢了
zdblove  2009年08月22日
学习学习
azsdf  2009年06月02日
学习学习,很好,谢谢了
00100  2009年05月29日
谢谢
ChowZenki  2009年05月10日
學習
etimes2008  2009年05月05日
不错
ccqcy  2009年04月28日
不错,
zhyg0927  2009年04月26日
good
yippeesoft  2009年04月22日
效果还不错
aslucky  2009年04月08日
学习学习,刚刚接触C#
牧羊人  2009年03月27日
值得研究研究
tranlynn_lau  2009年03月24日
谢谢,不错的代码
skytion  2009年02月20日
very good
best4u  2009年02月16日
下载了,谢谢
caoda  2009年02月08日
hai hao
破指甲  2009年01月19日
不错的东西,支持
ˇ!L.aㄨ  2008年12月30日
下载看看~
yudale6805  2008年12月25日
不错哦
ss_geng  2008年12月23日
ok
字数在300字内
请如实评论
CopyRight (C) codesoso.com 2007-2009 All Rights Reserved   免责声明