Dim lub1 As Boolean
Private Sub Command1_Click()
  Dim wjm As String
  CommonDialog1.Action = 1
  wjm = CommonDialog1.FileName
  If lub1 Then
     Image1.Picture = LoadPicture(wjm)
  End If
  lub1 = Not lub1
End Sub
Private Sub Command2_Click()
 End
End Sub
Private Sub Form_Load()
 lub1 = True
End Sub假如运行时IMAGE1显示的图象是A.BMP,然后点击加载图象B.bmp,在加载新的图象B.bmp后.单击保存,在下次进入运行时就显示的是B.bmp了,,
   有劳各位高手帮忙!!!!

解决方案 »

  1.   

    Dim lub1 As BooleanPrivate Sub Command1_Click()
      Dim wjm As String
      CommonDialog1.Action = 1
      wjm = CommonDialog1.FileName
      If lub1 Then
         Image1.Picture = LoadPicture(wjm)
      End If
      lub1 = Not lub1
      
    End Sub
    Private Sub Command2_Click()
     End
    End Sub
    Private Sub CmdSave_Click()
           SavePicture Image1.Picture, App.Path & "\temp.bmp"
    End Sub
    Private Sub Form_Load()
    Image1.Picture = LoadPicture(App.Path & "\temp.bmp")
     lub1 = True
    End Sub
      

  2.   

    用savesting把图片路径保存在注册表中SaveSetting "coolbinzi","test","pic","c:\b.bmp"程序启动时用GetSetting读出pathstr=GetSetting("coolbinzi","test","pic")
      

  3.   

    Private Sub Command1_Click()   '保存图片
           SavePicture Image1.Picture, App.Path & "\p1.bmp"
    End Sub
      

  4.   

    这样对有多个窗体的话就不行拉,假如在一个窗体里加载一个新的图片,在执行Form_Load后,
    每个窗体都会跟着加载同一个图片了,