展开全部
图片放在PictureBox控件中的:
Private Sub Form_Load()
Randomize
Picture1.Move (Me.ScaleWidth - Picture1.Width) * Rnd, (Me.ScaleHeight - Picture1.Height) * Rnd
End Sub
图片放在Image控件中的:
Private Sub Form_Load()
Randomize
Image1.Move (Me.ScaleWidth - Image1.Width) * Rnd, (Me.ScaleHeight - Image1.Height) * Rnd
End Sub
不用控件,直接调用图片文件的:
Private Sub Form_Load()
Dim tp As StdPicture
Randomize
Me.AutoRedraw = True
Set tp = LoadPicture("e:\tmp\cd1.gif")
Me.PaintPicture tp, (Me.ScaleWidth - tp.Width) * Rnd, (Me.ScaleHeight - tp.Height) * Rnd
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询