0% encontró este documento útil (0 votos)
39 vistas3 páginas

Option Button

El documento presenta dos problemas relacionados con el uso de controles de opciones en Visual Basic para crear aplicaciones. El primer problema muestra operaciones matemáticas usando opciones de botón, y el segundo muestra figuras geométricas mediante la selección de opciones.
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como DOC, PDF, TXT o lee en línea desde Scribd
0% encontró este documento útil (0 votos)
39 vistas3 páginas

Option Button

El documento presenta dos problemas relacionados con el uso de controles de opciones en Visual Basic para crear aplicaciones. El primer problema muestra operaciones matemáticas usando opciones de botón, y el segundo muestra figuras geométricas mediante la selección de opciones.
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como DOC, PDF, TXT o lee en línea desde Scribd

Lenguaje de Programacin 1

OPTION BUTTON
Problema 1. Construir un modelo de solucin para hallar las operaciones matemticas compuestas
divisin entera (\), residuo (Mod), Potenciacin (^) y conatenacin (&) haciendo uso del
control OptionButton:

Tabla de Propiedades
Control Propiedad Valor Control Propiedad Valor
Form1 ControlBox False Option1 Caption Divisin Entera (\)
Form1 BorderStyle 4-FixedTollWindow Option1 Font Aria/negrita/10
Form1 Caption OPERACIONES Option1 BackColor &H00C0FFC0&
Form1 StartUpPosition 2-CenterScreen Option2 Caption Residuo (Mod )
Form1 BackColor &H00800000& Option2 Font Aria/negrita/10
Label1 Caption Nmero 1 Option2 BackColor &H00C0FFC0&
Label1 AutoSize True Option3 Caption Potenciacin (^)
Label1 BackStyle 0-transparent Option3 Font Aria/negrita/10
Label1 Font Arial/negrita/13 Option3 BackColor &H00C0FFC0&
Label1 ForeColor &H0000FF00& Option4 Caption Concatenacin (&&)
Label2 Caption Nmero 2 Option4 Font Aria/negrita/10
Label2 AutoSize True Option4 BackColor &H00C0FFC0&
Label2 BackStyle 0-transparent Command1 Caption &CALCULAR
Label2 Font Arial/negrita/13 Command1 BackColor &H0000FFFF&
Label2 ForeColor &H0000FF00& Command1 Style 1-Grafical
Label3 Caption Resultado Command2 Caption &LIMPIAR
Label3 AutoSize True Command2 BackColor &H0000FFFF&
Label3 BackStyle 0-transparent Command2 Style 1-Grafical
Label3 Font Arial/negrita/14 Command3 Caption &SALIR
Label3 ForeColor &H00FFFFFF& Command3 BackColor &H0000FFFF&
Frame1 Caption Operacin Command3 Style 1-Grafical
Frame1 BackColor &H00C0FFC0&

Programacin Private Sub Command3_Click()


End
Private Sub Command1_Click() End Sub
Dim a, b As Integer
a = Text1
b = Text2

If Option1.Value = True Then


Text3 = a \ b
End If

If Option2.Value = True Then


Text3 = a Mod b
End If

If Option3.Value = True Then


Text3 = a ^ b
End If

If Option4.Value = True Then


Text3 = (a & b)
End If
End Sub

Private Sub Command2_Click()


Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
Text1.SetFocus
End Sub
Problema 2. Realizar un Programa para mostrar las figures geomtricas en pantalla usando el
OptionButton.

Control Propiedad Valor Control Propiedad Valor


Form1 ControlBox False Option6 Caption TRAPECIO
Form1 BorderStyle 4-FixedTollWindow Option6 Font Aria/negrita/10
Form1 Caption FIGURAS GEOMTRICAS Image1 Imagen CIRCULO
Form1 StartUpPosition 2-CenterScreen Image1 Visible False
Form1 BackColor &H00800000& Image2 Imagen CUADRADO
Option1 Caption CIRCULO Image2 Visible False
Option1 Font Aria/negrita/10 Image3 Imagen TRIANGULO
Option2 Caption CUADRADO Image3 Visible False
Option2 Font Aria/negrita/10 Image4 Imagen PARALELOGRAMO
Option3 Caption TRIANGULO Image4 Visible False
Option3 Font Aria/negrita/10 Image5 Imagen ROMBO
Option4 Caption PARALELOGRAMO Image5 Visible False
Option4 Font Aria/negrita/10 Image6 Imagen TRAPECIO
Option5 Caption ROMBO Image6 Visible False
Option5 Font Aria/negrita/10 Command1 Caption &SALIR

PROGRAMACIN

Private Sub Command2_Click()


End Private Sub Option5_Click()
End Sub If Option5.Value = True Then
Picture1.Visible = False
Private Sub Option1_Click() Picture2.Visible = False
If Option1.Value = True Then Picture3.Visible = False
Picture1.Visible = True Picture4.Visible = False
Picture2.Visible = False Picture5.Visible = True
Picture3.Visible = False Picture6.Visible = False
Picture4.Visible = False End If
Picture5.Visible = False End Sub
Picture6.Visible = False
End If Private Sub Option6_Click()
End Sub If Option6.Value = True Then
Picture1.Visible = False
Private Sub Option2_Click() Picture2.Visible = False
If Option2.Value = True Then Picture3.Visible = False
Picture1.Visible = False Picture4.Visible = False
Picture2.Visible = True Picture5.Visible = False
Picture3.Visible = False Picture6.Visible = True
Picture4.Visible = False End If
Picture5.Visible = False End Sub
Picture6.Visible = False
End If
End Sub

Private Sub Option3_Click()


If Option3.Value = True Then
Picture1.Visible = False
Picture2.Visible = False
Picture3.Visible = True
Picture4.Visible = False
Picture5.Visible = False
Picture6.Visible = False
End If
End Sub

Private Sub Option4_Click()


If Option4.Value = True Then
Picture1.Visible = False
Picture2.Visible = False
Picture3.Visible = False
Picture4.Visible = True
Picture5.Visible = False
Picture6.Visible = False
End If
End Sub
Ejemplo 1
Hacer una aplicacin con la barra HScrollBarr que haga un juego de colores

Programacin

Private Sub Command1_Click()


End
End Sub

Private Sub colores()


Text1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
End Sub

Private Sub HScroll1_Change()


HScroll1_Scroll
End Sub

Private Sub HScroll1_Scroll()


colores
End Sub

Private Sub HScroll2_Change()


HScroll2_Scroll
End Sub

Private Sub HScroll2_Scroll()


colores
End Sub

Private Sub HScroll3_Change()


HScroll3_Scroll
End Sub

Private Sub HScroll3_Scroll()


colores
End Sub

También podría gustarte