當前位置:編程學習大全網 - 熱門推薦 - VB做壹個簡單的圖片瀏覽器,誰有代碼?

VB做壹個簡單的圖片瀏覽器,誰有代碼?

我只會做到下面的代碼了.其中:

Dir1-目錄列表控件

Drive1-驅動器列表控件

File1-文件列表控件

Image1-圖像控件

Text1-文本框控件

Option1-單選控件(Caption為"通過單擊瀏覽")

Option2-單選控件(Caption為"通過雙擊瀏覽")

Private Sub Dir1_Change()

File1.Path = Dir1.Path

End Sub

Private Sub Drive1_Change()

On Error GoTo DriErr

Dir1.Path = Drive1.Drive

Exit Sub

DriErr:

If Err.Number = 68 Then

If MsgBox("請問要重試還是取消?", vbRetryCancel + vbCritical, "硬盤不存在或光驅沒有插入磁盤!") = vbRetry Then

Resume 0

Else

Drive1.Drive = "C:"

Resume Next

End If

End If

End Sub

Private Sub File1_Click()

If Option2.Value = True Then Exit Sub

Dim picFile As String

If Right(Dir1.Path, 1) = "\" Then

picFile = Dir1.Path + File1.FileName

Else

picFile = Dir1.Path + "\" + File1.FileName

End If

Image1.Picture = LoadPicture(picFile)

Text1.Text = picFile

End Sub

Private Sub File1_DblClick()

If Option1.Value = True Then Exit Sub

Dim picFile As String

If Right(Dir1.Path, 1) = "\" Then

picFile = Dir1.Path + File1.FileName

Else

picFile = Dir1.Path + "\" + File1.FileName

End If

Image1.Picture = LoadPicture(picFile)

Text1.Text = picFile

End Sub

  • 上一篇:誰有photo shop 的地址啊
  • 下一篇:科學家發掘到美人魚化石,美人魚到底存不存在?
  • copyright 2024編程學習大全網