vb listbox与picturebox
怎么使得点击listbox里面的内容出现相应的图片,以书为例,就是点了书名后picturebox出现相应书的图片...
怎么使得点击listbox里面的内容出现相应的图片,以书为例,就是点了书名后picturebox出现相应书的图片
展开
1个回答
2014-07-03
展开全部
Dim pic() As StdPicture
Private Sub Form_Load()
ReDim pic(1)
List1.AddItem "书"
List1.AddItem "桌子"
Set pic(0) = LoadPicture("D:\图片文件夹\图片书文件名.bmp")
Set pic(1) = LoadPicture("D:\图片文件夹\图片桌子文件名.bmp")
End Sub
Private Sub List1_Click()
Picture1.Picture = pic(List1.ListIndex)
End Sub
Private Sub Form_Load()
ReDim pic(1)
List1.AddItem "书"
List1.AddItem "桌子"
Set pic(0) = LoadPicture("D:\图片文件夹\图片书文件名.bmp")
Set pic(1) = LoadPicture("D:\图片文件夹\图片桌子文件名.bmp")
End Sub
Private Sub List1_Click()
Picture1.Picture = pic(List1.ListIndex)
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询