这是在窗体上的两个存放图片的图框,问题是放进图片后,无法达到电脑上资源管理器那样的"缩略图"效果,哪位能出手修改一下?
Dim OpenFileName As String
Private Reg
Private Sub Command1_Click()
On Error Resume Next
CommonDialog1.DialogTitle = "打开文件"
CommonDialog1.Filter = "所有支持的格式" + _
"(*.bmp;*.jpg;*.gif;*.pcx;*.ico)|" + _
"*.bmp;*.jpg;*.gif;*.pcx;*.ico)"
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
If Err <> 32755 Then
OpenFileName = CommonDialog1.FileName
Picture1.Picture = LoadPicture(OpenFileName)
End If
End If
Command2.Visible = True '第一框的按钮
Command1.Visible = False
End Sub
Private Sub Command2_Click()
Call Reg.RegWrite("HKLM\SOFTWARE\PIC\Lj", OpenFileName, "REG_SZ")
Command2.Visible = False '第一框的按钮
Command1.Visible = True
End Sub
Private Sub Form_Load()
On Error Resume Next
Set Reg = New IWshShell_Class
If Reg.RegRead("HKLM\SOFTWARE\PIC\Lj") = "" Then
Exit Sub
End If
Picture1.Picture = LoadPicture(Reg.RegRead("HKLM\SOFTWARE\PIC\Lj"))
CommonDialog1.CancelError = True
On Error Resume Next
Set Reg = New IWshShell_Class
If Reg.RegRead("HKLM\SOFTWARE\PIC\Lj1") = "" Then
Exit Sub
End If
Picture2.Picture = LoadPicture(Reg.RegRead("HKLM\SOFTWARE\PIC1\Lj1"))
CommonDialog2.CancelError = True
End Sub
Private Sub Command3_Click()
On Error Resume Next
CommonDialog1.DialogTitle = "打开文件"
CommonDialog1.Filter = "所有支持的格式" + _
"(*.bmp;*.jpg;*.gif;*.pcx;*.ico)|" + _
"*.bmp;*.jpg;*.gif;*.pcx;*.ico)"
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
If Err <> 32755 Then
OpenFileName = CommonDialog1.FileName
Picture2.Picture = LoadPicture(OpenFileName)
End If
End If
Command4.Visible = True '第二框的按钮
Command3.Visible = False
End Sub
Private Sub Command4_Click()
Call Reg.RegWrite("HKLM\SOFTWARE\PIC1\Lj1", OpenFileName, "REG_SZ")
Command4.Visible = False '第二框的按钮
Command3.Visible = True
End Sub