最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Winform圓形環(huán)繞的Loading動(dòng)畫實(shí)現(xiàn)代碼

 更新時(shí)間:2014年01月22日 16:11:16   作者:  
這篇文章主要介紹了Winform圓形環(huán)繞的Loading動(dòng)畫實(shí)現(xiàn)代碼,有需要的朋友可以參考一下

之前寫了一個(gè)WPF的圓形環(huán)繞的Loading動(dòng)畫,現(xiàn)在寫一個(gè)Winform的圓形環(huán)繞的Loading動(dòng)畫。

1.新建Winform項(xiàng)目,添加一個(gè)pictureBox控件,命名為:pictureBox;

2.引用中添加using System.Drawing.Drawing2D;

3.Form窗體命名為:Loading,cs全部代碼如下:

復(fù)制代碼 代碼如下:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Drawing.Drawing2D;

namespace Circle_ProcessBar
{
    public partial class Loading : Form
    {
        private int count = -1;
        private ArrayList images = new ArrayList();
        public Bitmap[] bitmap = new Bitmap[8];
        private int _value = 1;
        private Color _circleColor = Color.Red;
        private float _circleSize = 0.8f;

        public Loading()
        {
            InitializeComponent();      
        }

        public Color CircleColor
        {
            get { return _circleColor; }
            set
            {
                _circleColor = value;
                Invalidate();
            }
        }

        public float CircleSize
        {
            get { return _circleSize; }
            set
            {
                if (value <= 0.0F)
                    _circleSize = 0.05F;
                else
                    _circleSize = value > 4.0F ? 4.0F : value;
                Invalidate();
            }
        }

        public Bitmap DrawCircle(int j)
        {
            const float angle = 360.0F / 8; Bitmap map = new Bitmap(150, 150);
            Graphics g = Graphics.FromImage(map);

            g.TranslateTransform(Width / 2.0F, Height / 2.0F);
            g.RotateTransform(angle * _value);
            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
            g.SmoothingMode = SmoothingMode.AntiAlias;
            int[] a = new int[8] { 25, 50, 75, 100, 125, 150, 175, 200 };
            for (int i = 1; i <= 8; i++)
            {
                int alpha = a[(i + j - 1) % 8];
                Color drawColor = Color.FromArgb(alpha, _circleColor);
                using (SolidBrush brush = new SolidBrush(drawColor))
                {
                    float sizeRate = 3.5F / _circleSize;
                    float size = Width / (6 * sizeRate);

                    float diff = (Width / 10.0F) - size;

                    float x = (Width / 80.0F) + diff;
                    float y = (Height / 80.0F) + diff;
                    g.FillEllipse(brush, x, y, size, size);
                    g.RotateTransform(angle);
                }
            }
            return map;
        }


        public void Draw()
        {
            for (int j = 0; j < 8; j++)
            {
                bitmap[7-j] = DrawCircle(j);
            }
        }
        protected override void OnResize(EventArgs e)
        {
            SetNewSize();
            base.OnResize(e);
        }

        protected override void OnSizeChanged(EventArgs e)
        {
            SetNewSize();
            base.OnSizeChanged(e);
        }

        private void SetNewSize()
        {
            int size = Math.Max(Width, Height);
            Size = new Size(size, size);
        }

        public void set()
        {
            for (int i = 0; i < 8; i++)
            {
                Draw();

                Bitmap map = new Bitmap((bitmap[i]), new Size(120, 110));

                images.Add(map);
            }
            pictureBox.Image = (Image)images[0];
           pictureBox.Size = pictureBox.Image.Size;

        }
        private void pictureBox_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            base.Dispose();
        }

        private void Timer_Tick(object sender, EventArgs e)
        {
            set();
            count = (count + 1) % 8;
            pictureBox.Image = (Image)images[count];

        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            base.Dispose();
        }
    }
}


4.效果如圖:

相關(guān)文章

  • C#中的yield關(guān)鍵字的使用方法介紹

    C#中的yield關(guān)鍵字的使用方法介紹

    yield這個(gè)關(guān)鍵字是和迭代器掛鉤的,而且是與return一起以yield return的形式合用的,用來返回迭代器中的條目。
    2013-04-04
  • C#操作數(shù)據(jù)庫總結(jié)(vs2005+sql2005)

    C#操作數(shù)據(jù)庫總結(jié)(vs2005+sql2005)

    C#操作數(shù)據(jù)庫總結(jié),每次做項(xiàng)目都會(huì)用到數(shù)據(jù)庫,對(duì)數(shù)據(jù)庫的操作都是糊里糊涂從書里找代碼用。通過昨天晚上與今天早上的努力,把數(shù)據(jù)庫的操作整理了一下,下面把整理結(jié)果做個(gè)小結(jié)
    2012-09-09
  • C#創(chuàng)建一個(gè)小型Web Server(Socket實(shí)現(xiàn))

    C#創(chuàng)建一個(gè)小型Web Server(Socket實(shí)現(xiàn))

    這篇文章主要介紹了關(guān)于C#利用Socket實(shí)現(xiàn)創(chuàng)建一個(gè)小型Web Server的相關(guān)資料,文中通過示例代碼介紹的很詳細(xì),需要的朋友可以參考借鑒,下面來一起看看吧。
    2017-02-02
  • C#深拷貝方法探究及性能比較(多種深拷貝)

    C#深拷貝方法探究及性能比較(多種深拷貝)

    這篇文章主要介紹了C#中使用NetCDF存儲(chǔ)二維數(shù)據(jù)的讀寫操作簡(jiǎn)單應(yīng)用,探究了以下幾種C#對(duì)象深拷貝方式,同時(shí)簡(jiǎn)單對(duì)比了以下列出的幾種深拷貝方式的速度,需要的朋友可以參考下
    2022-04-04
  • c# 獲取計(jì)算機(jī)硬件信息的示例代碼

    c# 獲取計(jì)算機(jī)硬件信息的示例代碼

    這篇文章主要介紹了c# 獲取計(jì)算機(jī)硬件信息的示例代碼,幫助大家更好的理解和學(xué)習(xí)c#,感興趣的朋友可以了解下
    2020-10-10
  • WPF ProgressBar實(shí)現(xiàn)實(shí)時(shí)進(jìn)度效果

    WPF ProgressBar實(shí)現(xiàn)實(shí)時(shí)進(jìn)度效果

    這篇文章主要介紹了WPF ProgressBar實(shí)現(xiàn)實(shí)時(shí)進(jìn)度效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-12-12
  • C#實(shí)現(xiàn)的文件批量重命名功能示例

    C#實(shí)現(xiàn)的文件批量重命名功能示例

    這篇文章主要介紹了C#實(shí)現(xiàn)的文件批量重命名功能,結(jié)合具體實(shí)例形式分析了C#針對(duì)文件的遍歷、屬性修改相關(guān)操作技巧,需要的朋友可以參考下
    2017-07-07
  • c#單例模式(Singleton)的6種實(shí)現(xiàn)

    c#單例模式(Singleton)的6種實(shí)現(xiàn)

    這篇文章主要介紹了c#單例模式(Singleton)的6種實(shí)現(xiàn) ,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2016-12-12
  • C#寫入對(duì)象或集合類型數(shù)據(jù)到xml文件的方法

    C#寫入對(duì)象或集合類型數(shù)據(jù)到xml文件的方法

    這篇文章主要介紹了C#寫入對(duì)象或集合類型數(shù)據(jù)到xml文件的方法,涉及C#針對(duì)XML文件的相關(guān)操作技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-07-07
  • C#操作XML文件實(shí)例匯總

    C#操作XML文件實(shí)例匯總

    這篇文章主要介紹了C#操作xml文件實(shí)例,包括了對(duì)XML文件節(jié)點(diǎn)的查找、遍歷、刪除、添加等。是C#程序設(shè)計(jì)中非常重要的技巧,需要的朋友可以參考下
    2014-08-08

最新評(píng)論

潜江市| 杭锦后旗| 武宣县| 济南市| 山东| 温州市| 上栗县| 乾安县| 天门市| 镇原县| 咸阳市| 汝州市| 兰州市| 宜兴市| 纳雍县| 手机| 松溪县| 遂溪县| 凤台县| 桂东县| 崇文区| 读书| 崇明县| 安丘市| 措勤县| 页游| 元江| 大安市| 通榆县| 饶河县| 新绛县| 石首市| 阜宁县| 松阳县| 崇文区| 得荣县| 安多县| 凤山县| 西林县| 隆昌县| 宁化县|