?? frmmain.frm
字號:
End Sub
Private Sub imgSplitter2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
SizeControlsH picSplitter2.Top
picSplitter2.Visible = False
mbMoving = False
End Sub
Private Sub lvListView_AfterLabelEdit(Cancel As Integer, NewString As String)
If Trim(NewString) = "" Then
MsgBox "對不起,文件名稱不能為空。 ", vbCritical + vbOKOnly, "重命名錯誤..."
Cancel = -1 '取消重命名
Exit Sub
End If
If Trim(NewString) = Trim(OldName) Then Exit Sub '新文件名與舊文件名相同時
'變更文件名稱
Dim SHop As SHFILEOPSTRUCT
Dim strFile As String
strFile = ValidateDir(fPath$) & OldName
With SHop
.wFunc = FO_RENAME
.pFrom = strFile
.pTo = ValidateDir(fPath$) & NewString
.fFlags = FOF_NOCONFIRMATION
End With
Dim retVal As Long '執(zhí)行
retVal = SHFileOperation(SHop)
If retVal <> 0 Then '不能執(zhí)行時取消操作
Cancel = -1
End If
End Sub
Private Sub lvListView_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
lvListView.SortKey = ColumnHeader.Index - 1
lvListView.SortOrder = lvwAscending
lvListView.Sorted = True
End Sub
Private Sub lvListView_DblClick()
If lvListView.ListItems.Count > 0 Then
If lvListView.SelectedItem.Selected Then
OpenSelected
End If
End If
End Sub
Private Sub lvListView_ItemClick(ByVal Item As MSComctlLib.ListItem)
'檢測是否為同一項目
NewItem = Item.Text
If NewItem = OldItem Then Exit Sub
OldItem = NewItem
If Item.Text > "" Then
MenuEnabled (-1)
Else
MenuEnabled (0)
End If
fPath$ = ValidateDir(fPath$)
Dim picFile As String
picFile = fPath$ & Item.Text
SourceFile = picFile
'給出文件類型
Select Case VbGetFileType(Item.Text)
Case "圖片"
'處理圖片
PictureProccess (picFile)
Case "動畫"
GifProccess (picFile)
Case "文本"
txtProccess (picFile)
Case "聲音"
AudioProccess (picFile)
SourceFile = "" '不能啟動多媒體播放設(shè)備
Case "影視"
VideoProccess (picFile)
Case Else
If mnuEditCopy.Enabled = True Then '上次為圖片時
mnuEditCopy.Enabled = False '復(fù)制按鈕無效
MnuLookFor.Enabled = False '查看菜單無效
MnuPrintPicture.Enabled = False
'隱藏圖片菜單
tbToolBar.Buttons(Copy_Number).Enabled = False
tbToolBar.Buttons(Printer_Number).Enabled = False
sbStatusBar.Panels(3).Text = "未注冊版: V1.0"
End If
If MnuVideo.Visible Then '視頻菜單
MnuVideo.Visible = False
End If
End Select
sbStatusBar.Panels(4).Text = Item.Text
sbStatusBar.Panels(5).Text = Item.ListSubItems(1).Text
sbStatusBar.Panels(6).Text = Item.ListSubItems(2).Text
sbStatusBar.Panels(7).Text = Item.ListSubItems(3).Text
sbStatusBar.Panels(8).Text = Item.ListSubItems(4).Text
End Sub
Private Sub lvListView_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Shift = 1 Then
UndoK = True
mnuFileOpenAs.Visible = True
Else
UndoK = False
mnuFileOpenAs.Visible = False
End If
If lvListView.ListItems.Count > 0 Then
If lvListView.SelectedItem.Selected Then
MenuEnabled (-1)
Else
MenuEnabled (0)
End If
End If
If Button = 2 Then PopupMenu mnuMainView
End Sub
Private Sub mnuArrangeFileIcon_Click()
mnuArrangeFileIcon.Checked = Not mnuArrangeFileIcon.Checked
If mnuArrangeFileIcon.Checked = True Then
lvListView.Arrange = lvwAutoTop
SaveSetting App.Title, "Settings", "AutoArrange", 1
Else
lvListView.Arrange = lvwNone
SaveSetting App.Title, "Settings", "AutoArrange", 0
End If
'保存狀態(tài)
End Sub
Private Sub MnuArrangSort_Click(Index As Integer)
lvListView.SortKey = Index
lvListView.SortOrder = 0
lvListView.Sorted = True
End Sub
Private Sub MnuArrangSortAuto_Click()
lvListView.SortOrder = 0
lvListView.Sorted = True
End Sub
Private Sub MnuArrangSortAutoZ_Click()
lvListView.SortOrder = 1
lvListView.Sorted = True
End Sub
Private Sub MnuCleanBackground_Click()
ChangePaper picBuffer, False
End Sub
Private Sub MnuClearClipboard_Click()
Clipboard.Clear
End Sub
Private Sub mnuDisplayPictureViewWindow_Click()
Screen.MousePointer = vbHourglass
If Not frmPictureView.Visible Then
Load frmPictureView
End If
If picLoad Then
frmPictureView.picView.Picture = picBuffer.Picture
End If
Screen.MousePointer = vbDefault
frmPictureView.Show vbNormal
End Sub
Private Sub mnuEditCopyTo_Click()
TargetFile = SelectFilePath(Me.hWnd, "請選擇復(fù)制到的目錄:")
If Trim(TargetFile) = "" Then '如果等于空時退出
Exit Sub
End If
TargetFile = ValidateDir(TargetFile) & lvListView.SelectedItem.Text
SourceFile = ValidateDir(fPath$) & lvListView.SelectedItem.Text
If SourceFile = TargetFile Then
Exit Sub
End If
'系統(tǒng)內(nèi)Shell復(fù)制文件
Dim Result As Long, fileOp As SHFILEOPSTRUCT
With fileOp
.hWnd = Me.hWnd
.wFunc = FO_COPY
.pFrom = SourceFile
.pTo = TargetFile
.fFlags = FOF_SIMPLEPROGRESS + FOF_FILESONLY
End With
Result = SHFileOperation(fileOp)
End Sub
Private Sub mnuEditMove_Click()
TargetFile = SelectFilePath(Me.hWnd, "請選擇移動到的目錄:")
If Trim(TargetFile) = "" Then '如果等于空時退出
Exit Sub
End If
TargetFile = ValidateDir(TargetFile) & lvListView.SelectedItem.Text
SourceFile = ValidateDir(fPath$) & lvListView.SelectedItem.Text
If SourceFile = TargetFile Then
Exit Sub
End If
'使用Name命令移動文件
'Name SourceFile As TargetFile
'系統(tǒng)內(nèi)Shell移動文件
Dim Result As Long, fileOp As SHFILEOPSTRUCT
With fileOp
.hWnd = Me.hWnd
.wFunc = FO_MOVE
.pFrom = SourceFile
.pTo = TargetFile
.fFlags = FOF_SIMPLEPROGRESS + FOF_FILESONLY
End With
Result = SHFileOperation(fileOp)
'系統(tǒng)刪除操作完成時,測試有沒有刪除
Result = GetFileAttributes(SourceFile)
If Result = -1 Then '完成時
lvListView.ListItems.Remove lvListView.SelectedItem.Index
RefreshDesk
Else
Exit Sub '沒有時
End If
End Sub
Private Sub MnuFileAttribute_Click()
'顯示文件屬性
If lvListView.ListItems.Count > 0 Then
If lvListView.SelectedItem.Selected Then
ShowFileProperties ValidateDir(fPath$) & lvListView.SelectedItem.Text
End If
ElseIf Trim(DisplayPath.Text) > "" Then
ShowFileProperties Trim(DisplayPath.Text)
End If
End Sub
Private Sub mnuFileOpenAs_Click()
If lvListView.ListItems.Count > 0 Then
If lvListView.SelectedItem.Selected Then
OpenSelectedAs
End If
End If
End Sub
Private Sub mnuFileRename_Click()
'文件重命名
If lvListView.ListItems.Count > 0 Then
If lvListView.SelectedItem.Selected Then
OldName = lvListView.SelectedItem.Text '取得編輯前的文件名
lvListView.StartLabelEdit '開始編輯
End If
End If
End Sub
Private Sub MnuFullScreen_Click()
MnuFullScreen.Checked = Not MnuFullScreen.Checked
AudioDisplay.Pause
If MnuFullScreen.Checked = True Then
AudioDisplay.FullScreenMode = True
Else
AudioDisplay.FullScreenMode = False
End If
AudioDisplay.Run
End Sub
Private Sub MnuLookFor_Click()
If picLoad = False Then '但預(yù)覽窗口沒有裝載時
Dim picFile As String
picFile = fPath$ & lvListView.SelectedItem.Text
Screen.MousePointer = vbHourglass
picBuffer.Picture = LoadPicture(picFile)
Screen.MousePointer = vbDefault
picLoad = True '已經(jīng)安裝
End If
MnuPictureView_Click
End Sub
Private Sub MnuMediaPlay_Click()
If AudioDisplay.Visible Then
If AudioDisplay.CurrentState = amvRunning Then
If SourceFile <> "" Then
AudioDisplay.Stop
End If
End If
End If
Dim retVal As Long
retVal = Shell("FlVcd3.0.Exe " & SourceFile, vbNormalFocus)
If retVal = 0 Then
MsgBox "對不起,未知錯誤不能啟動多媒體播放器"
End If
End Sub
Private Sub MnuMemdiaPlay_Click()
If AudioDisplay.Visible Then
If AudioDisplay.CurrentState = amvRunning Then
If SourceFile <> "" Then
AudioDisplay.Stop
End If
End If
End If
Dim retVal As Long
retVal = Shell("FlVcd3.0.Exe " & SourceFile, vbNormalFocus)
If retVal = 0 Then
MsgBox "對不起,未知錯誤不能啟動多媒體播放器"
End If
End Sub
Private Sub MnuPictureView_Click()
Screen.MousePointer = vbHourglass
If frmPictureView.Visible Then
frmPictureView.picView.Picture = picBuffer.Picture
Else
Load frmPictureView
frmPictureView.picView.Picture = picBuffer.Picture
End If
Screen.MousePointer = vbDefault
frmPictureView.Show vbNormal
End Sub
Private Sub MnuPrinterSet_Click()
Dim setPrinter As New cCommonDialog
setPrinter.CancelError = True
setPrinter.flags = PD_PRINTSETUP
setPrinter.ShowPrinter
End Sub
Private Sub MnuPrintPicture_Click()
If picLoad = False Then
Dim picFile As String
picFile = fPath$ & lvListView.SelectedItem.Text
Screen.MousePointer = vbHourglass
picBuffer.Picture = LoadPicture(picFile)
Screen.MousePointer = vbDefault
picLoad = True '已經(jīng)安裝完畢
End If
'顯示打印選項
frmPicturePrint.Show 1
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -