建立新的 BackgroundWorker 例項
BackgroundWorker 通常用於執行任務,有時耗時,而不會阻止 UI 執行緒。
// BackgroundWorker is part of the ComponentModel namespace.
using System.ComponentModel;
namespace BGWorkerExample
{
public partial class ExampleForm : Form
{
// the following creates an instance of the BackgroundWorker named "bgWorker"
BackgroundWorker bgWorker = new BackgroundWorker();
public ExampleForm() { ...