实现GIF图形快速显示
假设在VB5程序中有一个名为Form的窗体。以下代码先声明一个窗体级Picture型数组,在Form_Load过程中,用LoadPicture函数将GIF图形加载到Picture型数组,然后在需要显示动态GIF图形的过程中用PaintPicture实现。
Dim objPics(12) As Picture
Private Sub Form_Load()
Dim intI As Integer,strGifName As String
For intI=0 To 12
strGifName=″c:\xxqvbprogram\vbgif\″&intI&″.gif″
′注:变量strGifName存放图片的路径和名称
Set objPics(intI)=LoadPicture(strGifName)
Next intI
End Sub
Private Sub Form_Paint()
Dim intI As Integer,intJ As Integer,dblTemp As Double
For intJ=1 To 10
For intI=0 To 12
PaintPicture objPics(intI),0,0
Next intI
Next intJ
End Sub