private void button2_Click(object sender, EventArgs e) { //sdfmdskfmdslfmdskmfsdkfs graphForDraw = ReadInput(); button2.Visible = false; int Xmax, Ymax; pictureBox1.Dock = DockStyle.Left; //Xmax = ClientSize.Width; //Ymax = ClientSize.Height; Size size = pictureBox1.Size; Xmax = size.Width; Ymax = size.Height; //pictureBox1.Size = new Size(Xmax,Ymax); //graphForDraw.GenerateVertexsPosition(Xmax - 10, Ymax - 10); var viz = new Vizualization(Xmax, Ymax); areaDraw = new DrawWithSize(viz,30); areaDraw.Background(); //areaDraw.DrawGraph(graphForDraw); Point p1 = new Point(0,0); Point p2 = new Point(Xmax,Ymax); areaDraw.DrawLine(p1, p2); pictureBox1.Image = areaDraw.getPicture(); pictureBox1.Update(); button1.Visible = true; }