FMain:
' gambas class file
Private circulo As Mancha
Public Sub Form_Open()
Me.Center
SliderBox1.MaxValue = 1000
SliderBox1.MinValue = 1
SliderBox1.Value = 500
End
Public Sub Button1_Click()
Timer1.Start
End
Public Sub Timer1_Timer()
circulo = New Mancha(DrawingArea1)
Print Timer1.Delay
End
Public Sub Button2_Click()
Timer1.Stop
End
Public Sub Button3_Click()
DrawingArea1.Clear
End
Public Sub SliderBox1_Change()
Timer1.Delay = SliderBox1.Value
End
Private circulo As Mancha
Public Sub Form_Open()
Me.Center
SliderBox1.MaxValue = 1000
SliderBox1.MinValue = 1
SliderBox1.Value = 500
End
Public Sub Button1_Click()
Timer1.Start
End
Public Sub Timer1_Timer()
circulo = New Mancha(DrawingArea1)
Print Timer1.Delay
End
Public Sub Button2_Click()
Timer1.Stop
End
Public Sub Button3_Click()
DrawingArea1.Clear
End
Public Sub SliderBox1_Change()
Timer1.Delay = SliderBox1.Value
End
Clase Mancha:
' gambas class file
Property pantalla As DrawingArea
Private $pantalla As DrawingArea
Public Sub _new(device As DrawingArea)
$pantalla = device
Crear()
End
Private Function pantalla_Read() As DrawingArea
Return $pantalla
End
Private Sub pantalla_Write(Value As DrawingArea)
$pantalla = Value
End
Public Sub Crear()
Dim x, y, radio, pintura As Integer
Dim EsteColor As Integer
pintura = Rand(1, 5)
Select Case pintura
Case 1
EsteColor = Color.Red
Case 2
EsteColor = Color.Black
Case 3
EsteColor = Color.Blue
Case 4
EsteColor = Color.Green
Case 5
End Select
x = Rand(1, $pantalla.Width)
y = Rand(1, $pantalla.Height)
radio = Rand(1, 50)
' Print "X=" & x & ",Y=" & y & ",Radio=" & radio
Paint.Begin($pantalla)
Paint.LineWidth = 1
Paint.Background = EsteColor
Paint.Arc(x, y, radio)
Paint.Stroke
Paint.End
End
Property pantalla As DrawingArea
Private $pantalla As DrawingArea
Public Sub _new(device As DrawingArea)
$pantalla = device
Crear()
End
Private Function pantalla_Read() As DrawingArea
Return $pantalla
End
Private Sub pantalla_Write(Value As DrawingArea)
$pantalla = Value
End
Public Sub Crear()
Dim x, y, radio, pintura As Integer
Dim EsteColor As Integer
pintura = Rand(1, 5)
Select Case pintura
Case 1
EsteColor = Color.Red
Case 2
EsteColor = Color.Black
Case 3
EsteColor = Color.Blue
Case 4
EsteColor = Color.Green
Case 5
End Select
x = Rand(1, $pantalla.Width)
y = Rand(1, $pantalla.Height)
radio = Rand(1, 50)
' Print "X=" & x & ",Y=" & y & ",Radio=" & radio
Paint.Begin($pantalla)
Paint.LineWidth = 1
Paint.Background = EsteColor
Paint.Arc(x, y, radio)
Paint.Stroke
Paint.End
End
Código fuente: virus-0.0.1.tar.gz
Interesante, gracias por el aporte.
ResponderBorrar