C# 装载循环有问题
我想在进行一些处理时显示加载循环。 我现在正在使用MRG.Conrol。 Loading.cs文件包含MRG.Controls.UI.LoadingCircle 下面是示例应用程序。这里的问题是加载圆不是以圆周运动出现的C# 装载循环有问题,c#,C#,我想在进行一些处理时显示加载循环。 我现在正在使用MRG.Conrol。 Loading.cs文件包含MRG.Controls.UI.LoadingCircle 下面是示例应用程序。这里的问题是加载圆不是以圆周运动出现的 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; us
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LoadingCircle
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Loading loding = new Loading();
loding.SetText = "loading circle";
loding.Show(this); //this form contains MRG conrol in it.
loding.Refresh();
int i = 1;
// here i have some custom logic which takes 2 min to done.
// i cant make this logic in separate thread.
loding.Close();
}
}
}这可能是因为加载循环正在使用计时器(基于窗口消息)和
,而循环正在阻塞其线程。因此不会处理任何窗口消息。如果你把你的工作负载放在另一个线程(你的while循环)上,它会更新加载循环。你能详细解释一下为什么你不能在后台线程上进行长时间的操作吗?