public void DibujarNodo(Graphics grafo, Font fuente, Brush Relleno, Brush RellenoFuente, Pen Lapiz, Brush encuentro, int i, int m, int max, int min) { Rectangle rect = new Rectangle((int)(CoordenadaX - Radio / 2), (int)(CoordenadaY - Radio / 2), Radio, Radio); if (max == info) { //MessageBox.Show("max=" + max + " info=" + info); grafo.FillEllipse(Brushes.Green, rect); } else if (min == info) { //MessageBox.Show("min=" + min + " info=" + info); grafo.FillEllipse(Brushes.Red, rect); } else if (i == info) { //MessageBox.Show("i=" + i + " info=" + info); grafo.FillEllipse(encuentro, rect); } else if (m != 0) { if (info % m == 0) { grafo.FillEllipse(Brushes.Red, rect); suma = suma + info; } else { grafo.FillEllipse(Relleno, rect); } } else { grafo.FillEllipse(Relleno, rect); } grafo.DrawEllipse(Lapiz, rect); StringFormat formato = new StringFormat(); formato.Alignment = StringAlignment.Center; formato.LineAlignment = StringAlignment.Center; grafo.DrawString(info.ToString(), fuente, RellenoFuente, CoordenadaX, CoordenadaY, formato); if (Izquierdo != null) { Izquierdo.DibujarNodo(grafo, fuente, Relleno, RellenoFuente, Lapiz, encuentro, i, m, max, min); } if (Derecho != null) { Derecho.DibujarNodo(grafo, fuente, Relleno, RellenoFuente, Lapiz, encuentro, i, m, max, min); } }
public void DibujarArbol(Graphics grafo, Font fuente, Brush Relleno, Brush RellenoFuente, Pen Lapiz, Brush encuentro, int i, int m, int max, int min) { int x = 400; int y = 75; if (Raiz == null) { return; } Raiz.PosicionNodo(ref x, y); Raiz.DibujarRamas(grafo, Lapiz); Raiz.DibujarNodo(grafo, fuente, Relleno, RellenoFuente, Lapiz, encuentro, i, m, max, min); }