Está en la página 1de 4

Public Class Form1

Dim num1, num2 As Integer


Dim figura As Graphics
Dim Pen As New Pen(Color.Black, 3)

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles


Button1.Click
figura = PictureBox1.CreateGraphics
If lado1.Text = "" Then

MessageBox.Show("ingrese un lado1", "advertencia", MessageBoxButtons.OK,


MessageBoxIcon.Information)

lado1.Focus()

Else
num1 = Convert.ToInt16(lado1.Text)
End If
If lado2.Text = "" Then

MessageBox.Show("ingrese un lado2", "advertencia", MessageBoxButtons.OK,


MessageBoxIcon.Information)

lado2.Focus()

Else
num2 = Convert.ToInt16(lado2.Text)
End If
If num1 = num2 Then
men.Text = "lados iguales es un cuadrado"
Else men.Text = "lados diferentes es un rectangulos"
End If
figura.DrawRectangle(Pen, 100, 100, num1, num2)

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles


Button2.Click

PictureBox1.Image = Nothing
lado1.Text = ""
lado2.Text = ""
men.Text = ""
End Sub

End Class

También podría gustarte