sub声明 帮忙解释下这段代码的意思,Sub xiex(startX As Single,endX As Single,_startY As Single,endY As Single,Xstep As String,_ystep As Single,picX As Single,picY As Single)Picture1.ClsDim XX As SingleXX = startY + ystepFor i = startX To endX Step XstepXX = XX - ystepBitBlt Picture1.hdc,i,XX,Picture1.Width,Picture1.Height,_Hmemdc,picX,picY,vbSrcCopydelay 0.01Next iDeleteObject OldDcDeleteObject HmemdcEnd Sub
sub声明 帮忙解释下这段代码的意思,
Sub xiex(startX As Single,endX As Single,_
startY As Single,endY As Single,Xstep As String,_
ystep As Single,picX As Single,picY As Single)
Picture1.Cls
Dim XX As Single
XX = startY + ystep
For i = startX To endX Step Xstep
XX = XX - ystep
BitBlt Picture1.hdc,i,XX,Picture1.Width,Picture1.Height,_
Hmemdc,picX,picY,vbSrcCopy
delay 0.01
Next i
DeleteObject OldDc
DeleteObject Hmemdc
End Sub
BitBlt Picture1.hdc,i,XX,Picture1.Width,Picture1.Height,_
Hmemdc,picX,picY,vbSrcCopy
这句应该加括号吧?
BitBlt (Picture1.hdc,i,XX,Picture1.Width,Picture1.Height,_
Hmemdc,picX,picY,vbSrcCopy)
意思是把 Hmemdc中左上角坐标为(picX,picY)的,宽度、高度分别为Picture1.Width,Picture1.Height的图片保存到Picture1.hdc的左上角坐标为(i,XX)的位置上 .
i和XX每0.01秒变化一次,沿斜线移动,这样图像也就每0.01秒沿斜线运动一下了.运动轨迹从(startX,startY)到(endX,endY).