level 9
主程序控件使用
Public Class Form1
Public WithEvents cube1 As New Cube()
Public WithEvents cube2 As New Cube()
Public WithEvents cube3 As New Cube()
Public WithEvents cube4 As New Cube()
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
Me.Controls.Add(cube1)
Me.Controls.Add(cube2)
Me.Controls.Add(cube3)
Me.Controls.Add(cube4)
cube2.Location = New Point(cube1.Location.X + cube1.Width, 0)
cube3.Location = New Point(cube1.Location.X, cube1.Height)
cube4.Location = New Point(cube1.Location.X + cube1.Width, cube1.Height)
cube1.mytext = "傻"
cube2.mytext = "比"
cube3.mytext = "微"
cube4.mytext = "软"
Timer1.Enabled = True
End Sub
Private Sub Form1_Click(sender As Object, e As EventArgs) Handles Me.Click
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Try
cube1.angleY = cube1.angleY + 25
cube1.angleZ = cube1.angleZ + 2
cube2.angleY = cube2.angleY + 2
cube2.angleZ = cube2.angleZ + 25
cube3.angleZ = cube3.angleZ - 25
cube3.angleY = cube3.angleY + 25
cube4.angleZ = cube4.angleZ + 25
cube4.angleY = cube4.angleY - 25
cube1.draw(New Point(55, 55), 50)
cube2.draw(New Point(55, 55), 50)
cube3.draw(New Point(55, 55), 50)
cube4.draw(New Point(55, 55), 50)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Sub myclick() Handles cube1.myclick, cube2.myclick, cube3.myclick, cube4.myclick
If Timer1.Enabled = True Then
Timer1.Enabled = False
Else
Timer1.Enabled = True
End If
End Sub
End Class
2015年09月27日 15点09分


