سوالات خود را در قسمت ارتباط با من مرقوم بفرمائید

مطلب در مورد Thread ها

using System.Threading;
namespace WindowsFormsApplication7
{
public partial class Form1 : Form
{
long x = 1, y = 2;
Thread t1, t2;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Control.CheckForIllegalCrossThreadCalls = false;
t1 = new Thread(new ThreadStart(test1));
t2 = new Thread(new ThreadStart(test2));
t1.Start();
t2.Start();
}
public void test1()
{
while (x < 10000)
{
x++;
textBox1.Text = x.ToString();
}
}
public void test2()
{
while (y < 10000)
{
y += 2;
textBox2.Text = y.ToString();
}
}
~Form1()
{
t1.Abort();
t2.Abort();
}
}
}

سلام استاد اگر میشه می خواستم لطف کنید و جواب این سوال را برام ایمیل کنید،(برنامه ای که ماتریس همجواری یک گراف را از ورودی دریافت و آن گراف را در صفحه چاپ نماید)بینهایت ممنون و سپاسگذارم.

namespace WindowsFormsApplication8
{
public partial class Form1 : Form
{
int[][] GM; //Graph Matrix
TextBox[][] Mat;
int t;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
t=int.Parse(textBox1.Text);
GM=new int[t][];
for (int i = 0; i < t; i++) GM[i] = new int[t];
Mat=new TextBox [t][];
for (int r = 0; r < t; r++)
{
Mat[r] = new TextBox[t];
for (int c = 0; c < t; c++)
{
Mat[r][c] = new TextBox();
Mat[r][c].Width = 20;
Mat[r][c].Top = r * 25;
Mat[r][c].Left = c * 25;
Mat[r][c].Parent = this;
Mat[r][c].Text = "0";
}
}
button2.Enabled = true;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if(textBox1.Text!="")
if (int.Parse(textBox1.Text) > 0) button1.Enabled = true;
}

private void button2_Click(object sender, EventArgs e)
{
for (int r = 0; r < t; r++)
for (int c = 0; c < t; c++)
{
GM[r][c] = int.Parse(Mat[r][c].Text);
//Mat[r][c].Dispose();
}
Graphics G = this.CreateGraphics();
G.Clear(Color.Cyan);
for (int i = 0; i < t; i++)
{
G.DrawEllipse(new Pen(Color.Blue), (i % 2) * 100 + 350, (i / 2) * 50 + 50, 20, 20);
G.DrawString(i.ToString(),new Font("Arial",10),Brushes.Red ,(i % 2) * 100 + 355, (i / 2) * 50 + 55);
for (int r = 0; r < t; r++)
for (int c = 0; c < t; c++)
{
int x1, y1, x2, y2;
x1 = (r % 2) * 100 + 360; y1 = (r / 2) * 50 + 60;
x2 = (c % 2) * 100 + 360; y2 = (c / 2) * 50 + 60;
if (GM[r][c] == 1) G.DrawLine(Pens.Black,x1,y1,x2,y2);
}
G.FillEllipse(Brushes.Azure /* .DrawEllipse(new Pen(Color.Blue)*/, (i % 2) * 100 + 350, (i / 2) * 50 + 50, 20, 20);
G.DrawString(i.ToString(), new Font("Arial", 10), Brushes.Red, (i % 2) * 100 + 355, (i / 2) * 50 + 55);
}

}
}
}