怎么让VB的图片显示框显示图片?
2个回答
展开全部
假定春夏秋冬四个按钮分别是Command1、Command2、Command3、Command4,四个图片框分别是Picture1、Picture2、Picture3、Picture4
Private Sub Command1_Click()
Picture1.Picture = LoadPicture("春的图片路径放在这")
End Sub
Private Sub Command2_Click()
Picture2.Picture = LoadPicture("夏的图片路径放在这")
End Sub
Private Sub Command3_Click()
Picture3.Picture = LoadPicture("秋的图片路径放在这")
End Sub
Private Sub Command4_Click()
Picture4.Picture = LoadPicture("冬的图片路径放在这")
End Sub
如果按钮和图片框弄成控件数组则程序会更简单(四个图片的文件名要改为1.jpg、2.jpg、3.jpg、4.jpg):
Private Sub Command1_Click(Index As Integer)
Picture1(Index).Picture = LoadPicture(App.Path & "\" & Index + 1 & ".jpg")
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询