-->

jueves, 28 de abril de 2011

AJERCICIOS EN CLASE CON LA VARIABLE CASE

PublicClassForm1


PrivateSub Button1_Click(ByVal sender AsSystem.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click
DimgraficoAsGraphics
DimlapizAsPen
grafico = CreateGraphics()
lapiz = NewPen(Color.Blue, 8)
grafico.DrawRectangle(lapiz, 10, 10, 110, 110)

EndSub
EndClass

























PublicClassForm1

PrivateSub Button1_Click(ByVal sender AsSystem.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click
DimfiguraAsString
DimgraficoAsGraphics
Dim lapiz1 AsPen
Dim lapiz2 AsPen
Dim lapiz3 AsPen
grafico = CreateGraphics()
        lapiz1 = NewPen(Color.Blue, 4)
        lapiz2 = NewPen(Color.Red, 3)
        lapiz3 = NewPen(Color.Green, 5)

If RadioButton1.Checked Then
figura = "circulo"

ElseIf RadioButton2.Checked Then
figura = "cuadrado"
Else
figura = "linea"
EndIf


SelectCasefigura
Case"circulo"
grafico.DrawEllipse(lapiz1, 10, 10, 100, 100)

Case"cuadrado"
grafico.DrawRectangle(lapiz2, 10, 10, 100, 100)


Case ("linea")
grafico.DrawLine(lapiz3, 10, 10, 100, 100)
EndSelect

EndSub
EndClass








No hay comentarios:

Publicar un comentario