Here we have two designs of Pac-Man, one is boy and the one with the pink bow is a girl, a red ghost and the pellets used in the video game using Visual Basic. Utilizing the DrawEllipse and FillEllipse, DrawPie and FillPie, DrawArc, 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
'Pacman #1
e.Graphics.FillPie(Brushes.Yellow, 20, 30, 80, 80, 45, 270) 'Color de pacman #1
e.Graphics.DrawPie(Pens.Black, 20, 30, 80, 80, 45, 270) 'Contorno de pacman #1
e.Graphics.FillEllipse(Brushes.Black, 40, 40, 20, 20) 'Color de ojo de pacman #1
e.Graphics.DrawEllipse(Pens.Black, 40, 40, 20, 20) 'Contorno de ojo de pacman #1
'Bolitas de pacman
e.Graphics.FillEllipse(Brushes.LightBlue, 100, 60, 30, 30) 'Color de bolita #1
e.Graphics.DrawEllipse(Pens.Black, 100, 60, 30, 30) 'Bolita #1
e.Graphics.FillEllipse(Brushes.LightBlue, 140, 60, 30, 30) 'Color de bolita #2
e.Graphics.DrawEllipse(Pens.Black, 140, 60, 30, 30) 'Bolita #2
e.Graphics.FillEllipse(Brushes.LightBlue, 180, 60, 30, 30) 'Color de bolita #3
e.Graphics.DrawEllipse(Pens.Black, 180, 60, 30, 30) 'Bolita #3
'Pacman #2
' Definir los puntos para el lazo (dos triángulos unidos)
Dim lazoIzquierdo() As Point = { 'Lazo Izquierdo
New Point(260, 30), ' Punto superior
New Point(230, 10), ' Esquina izquierda
New Point(240, 50) ' Esquina inferior
}
Dim lazoDerecho() As Point = { 'Lazo Derecho
New Point(290, 15), ' Punto superior
New Point(280, 60), ' Esquina derecha
New Point(265, 35) ' Esquina inferior
}
' Centro del lazo (óvalo)
Dim centroLazo As New Rectangle(250, 25, 20, 20)
' Dibujar los triángulos del lazo
e.Graphics.FillPolygon(Brushes.Pink, lazoIzquierdo) ' Lado izquierdo
e.Graphics.FillPolygon(Brushes.Pink, lazoDerecho) ' Lado derecho
e.Graphics.DrawPolygon(Pens.Black, lazoIzquierdo) ' Contorno izquierdo
e.Graphics.DrawPolygon(Pens.Black, lazoDerecho) ' Contorno derecho
' Dibujar el centro del lazo
e.Graphics.FillEllipse(Brushes.Pink, centroLazo)
e.Graphics.DrawEllipse(Pens.Black, centroLazo)
'Dibujo de pacman #2
e.Graphics.FillPie(Brushes.Yellow, 205, 30, 80, 80, 225, 270) 'Color de pacman #2
e.Graphics.DrawPie(Pens.Black, 205, 30, 80, 80, 225, 270) 'Contorno de pacman #2
e.Graphics.FillEllipse(Brushes.Black, 245, 40, 20, 20) 'Color de ojo de pacman #2
e.Graphics.DrawEllipse(Pens.Black, 245, 40, 20, 20) 'Contorno de ojo de pacman #2
'Fantasma Rojo
' Cuerpo del fantasma con rectángulo y ondas en la parte inferior
Dim cuerpoFantasma() As Point = {
New Point(330, 60), ' Esquina superior izquierda del rectángulo
New Point(410, 60), ' Esquina superior derecha del rectángulo
New Point(410, 120), ' Punto antes de la primera onda
New Point(395, 110), ' Primera onda
New Point(380, 120), ' Segunda onda
New Point(365, 110), ' Tercera onda
New Point(350, 120), ' Cuarta onda
New Point(335, 110), ' Última onda
New Point(330, 120) ' Cierra el polígono
}
' Dibujar el cuerpo del fantasma
e.Graphics.FillPolygon(Brushes.Red, cuerpoFantasma) ' Relleno del cuerpo del fantasma
e.Graphics.DrawPolygon(Pens.Black, cuerpoFantasma) ' Contorno del cuerpo del fantasma
'Dubujo de fantasma rojo
e.Graphics.FillPie(Brushes.Red, 330, 20, 80, 80, 0, -180) 'Color de fantasma rojo
e.Graphics.DrawPie(Pens.Red, 330, 20, 80, 80, 0, -180) 'Cabeza de fantasma rojo
e.Graphics.DrawArc(Pens.Black, 330, 20, 80, 80, 0, -180) 'Contorno de cabeza de fantasma rojo
e.Graphics.FillEllipse(Brushes.White, 340, 40, 25, 25) 'Color de ojo izquierdo
e.Graphics.DrawEllipse(Pens.Black, 340, 40, 25, 25) 'Contorno de ojo izquierdo
e.Graphics.FillEllipse(Brushes.Blue, 340, 42, 20, 20) 'Pupila de ojo izquierdo
e.Graphics.FillEllipse(Brushes.White, 375, 40, 25, 25) 'Color de ojo derecho
e.Graphics.DrawEllipse(Pens.Black, 375, 40, 25, 25) 'Contorno de ojo derecho
e.Graphics.FillEllipse(Brushes.Blue, 375, 42, 20, 20) 'Contorno de ojo derecho
End Sub
End Class
Here we have three different types of network topologies from, star topology, ring topology and bus topology. Which also has a Clear All button to clear all the boxes, all by using Visual Basic. Utilizing the ButtonClick, PictureBox, FillEllipse and DrawLine 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
' Configurar PictureBox para permitir dibujo manual
PictureBox1.Image = New Bitmap(PictureBox1.Width, PictureBox1.Height)
PictureBox2.Image = New Bitmap(PictureBox2.Width, PictureBox2.Height)
PictureBox3.Image = New Bitmap(PictureBox3.Width, PictureBox3.Height)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' Borrar dibujos en los PictureBox
PictureBox1.Image = New Bitmap(PictureBox1.Width, PictureBox1.Height)
PictureBox2.Image = New Bitmap(PictureBox2.Width, PictureBox2.Height)
PictureBox3.Image = New Bitmap(PictureBox3.Width, PictureBox3.Height)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
DibujarTopologiaEstrella(PictureBox1)
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
DibujarTopologiaAnillo(PictureBox2)
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
DibujarTopologiaBus(PictureBox3)
End Sub
Private Sub DibujarTopologiaEstrella(pb As PictureBox)
Dim g As Graphics = Graphics.FromImage(pb.Image)
Dim p As New Pen(Color.Black, 2)
Dim center As New Point(pb.Width / 2, pb.Height / 2)
Dim nodes As Point() = {
New Point(30, 30), New Point(pb.Width - 30, 30),
New Point(30, pb.Height - 30), New Point(pb.Width - 30, pb.Height - 30),
New Point(pb.Width / 2, pb.Height - 30)
}
For Each node In nodes
g.DrawLine(p, center, node)
g.FillEllipse(Brushes.Blue, node.X - 5, node.Y - 5, 10, 10)
Next
g.FillEllipse(Brushes.Red, center.X - 5, center.Y - 5, 10, 10)
pb.Refresh()
End Sub
Private Sub DibujarTopologiaAnillo(pb As PictureBox)
Dim g As Graphics = Graphics.FromImage(pb.Image)
Dim p As New Pen(Color.Black, 2)
Dim center As New Point(pb.Width / 2, pb.Height / 2)
Dim radius As Integer = Math.Min(pb.Width, pb.Height) / 3
Dim nodes As New List(Of Point)
For i As Integer = 0 To 5
Dim angle As Double = (i * 360 / 6) * Math.PI / 180
Dim x As Integer = center.X + CInt(radius * Math.Cos(angle))
Dim y As Integer = center.Y + CInt(radius * Math.Sin(angle))
nodes.Add(New Point(x, y))
Next
For i As Integer = 0 To nodes.Count - 1
g.DrawLine(p, nodes(i), nodes((i + 1) Mod nodes.Count))
g.FillEllipse(Brushes.Green, nodes(i).X - 5, nodes(i).Y - 5, 10, 10)
Next
pb.Refresh()
End Sub
Private Sub DibujarTopologiaBus(pb As PictureBox)
Dim g As Graphics = Graphics.FromImage(pb.Image)
Dim p As New Pen(Color.Black, 2)
Dim y As Integer = pb.Height / 2
g.DrawLine(p, 30, y, pb.Width - 30, y)
Dim nodes As Integer() = {50, 150, 250, 350, 450}
For Each x In nodes
g.FillEllipse(Brushes.Purple, x - 5, y - 5, 10, 10)
Next
pb.Refresh()
End Sub
End Class
Here we have a Pokeball made using Visual Basic. Utilizing the methods of FillEllipse and FillPie.
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
e.Graphics.FillEllipse(Brushes.Black, 25, 25, 120, 120) 'Contorno de pokeball
e.Graphics.FillPie(Brushes.Red, 35, 30, 100, 100, 0, -180) 'Parte superior roja de pokeball
e.Graphics.FillPie(Brushes.White, 35, 40, 100, 100, 0, 180) 'Parte inferior blanca
e.Graphics.FillEllipse(Brushes.Black, 65, 65, 40, 40) 'Circulo negro del centro de pokeball
e.Graphics.FillEllipse(Brushes.White, 73, 72, 25, 25) 'Circulo blanco del centro de pokeball
End Sub
End Class