using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Threading; public partial class PriorityCounterThreadApp : Form { private int nThread = 0; public PriorityCounterThreadApp() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { PriorityCounterForm c = new PriorityCounterForm(nThread++); c.Text = "Low Priority Thread Counter"; c.Show(); Thread thread = new Thread(new ThreadStart(c.Count)); thread.Priority = ThreadPriority.Lowest; thread.Start(); } private void button2_Click(object sender, EventArgs e) { PriorityCounterForm c = new PriorityCounterForm(nThread++); c.Text = "High Priority Thread Counter"; c.Show(); Thread thread = new Thread(new ThreadStart(c.Count)); thread.Priority = ThreadPriority.Highest; thread.Start(); } }