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(); } } }