窗体布局:
控件:timer1 屬性设置:timer1.Interval=1
代码:
Dim k As Integer
Private Sub Timer1_Timer()
k = k + 20
Line (Me.Width / 2, Me.Height / 2)-(0, k), RGB(0, 0, Abs(255 - k / 24))
Line (Me.Width / 2, Me.Height / 2)-(k, 0), RGB(0, 0, Abs(255 - k / 24))
Line (Me.Width / 2, Me.Height / 2)-(k, 0), RGB(0, 0, Abs(255 - k / 24))
Line (Me.Width / 2, Me.Height / 2)-(Me.Width, k), RGB(0, 0, Abs(255 - k / 24))
Line (Me.Width / 2, Me.Height / 2)-(Me.Width, k), RGB(0, 0, Abs(255 - (Me.Height - k) / 24))
Line (Me.Width / 2, Me.Height / 2)-(k, Me.Height), RGB(0, 0, Abs(255 - k / 24))
Line (Me.Width / 2, Me.Height / 2)-(k, Me.Height), RGB(0, 0, Abs(255 - k / 24))
Line (Me.Width / 2, Me.Height / 2)-(0, k), RGB(0, 0, Abs(255 - (Me.Height - k) / 24))
If k > 12500 Then
Timer1.Enabled = False
end if
End Sub
博客给出了VB编程中窗体布局及代码示例。设置了timer1控件的Interval属性为1,通过代码利用timer控件循环执行,定义整数变量k,不断绘制线条并改变颜色,当k大于12500时停止timer控件。

被折叠的 条评论
为什么被折叠?



