如题!
    就是像Windows优化大师或者一些游戏,刚打开程序时,又一个图片或者介绍窗体,淡入淡出的效果,然后链接到主程序,我就想问两点:
    一、淡入淡出的实现:
    好像窗体有个Opacity属性可以实现透明,然后通过Time控件改变其值,从0-1,除了这样还有什么方法?
    二、怎么让图片淡入淡出后自动链接到主程序?
   
    我刚学C#一星期,所以大家见笑了!
    在此拜过,嘿嘿……

解决方案 »

  1.   

    只能用timer逐渐改变透明度可以在淡出后new一个主窗体 然后再调用主窗体的show方法 最后淡出窗体设为隐藏,
      

  2.   

    除了Opacity当然还有其他方法的,但都要至少好几百句话,还有API.没有比Opacity更简单的了.
      

  3.   

    up
    用Form才有的属性Opacity
    这是我以前写的很粗漏的渐变窗体  public partial class Form_Welcome : Form
        {
           
            System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer();
            System.Windows.Forms.Timer timer2 = new System.Windows.Forms.Timer();
            public Form_Welcome()
            {
                InitializeComponent();
                this.timer1.Tick += timer1_Tick;
                this.timer2.Tick += timer2_Tick;
                this.Load += Form_Welcome_Load;
                this.FormClosing += Form_Welcome_FormClosing;
               
            }              private void Form_Welcome_Load(object sender, EventArgs e)
            {       
                timer1.Interval = 1000;
                timer1.Enabled = true;
                timer1.Start();
            }        private void timer1_Tick(object sender, EventArgs e)
            {
                this.DialogResult = DialogResult.OK;
                timer1.Enabled = false;
                timer1.Stop();
                this.Close();        }        private void Form_Welcome_FormClosing(Object sender, FormClosingEventArgs e)
            {
                if (this.Opacity > 0.25)
                {
                    e.Cancel = true;
                }
                else
                {
                    e.Cancel = false;
                }
                timer2.Interval = 80;
                timer2.Enabled = true;
                timer2.Start();
            }        private void timer2_Tick(object sender, EventArgs e)
            {
                if (this.Opacity > 0.25)
                {
                    this.Opacity -= 0.05;
                }
                else
                {
                    this.DialogResult = DialogResult.OK;
                    timer1.Enabled = false;
                    timer2.Stop();
                    this.Close();
                    this.Dispose();
                }
            }
        }//使用时    Form welcomeform = new Form_Welcome();            welcomeform.ShowDialog();