using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SampleNotice
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
//方法二 解决多线程中,新创建的线程不能访问UI线程创建的窗口控件
//TextBox.CheckForIllegalCrossThreadCalls = false;
//Button.CheckForIllegalCrossThreadCalls = false;
}
private void Form1_Load(object sender, EventArgs e)
{
Thread t = new Thread(new ThreadStart(GetData));
t.IsBackground = true;
t.Start();
}
private void GetData()
{
var timer = new System.Timers.Timer();
C# Winform使用线程,委托定时更新界面UI控件,解决界面卡顿问题
最新推荐文章于 2024-06-21 14:53:53 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)