7,765
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private Declare Function GetTickCount Lib "kernel32" () As Long
Dim r As Double
Const rad = 3.14 / 360
Private Sub Command1_Click()
Me.ScaleMode = 3
Picture1.Width = 500
Picture1.Height = 500
Picture1.FillStyle = 0
Picture1.ScaleMode = 3 '这两行是重点
Picture1.AutoRedraw = True
Timer1.Interval = 1
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Dim i As Integer
Dim j As Integer
Dim t As Long
t = GetTickCount
r = r + 10
For i = 1 To 100
For j = 1 To 100
' 画1万个圈圈,加了点动画免得觉得没动
Picture1.FillColor = RGB(128 * (Sin((Sqr(i ^ 2 + j ^ 2) + r) * rad * 10) + 1), 128 * (Sin((Sqr(i ^ 2 + j ^ 2) + r + 60) * rad * 10) + 1), 255)
Picture1.Circle (i * 5, j * 5), 2, vbBlack
Next
Next
Me.Caption = GetTickCount - t '在窗体标题栏显示单次渲染毫秒数,我这里显示在70毫秒以内 刚刚好在15帧左右
End Sub