📄 fexplorer.class
字号:
' Gambas class filePRIVATE $sPath AS StringPRIVATE $bHidden AS BooleanPRIVATE $bCtrl AS BooleanSTATIC PUBLIC SUB Main() DIM hForm AS Form hForm = NEW FExplorer(System.Home) hForm.ShowENDPUBLIC SUB _new(sPath AS String) $sPath = sPath RefreshExplorerENDPRIVATE SUB RefreshExplorer() DIM sFile AS String DIM hPictDir AS Picture DIM hPictFile AS Picture DIM cDir AS NEW String[] DIM sName AS String INC Application.Busy ME.Title = Conv($sPath, System.Charset, Desktop.Charset) ivwExplorer.Clear hPictDir = Picture["folder.png"] hPictFile = Picture["file.png"] IF $sPath <> "/" THEN ivwExplorer.Add("D..", "..", hPictDir) FOR EACH sFile IN Dir($sPath) IF NOT $bHidden THEN IF Stat($sPath &/ sFile).Hidden THEN CONTINUE ENDIF ENDIF IF IsDir($sPath &/ sFile) THEN cDir.Add("D" & sFile) ELSE cDir.Add("F" & sFile) ENDIF NEXT cDir.Sort FOR EACH sFile IN cDir sName = Mid$(sFile, 2) IF Left$(sFile) = "D" THEN ivwExplorer.Add(sFile, sName, hPictDir) ELSE ivwExplorer.Add(sFile, sName, hPictFile) ENDIF ivwExplorer.Item.Editable = TRUE NEXT 'ivwExplorer.Sorted = FALSE 'ivwExplorer.Ascending = TRUE 'ivwExplorer.Sorted = TRUE FINALLY DEC Application.busy CATCH Message.Error(Error.Text) ENDPUBLIC SUB Form_Resize() ivwExplorer.Move(0, 0, ME.ClientW, ME.ClientH)ENDPUBLIC SUB mnuQuit_Click() ME.CloseENDPUBLIC SUB mnuViewRefresh_Click() RefreshExplorerENDPUBLIC SUB ivwExplorer_Activate() DIM sNewPath AS String DIM hForm AS Form IF LAST.Current.Key = "D.." THEN IF $sPath = "/" THEN RETURN sNewPath = File.Dir($sPath) ELSE sNewPath = $sPath &/ Mid$(LAST.Current.Key, 2) ENDIF IF IsDir(sNewPath) THEN IF $bCtrl THEN $bCtrl = FALSE hForm = NEW FExplorer(sNewPath) hForm.Move(ME.X + 16, ME.Y + 16, ME.W, ME.H) hForm.Show ELSE $sPath = sNewPath RefreshExplorer ENDIF ENDIFENDPRIVATE SUB ToggleViewHidden() $bHidden = NOT mnuViewHidden.Checked mnuViewHidden.Checked = $bHidden RefreshExplorer ENDPUBLIC SUB mnuViewHidden_Click() ToggleViewHiddenENDPUBLIC SUB mnuAbout_Click() Message("IconView example written by\nBenoît Minisini")ENDPUBLIC SUB ivwExplorer_Rename() Message("'" & Mid$(LAST.Item.Key, 2) & "' has been renamed to '" & LAST.Item.Text & "'")ENDPUBLIC SUB ivwExplorer_KeyPress() IF Key.Control THEN $bCtrl = TRUEENDPUBLIC SUB ivwExplorer_KeyRelease() IF Key.Control THEN $bCtrl = FALSEEND
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -