IQC
lu
2024-10-29 c48b95645f819e1908effbb40d8690347dc9159d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using DevExpress.Xpo.Logger;
using DevExpress.XtraEditors;
using DevExpress.XtraRichEdit.Import.Html;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
 
namespace Gs.DevApp.UserControl
{
    public partial class UcLoading : DevExpress.XtraEditors.XtraForm
    {
        private Timer timer;
        private int angle = 0;
 
        public UcLoading()
        {
            InitializeComponent();
            this.DoubleBuffered = true;
            timer = new Timer();
            timer.Interval = 1000 / 60; // 60帧/秒
            timer.Tick += Timer_Tick;
 
            progressShow.Properties.Minimum = 0;
            progressShow.Properties.Maximum = 100;
            progressShow.Properties.Step = 1;
 
            Show();
            Start();
        }
 
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            DrawLoadingCircle(e.Graphics);
        }
 
        private void DrawLoadingCircle(Graphics g)
        {
 
            lblCaption.Text = "友情提示:";
            lblMessage.Text = "请稍候,努力加载中......";
            lblContent.Text = "已加载 " + progressShow.EditValue.ToString() + "/100";
            
            progressShow.PerformStep();
            if (int.Parse(progressShow.EditValue.ToString()) > 95)
                progressShow.EditValue = 1;
        }
 
        private void Timer_Tick(object sender, EventArgs e)
        {
            angle = (angle + 30) % 360;
            this.Invalidate();
        }
 
        public void Start()
        {
            timer.Start();
        }
 
        public void Stop()
        {
            timer.Stop();
            this.Close();
        }
    }
}