您的位置:首页 > 编程语言 > C#

利用C#语言,winform技术,仿360安装动画

2016-08-26 14:12 183 查看
通过观察可知,360安装动画是几个个圆不停的放大的过程。也就是同心圆半径不同的放大。

我利用五个圆,做出类似的效果,为了,区分效果,我设置五个圆利用不同的画笔。

下面是具体的代码:

这个五个半径做为全局变量

        int x1 = 200;

        int x2 = 100;

        int x3 = 50;

        int x4 = 150;

        int x5 = 250;

具体的实现放在timer控件中

x1 = x1 + 10;

            if (x1 > 300) {

                x1 = 50;

            }

            x2 = x2 + 10;

            if (x2 > 300)

            {

                x2 = 50;

            }

            x3 = x3 + 10;

            if (x3 > 300)

            {

                x3 = 50;

            }

            x4 = x4 + 10;

            if (x4 > 300)

            {

                x4 = 50;

            }

            x5 = x5 + 10;

            if (x5 > 300) {

               

                x5 = 50;

            }

            this.Refresh();

            Graphics ghs1 = this.CreateGraphics();

            Graphics ghs2 = this.CreateGraphics();

            Graphics ghs3 = this.CreateGraphics();

            Graphics ghs4 = this.CreateGraphics();

            Graphics ghs5 = this.CreateGraphics();

            Pen myPen1 = new Pen(Color.Firebrick, 2);

            Pen myPen2 = new Pen(Color.Yellow, 2);

            Pen myPen3 = new Pen(Color.ForestGreen, 2);

            Pen myPen4 = new Pen(Color.Fuchsia, 2);

            Pen myPen5 = new Pen(Color.Goldenrod, 2);

            ghs1.DrawEllipse(myPen1, 400 - x1 / 2, 300 - x1 / 2, x1, x1);

            ghs2.DrawEllipse(myPen2, 400 - x2 / 2, 300 - x2 / 2, x2, x2);

            ghs3.DrawEllipse(myPen3, 400 - x3 / 2, 300 - x3 / 2, x3, x3);

            ghs4.DrawEllipse(myPen4, 400 - x4 / 2, 300 - x4 / 2, x4, x4);

            ghs5.DrawEllipse(myPen5, 400 - x5 / 2, 300 - x5 / 2, x5, x5);

         
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: