跳轉到內容

Gambas/Dialogue

來自華夏公益教科書,開放的書籍,開放的世界

返回 Gambas

標準對話方塊

[編輯 | 編輯原始碼]

它們讓你的編碼更容易。

在下面的例子中,你將使用標準對話方塊來選擇

  • 字型
  • 顏色
  • 檔名
  • 檔案路徑

你需要一個文字區域和三個命令按鈕,才能讓程式執行起來。

PUBLIC SUB Button1_Click()
 IF Dialog.SelectFont() THEN RETURN
 Textarea1.Font = Dialog.Font
END
PUBLIC SUB Button2_Click()
 IF Dialog.SelectColor() THEN RETURN
 Textarea1.Background = Dialog.Color
END
PUBLIC SUB Button3_Click()
Dialog.SaveFile() 
File.Save(Dialog.Path, TextArea1.Text)
CATCH 
IF ERROR THEN RETURN
END
Color  Filter  Font  Path  Title  

OpenFile  SaveFile  SelectColor  SelectDirectory  SelectFont
華夏公益教科書