Here we have the Puerto Rico flag using Visual Basic. Utilizing DrawRectangle and FillRectangle, DrawPolygon and FillPolygon methods.
REMINDER: NOT ALL MEASUREMENTS ARE EXACT WITH THE SKETCH
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
'Bandera de Puerto Rico
e.Graphics.FillRectangle(Brushes.Red, 20, 20, 300, 40) 'Color de franja roja superior
e.Graphics.DrawRectangle(Pens.Black, 20, 20, 300, 40) 'Contorno de franja roja superior
e.Graphics.FillRectangle(Brushes.Red, 20, 100, 300, 40) 'Color de franja roja del medio
e.Graphics.DrawRectangle(Pens.Black, 20, 100, 300, 40) 'Contorno de franja roja del medio
e.Graphics.FillRectangle(Brushes.Red, 20, 180, 300, 40) 'Contorno de franja roja inferior
e.Graphics.DrawRectangle(Pens.Black, 20, 180, 300, 40) 'Contorno de franja roja inferior
' Definir el triángulo azul en el lado izquierdo de la bandera
Dim trianguloAzul() As Point = {
New Point(20, 20), ' Esquina superior izquierda
New Point(20, 220), ' Esquina inferior izquierda
New Point(170, 120) ' Punto medio derecho del triángulo (centro de la bandera)
}
' Dibujar el triángulo azul
e.Graphics.FillPolygon(Brushes.Blue, trianguloAzul) ' Color de triangulo azul
e.Graphics.DrawPolygon(Pens.Black, trianguloAzul) ' Contorno de triangulo
' Factor de escala en la estrella
Dim scaleFactor As Single = 1
' Desplazamiento
Dim offsetX As Integer = -14 ' Mueve la estrella al eje de x
Dim offsetY As Integer = 14 ' Mueve la estrella al eje de y
' Puntos originales de la estrella
Dim estrellaOriginal() As Point = {
New Point(90, 60), ' Punta superior
New Point(103, 90), ' Punto derecho arriba
New Point(135, 90), ' Extremo derecho
New Point(110, 110), ' Punto derecho abajo
New Point(120, 140), ' Extremo inferior derecho
New Point(90, 120), ' Centro inferior
New Point(60, 140), ' Extremo inferior izquierdo
New Point(70, 110), ' Punto izquierdo abajo
New Point(45, 90), ' Extremo izquierdo
New Point(77, 90) ' Punto izquierdo arriba
}
'Crear una nueva lista de puntos movidos
Dim estrellaMovida(estrellaOriginal.Length - 1) As Point
For i As Integer = 0 To estrellaOriginal.Length - 1
Dim x As Integer = estrellaOriginal(i).X + offsetX
Dim y As Integer = estrellaOriginal(i).Y + offsetY
estrellaMovida(i) = New Point(x, y)
Next
'Dibujar la estrella
e.Graphics.FillPolygon(Brushes.White, estrellaMovida) 'Color de la estrella blanca
e.Graphics.DrawPolygon(Pens.Black, estrellaMovida) ' Contorno de la estrella
e.Graphics.DrawRectangle(Pens.Black, 20, 20, 300, 200) 'Contorno de bandera
End Sub
End Class
Here we have the Italy Flag using Visual Basic. Utilizing the DrawRectangle and FillRectangle methods.
REMINDER: NOT ALL MEASUREMENTS ARE EXACT WITH THE SKETCH
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Form1_PaddingChanged(sender As Object, e As EventArgs) Handles Me.PaddingChanged
End Sub
Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
'Bandera de Italia
e.Graphics.DrawRectangle(Pens.Black, 20, 20, 300, 200) 'Contorno de bandera
e.Graphics.FillRectangle(Brushes.Green, 20, 20, 100, 200) 'Color de franja izquierda
e.Graphics.DrawRectangle(Pens.Black, 20, 20, 100, 200) 'Contorno de franja izquierda
e.Graphics.FillRectangle(Brushes.Red, 220, 20, 100, 200) 'Color de franja derecha
e.Graphics.DrawRectangle(Pens.Black, 220, 20, 100, 200) 'Contorno de franja derecha
End Sub
End Class