winform 渐变(非API)

        public FrmMain()
        {
            InitializeComponent();
            //窗体显示特效
            Opacity = 0.0; //窗体透明度为0
            fadeTimer.Start(); //计时开始
        }


        private void fadeTimer_Tick(object sender, EventArgs e)
        {
            const double d = 0.10;
            if (Opacity + d >= 1.0)
            {
                Opacity = 1.0;
                fadeTimer.Stop();
            }
            else
            {
                Opacity += d;
            }
        }

 

posted @ 2014-03-20 09:59  Nemo_Li  阅读(239)  评论(0编辑  收藏  举报