Volver al Inicio Microsoft Student Tech Club: Universidad Libre

Polígono en Visual C# .NET 2008

Este es el resultado


El código es el siguiente

Este es el código que debe ir en el evento Paint

 //Necesario para los gráficos GDI+
Graphics objGrafico = e.Graphics;

//Una serie de puntos
Point[] objPuntos = new Point[8];
objPuntos[0] = new Point(50, 30);
objPuntos[1] = new Point(90, 10);
objPuntos[2] = new Point(120, 40);
objPuntos[3] = new Point(190, 90);
objPuntos[4] = new Point(150, 130);
objPuntos[5] = new Point(100, 170);
objPuntos[6] = new Point(60, 200);
objPuntos[7] = new Point(30, 240);

//Lápiz para el color de la línea y con un ancho de 2
Pen objLapiz = new Pen(Color.BlueViolet, 2);

// Dibuja un polígono con el arreglo unidimensional de puntos
objGrafico.DrawPolygon(objLapiz, objPuntos);

 

Volver al Inicio Célula Microsoft. Universidad Libre