protected override void OnMouseClick(MouseEventArgs e) { base.OnMouseClick(e); //Criar um lapis Pen blackPen = new Pen(Color.Red, 3); int x = e.X; int y = e.Y; TablePoints.addPoint(x, y); Rectangle rect = new Rectangle(x - 5, y - 5, 10, 10); g.DrawEllipse(blackPen, rect); g.DrawString((pointCount + 1).ToString(), new Font("Arial Black", 11), Brushes.Black, x + 3, y); g.DrawString("X: " + x.ToString(), new Font("Arial Black", 6), Brushes.Black, x - 20, y - 25); g.DrawString("Y: " + y.ToString(), new Font("Arial Black", 6), Brushes.Black, x - 20, y - 18); pointCount++; lbQtyCities.Text = pointCount.ToString(); lbDifficulty.Text = Fatorial((ulong)pointCount).ToString(); if (++count > 3) { btnPopulationGenerate.Enabled = true; } if (++count > 1) { btnClean.Enabled = true; } }
protected override void OnMouseClick(MouseEventArgs e) { base.OnMouseClick(e); // Criar um lápis Pen blackPen = new Pen(Color.Red, 3); int x = e.X; int y = e.Y; TablePoints.addPoint(x, y); Rectangle rect = new Rectangle(x - 5, y - 5, 10, 10); g.DrawEllipse(blackPen, rect); g.DrawString((pointCount + 1).ToString(), new Font("Arial Black", 11), Brushes.Black, x + 3, y); g.DrawString("X: " + x.ToString(), new Font("Arial Black", 6), Brushes.Black, x - 20, y - 25); g.DrawString("Y: " + y.ToString(), new Font("Arial Black", 6), Brushes.Black, x - 20, y - 18); pointCount++; lbQtdeCidades.Text = pointCount.ToString(); lbComplex.Text = Fatorial((ulong)pointCount).ToString(); if (++count >= 4) { btnCriarPop.Enabled = true; } if (++count >= 1) { btnLimpar.Enabled = true; } else { btnLimpar.Enabled = false; } Console.WriteLine(TablePoints.print()); }
private void Form1_MouseClick(object sender, MouseEventArgs e) { Pen blackPen = new Pen(Color.Red, 3); int x = e.X; int y = e.Y; TablePoints.addPoint(x, y); TablePoints.print(); Rectangle rect = new Rectangle(x - 5, y - 5, 10, 10); g.DrawEllipse(blackPen, rect); g.DrawString((pointCount + 1).ToString(), new Font("Arial Black", 11), Brushes.Black, x + 3, y); g.DrawString("X:" + x.ToString(), new Font("Arial Black", 6), Brushes.Black, x - 20, y - 25); g.DrawString("Y:" + y.ToString(), new Font("Arial Black", 6), Brushes.Black, x - 20, y - 15); pointCount++; lbQtdeCidades.Text = "Quantidade de cidade: " + pointCount.ToString(); lblComplex.Text = "Complexidade: " + Fatorial((ulong)pointCount).ToString(); btnCriarPop.Enabled = pointCount >= 3 ? true : false; btnLimpar.Enabled = pointCount >= 1 ? true : false; }