⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fnewicon.class

📁 Gambas is a graphical development environment based on a Basic interpreter, like Visual Basic. It us
💻 CLASS
字号:
' Gambas class fileSTATIC PUBLIC Name AS StringSTATIC PUBLIC Template AS StringSTATIC PUBLIC SizeW AS IntegerSTATIC PUBLIC SizeH AS IntegerSTATIC PUBLIC DestDir AS StringPRIVATE selExisting AS FSupSelectorPRIVATE selDest AS FSupSelectorSTATIC PUBLIC FUNCTION Run(sDestDir AS String) AS Boolean  DestDir = sDestDir  RETURN NOT FNewIcon.ShowModal()ENDPUBLIC SUB _new()  'ME.Title = "New " & $sType  'txtFile.Text = Name  txtFile.SetFocus  tabAdd.Index = 0  selDest = NEW FSupSelector(tabAdd)  WITH selDest    .DialogType = FSupSelector.SHOW_DIRECTORY    .Root = File.Dir(Project.Path)    .ShowRootTab = FALSE    .ShowHomeTab = FALSE    .ShowProjectTab = TRUE    .DoNotShowCustomTabs = TRUE    .Path = If(DestDir, DestDir, selDest.Root)    .Init()    .Move(lblDest.X, lblDest.Y, lblDest.W, lblDest.H)  END WITHENDPUBLIC SUB btnOK_Click()  DIM sPath AS String  DIM hPict AS Image  IF tabAdd.Index = 0 THEN    Name = Trim(txtFile.Text)    Template = ""    SizeW = txtWidth.Value    SizeH = txtHeight.Value    IF Project.CheckFileName(Name, DestDir) THEN      txtFile.SetFocus      RETURN    ENDIF    IF UCase(Right$(Name, Len(cmbFormat.Text) + 1)) = "." & cmbFormat.Text THEN      Name = Left$(Name, -(Len(cmbFormat.Text) + 1))    ENDIF    Name = Name & "." & Lower$(cmbFormat.Text)    IF NOT selDest.Validate() THEN RETURN    DestDir = selDest.Path    sPath = DestDir &/ Name    hPict = NEW Image    hPict.Resize(SizeW, SizeH)    hPict.Fill(Color.Transparent)    hPict.Save(sPath)  ELSE    IF NOT selDest.Validate() THEN RETURN    DestDir = selDest.Path    IF NOT selExisting.Validate() THEN RETURN    'Message (selExisting.Path)    sPath = selExisting.Path    Template = sPath    Name = File.Name(sPath)  ENDIF  ME.Close(TRUE)CATCH  Message.Error(Error.Text)ENDPUBLIC SUB btnCancel_Click()  ME.CloseENDPUBLIC SUB btnSize_Click()  DIM cSize AS String[]  cSize = Split(LAST.Tag)  txtWidth.Value = Val(cSize[0])  txtHeight.Value = Val(cSize[1])ENDPUBLIC SUB tabAdd_Click()  IF tabAdd.Index = 1 THEN    IF selExisting THEN RETURN    selExisting = NEW FSupSelector(tabAdd)    selExisting.Hide    selExisting.DialogType = FSupSelector.SHOW_IMAGE    'selExisting.Root = "/"    selExisting.ShowHomeTab = TRUE    selExisting.ShowRootTab = TRUE    selExisting.ShowProjectTab = TRUE    SelExisting.PreviewImg = TRUE    selExisting.Key = "/ExistingImage"    selExisting.Filters = ("Picture files") & "|*.png,*.jpg,*.jpeg,*.xpm,*.gif,*.svg|" & ("All files") & "|*"    selExisting.Init()    selExisting.Move(8, 8, tabAdd.ClientW - 16, tabAdd.ClientH - 16)    selExisting.Show  ENDIFEND

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -