private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { //Open the browsed image and display it string OpenedFilePath = openFileDialog1.FileName; ImageMatrix = ImageOperations.OpenImage(OpenedFilePath); ImageOperations.DisplayImage(ImageMatrix, pictureBox1); } txtWidth.Text = ImageOperations.GetWidth(ImageMatrix).ToString(); txtHeight.Text = ImageOperations.GetHeight(ImageMatrix).ToString(); string K = TextBoxK.Text; k = System.Convert.ToInt32(K); long timeBefore = System.Environment.TickCount; Nodes = ImageOperations.FillGraph(ImageMatrix); NewEdges = ImageOperations.MST(ImageOperations.Globals.distinct, Nodes); long timeAfter = System.Environment.TickCount; ImageOperations.Globals.Time = timeAfter - timeBefore; MST_txt.Text = ImageOperations.Globals.sum.ToString(); //k = ImageOperations.NumOfClusters(NewEdges); Distinct_txt.Text = ImageOperations.Globals.distinct.ToString(); }