用VB怎样为图片更名
来源:百度知道 编辑:UC知道 时间:2024/05/26 19:51:09
窗体上有drivelistbox,dirlistbox,filelistbox,textbox,Picturebox,试过了可行!
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = "c:\"
File1.Path = Dir1.Path
End Sub
Private Sub File1_Click()
On Error GoTo e
Text1.Text = File1.List(File1.ListIndex)
Text1.SetFocus
Text1.SelLength = Len(Text1.Text)
Picture1.Picture = LoadPicture(Dir1.Path & "\" & File1.List(File1.ListIndex))
e:
Select Case Err.Number
Case 481
Picture1.Cls
Picture1.Print "无效图片"
If File1.ListIndex < File1.ListCount Then File1.ListIndex = File1.ListIndex + 1
End Select
End Sub
Private Sub Form_Load()
Text1.Text = ""
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim OldName As String
If KeyCode = vbKeyReturn Then
OldName = Dir1.Path & "\"