// Print Graph Setup. private void PrintGraph_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { String tempString = ""; if (ListBoxResults.SelectedItem.ToString().Contains("MST:")) { graphAlObj.PrintMSTSolutionTo(ref tempString, ListBoxResults.SelectedItem.ToString().Substring(5)); ListBoxResults.Items.Remove(ListBoxResults.SelectedItem); } else if (ListBoxResults.SelectedItem.ToString().Contains("Shortest Paths:")) { graphAlObj.PrintSSSPSolutionTo(ref tempString, ListBoxResults.SelectedItem.ToString().Substring(16)); ListBoxResults.Items.Remove(ListBoxResults.SelectedItem); } e.Graphics.DrawString(tempString, new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new PointF(130, 130)); }