using System;
using System.Threading;
using System.Drawing;
using System.Windows.Forms;

public partial class PriorityCounterForm : Form
{
    private int count = 0;
    private int threadCount;
    
    public PriorityCounterForm(int tc)
    {
        InitializeComponent();
        threadCount = tc;
     }

    public void Count()
    {
        do
        {
            count++;
            countLabel.Text = "Count= " + count;
            if (threadCount == 0)
                BackColor = Color.Blue;
            else if (threadCount == 1)
                BackColor = Color.Yellow;
            else if (threadCount == 2)
                BackColor = Color.Red;
            else
                BackColor = Color.Green;
            Invalidate();
        } while (count<50000);
    }
}