我设定一个label控件,一个data控件,一个image控件
由label1.caption得到到data控件连接到access数据库的某字段:为一图片地址;
可是为什么label1.caption与image所显示的图片步调不一致.image总是慢一个图片
不知道为什么,怎么解决?谢谢!Dim strTemp As StringPrivate Sub Form_Load()
strTemp = Label1.Caption
Image1.Picture = LoadPicture(strTemp)
End SubPrivate Sub Data1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
strTemp = Label.Caption
Image1.Picture = LoadPicture(strTemp)
End Sub

解决方案 »

  1.   

    没有慢,只是感觉慢了一张图可以这样写,供参考:Dim strTemp As String'窗体发生改变时,向Image1中加载图片,而不是加载窗体时加载
    Private Sub Form_Resize()
        strTemp = Label1.Caption
        Image1.Picture = LoadPicture(strTemp)
    End Sub'当数据发生改变时加载图片
    Private Sub Data1_Reposition()
        strTemp = Label1.Caption
        Image1.Picture = LoadPicture(strTemp)
    End Sub