欢迎光临 Rick 's BLOG
日志首页  | C# .Net编程  | 原创作品  | 生活点滴  | C\C++相关  | 多媒体相关※ERMP  | VB相关  | 其它运维与编程  |  留言簿
php判断通信协议http或是https 使用 Certbot 免费申请 https ssl 证书详解
未知  C# 中实现几种幻灯片中的窗口特效
[ 发布日期:11个月前 (01-05) ]   [ 来自:本站原创 ] [分类:C# .Net编程]

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


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

淡入淡出
[复制到剪贴板]

public Form1()
        {
            
InitializeComponent();
            
Opacity 0;
            
timer1.Interval 10;
            
timer1.Start();
        }
   private 
void timer1_Tick(object senderEventArgs 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(Width0);
            
timer1.Interval 10;
            
timer1.Start();
        }
 
 private 
void timer1_Tick(object senderEventArgs 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 senderEventArgs e)
        {
            
Location = new Point(screenRect.Width WidthscreenRect.Height);
            
timer1.Start();
        }
 private 
void timer1_Tick(object senderEventArgs e)
        {
            if (
isShow)
            {
                if (
Location.screenRect.Height-Height)
                {
                    
Location = new Point(Location.XLocation.1);
                }
                else
                {
                    
timer1.Stop();
                }
            }
            else
            {
                if (
Location.screenRect.Height )
                {
                    
Location = new Point(Location.XLocation.1);
                }
                else
                {
                    
timer1.Stop();
                    
Close();
                }
            }

        } 


引用通告地址 (0):
复制引用地址https://www.rickw.cn/trackback/332
复制引用地址https://www.rickw.cn/trackback/332/GBK
[ 分类:C# .Net编程  | 查看:1358 ]

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

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