1
« en: Sábado 23 de Enero de 2010, 19:17 »
buenas tardes estoy haciendo un codigo en visual basic soy estudiante del 2 ano de electricidad en telecomunicaciones y estamos empezando con visual soyy muy principiante...
agradeceria mucho a quien pueda ayudarme !!
me han mandado hacer un programa que tenga un circulo de leds ( simulados con shapes )
y que posea un frame con tres opciones ( sentido horario, antihorario y titilar )
ya la mayyor parte la he hecho ahora no se como hacer para q los 12 shapes ( leds en mi caso) titilen cuando le de a la opcion del frame de titilar .. estoy usando tres clocks uno para el sentido horario otro parael sentido antihorario y otro para titilar aqui les dejo un poco el codigo que he realizado a ver sialguien me puede ayudarr ... gracias de antesmano
Dim a As Integer
Dim flag As Integer
Dim b As Integer
Private Sub Command1_Click()
Shape1.FillColor = vbGreen
Shape2.FillColor = vbGreen
Shape12.FillColor = vbGreen
Shape11.FillColor = vbGreen
End Sub
Private Sub Command2_Click()
Shape3.FillColor = vbRed
Shape7.FillColor = vbRed
Shape8.FillColor = vbRed
Shape9.FillColor = vbRed
Shape6.FillColor = vbRed
End Sub
Private Sub Command3_Click()
Shape5.FillColor = vbYellow
Shape4.FillColor = vbYellow
Shape10.FillColor = vbYellow
End Sub
Private Sub Form_Load()
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
End Sub
Private Sub Option1_Click()
Timer1.Enabled = True
a = 1
End Sub
Private Sub Option2_Click()
Timer2.Enabled = True
b = 1
End Sub
Private Sub Option3_Click()
Timer3.Enabled = False
flag = 1
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
Select Case a
Case 1
Shape1.FillColor = vbGreen
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 2
Shape3.FillColor = vbRed
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 3
Shape7.FillColor = vbRed
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 4
Shape8.FillColor = vbRed
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 5
Shape9.FillColor = vbRed
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 6
Shape6.FillColor = vbRed
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 7
Shape5.FillColor = vbYellow
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 8
Shape4.FillColor = vbYellow
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 9
Shape10.FillColor = vbYellow
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 10
Shape11.FillColor = vbGreen
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 11
Shape12.FillColor = vbGreen
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Case 12
Shape2.FillColor = vbGreen
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case Else
a = 0
End Select
a = a + 1
Timer1.Enabled = True
End Sub
Private Sub Timer2_Timer()
Timer2.Enabled = False
Select Case b
Case 1
Shape1.FillColor = vbGreen
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 2
Shape2.FillColor = vbGreen
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 3
Shape12.FillColor = vbGreen
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Case 4
Shape11.FillColor = vbGreen
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 5
Shape10.FillColor = vbYellow
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 6
Shape4.FillColor = vbYellow
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 7
Shape5.FillColor = vbYellow
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 8
Shape6.FillColor = vbRed
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 9
Shape9.FillColor = vbRed
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 10
Shape8.FillColor = vbRed
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 11
Shape7.FillColor = vbRed
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape3.FillColor = vbWhite
Shape3.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case 12
Shape3.FillColor = vbRed
Shape1.FillColor = vbWhite
Shape1.FillStyle = 0
Shape2.FillColor = vbWhite
Shape2.FillStyle = 0
Shape4.FillColor = vbWhite
Shape4.FillStyle = 0
Shape5.FillColor = vbWhite
Shape5.FillStyle = 0
Shape6.FillColor = vbWhite
Shape6.FillStyle = 0
Shape7.FillColor = vbWhite
Shape7.FillStyle = 0
Shape8.FillColor = vbWhite
Shape8.FillStyle = 0
Shape9.FillColor = vbWhite
Shape9.FillStyle = 0
Shape10.FillColor = vbWhite
Shape10.FillStyle = 0
Shape11.FillColor = vbWhite
Shape11.FillStyle = 0
Shape12.FillColor = vbWhite
Shape12.FillStyle = 0
Case Else
b = 0
End Select
b = b + 1
Timer2.Enabled = True
End Sub
Private Sub Timer3_Timer() |||*** es aqui donde quiero que me titilen los leds ****|||||||
Timer3.Enabled = False
If flag = 0 Then
Shape1.FillColor = vbGreen
flag = 1
Else
Shape1.FillColor = vbWhite
End If
Timer3.Enabled = True
End Sub