private void JBtn_Click(object sender, EventArgs e) { DPanel.CreateGraphics().Clear(Color.White); Bitmap b = new Bitmap(DPanel.Width, DPanel.Height); if (BresenhamRadioButton.Checked) { if (EllipseRadioButton.Checked) { DPanel.CreateGraphics().DrawImage(GraphicsClass.Fill_Bresenham_Ellipse(b, Pens.Red, (int)X0Y0Value.Value, (int)X0Y0Value.Value, (int)WidthValue.Value, (int)HeightValue.Value), 0, 0); } else { DPanel.CreateGraphics().DrawImage(GraphicsClass.Fill_Bresenham_Pie(b, Pens.Red, (int)X0Y0Value.Value, (int)X0Y0Value.Value, (int)WidthValue.Value, (int)HeightValue.Value, (int)StartAngleValue.Value, (int)SweepAngleValue.Value), 0, 0); } } else { if (EllipseRadioButton.Checked) { DPanel.CreateGraphics().DrawImage(GraphicsClass.Fill_Wu_Ellipse(b, Pens.Red, (int)X0Y0Value.Value, (int)X0Y0Value.Value, (int)WidthValue.Value, (int)HeightValue.Value), 0, 0); } else { DPanel.CreateGraphics().DrawImage(GraphicsClass.Fill_Wu_Pie(b, Pens.Red, (int)X0Y0Value.Value, (int)X0Y0Value.Value, (int)WidthValue.Value, (int)HeightValue.Value, (int)StartAngleValue.Value, (int)SweepAngleValue.Value), 0, 0); } } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { if (OpenFD.ShowDialog() == DialogResult.OK) { TheGraph = Graph.FileToGraph(File.ReadAllLines(OpenFD.FileName)); TheGraph.GetColors(); DPanel.CreateGraphics().DrawImage(TheGraph.DrawGraph(DPanel.Width, DPanel.Height), new Point(0, 0)); } }
private void MagicClick(object sender, MouseEventArgs mouse) { if (AddVertRadio.Checked) { TheGraph.AddV(mouse.X, mouse.Y); DPanel.CreateGraphics().DrawImage(TheGraph.DrawGraph(DPanel.Width, DPanel.Height), new Point(0, 0)); } else if (AddEdgeRadio.Checked) { if (A == null) { A = TheGraph.OnClick(mouse.X, mouse.Y); if (A != null) { InfoLabel.Text = "Choose 2'nd vert"; } else { InfoLabel.Text = "..."; } } else if (B == null) { B = TheGraph.OnClick(mouse.X, mouse.Y); if (B != null) { TheGraph.AddE(A, B); DPanel.CreateGraphics().DrawImage(TheGraph.DrawGraph(DPanel.Width, DPanel.Height), new Point(0, 0)); InfoLabel.Text = "Operation complete"; } else { InfoLabel.Text = "..."; } A = B = null; } } else if (DelEdgeRadio.Checked) { if (A == null) { A = TheGraph.OnClick(mouse.X, mouse.Y); if (A != null) { InfoLabel.Text = "Choose 2'nd vert"; } else { InfoLabel.Text = "..."; } } else if (B == null) { B = TheGraph.OnClick(mouse.X, mouse.Y); if (B != null) { TheGraph.DelEdge(A, B); DPanel.CreateGraphics().DrawImage(TheGraph.DrawGraph(DPanel.Width, DPanel.Height), new Point(0, 0)); InfoLabel.Text = "Operation complete"; } else { InfoLabel.Text = "..."; } A = B = null; } } else if (DelVertRadio.Checked) { A = TheGraph.OnClick(mouse.X, mouse.Y); if (A != null) { TheGraph.DelVert(A); DPanel.CreateGraphics().DrawImage(TheGraph.DrawGraph(DPanel.Width, DPanel.Height), new Point(0, 0)); A = null; InfoLabel.Text = "Operation complete"; } else { InfoLabel.Text = "Wrong input"; } } else if (MoveModeRadio.Checked) { if (A == null) { A = TheGraph.OnClick(mouse.X, mouse.Y); if (A != null) { InfoLabel.Text = "Point new location"; } else { InfoLabel.Text = "Wrong input"; } } else if (A != null) { A.vpoint.X = mouse.X; A.vpoint.Y = mouse.Y; DPanel.CreateGraphics().DrawImage(TheGraph.DrawGraph(DPanel.Width, DPanel.Height), new Point(0, 0)); A = null; InfoLabel.Text = "Operation complete"; } } }
private void SolutionButton_Click(object sender, EventArgs e) { TheGraph.SetBrushes(); DPanel.CreateGraphics().DrawImage(TheGraph.DrawGraph(DPanel.Width, DPanel.Height), new Point(0, 0)); }
private void ClearButton_Click(object sender, EventArgs e) { TheGraph.VList = new List <Vert>(); DPanel.CreateGraphics().Clear(Color.White); }