1 / 13

Visual Basic 程式設計

Visual Basic 程式設計. 講師:戴志華 hana@arbor.ee.ntu.edu.tw 國立台灣大學電機工程研究所. 第十九章 多重文件介面 (MDI). User Interface. Single-Document Interface EX: 記事本 Multiple-Document Interface EX: Word, Excel, Access. My First MDI Program. Form1 和 Form2 的 MDIChild 屬性設定為 True. My First MDI Program (cont’d).

carl
Download Presentation

Visual Basic 程式設計

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Visual Basic 程式設計 講師:戴志華 hana@arbor.ee.ntu.edu.tw 國立台灣大學電機工程研究所

  2. 第十九章 多重文件介面(MDI)

  3. User Interface • Single-Document Interface EX: 記事本 • Multiple-Document Interface EX: Word, Excel, Access

  4. My First MDI Program Form1和Form2 的MDIChild屬性設定為True

  5. My First MDI Program (cont’d) • 在MDIForm1 內建立一MENU Caption name New mNew …Form1 mmf1 …Form2 mmf2

  6. My First MDI Program (cont’d) • Private Sub mmf1_Click() • Dim frm As New Form1 • frm.Show • End Sub • Private Sub mmf2_Click() • Dim frm As New Form2 • frm.Show • End Sub

  7. MDI- 事件 • MDIForm_Load • MDIForm_Unload • 利用unload me 觸發 • QueryUnload  Unload Terminate • QU(父)QU(子all)U(子all)U(父)

  8. MDI- QueryUnload • QueryUnload(cancel As Integer, unloadmode As Integer) • cancel : 將此參數設定為 0 以外的任何值,可在所有已載入的表單中停止 QueryUnload 事件,並阻止該表單和應用程式的關閉。 Unloadmode : 如傳回值中所說明的,指示出引起 QueryUnload 事件的原因。

  9. MDI- QueryUnload (cont’d) • vbFormControlMenu 0 使用者從表單上的控制功能表中選取「關閉」指令。 vbFormCode 1 Unload 陳述式被程式碼呼叫。 vbAppWindows 2 目前 Microsoft Windows 作業環境任務結束。 vbAppTaskManager 3 Microsoft Windows 工作管理員正在關閉應用程式。 vbFormMDIForm 4 因為 MDI 表單正在關閉的緣故,MDI 子表單正在關閉。

  10. MDI- QueryUnload (cont’d) • 在關閉一個應用程式之前,用來確認包含在該應用程式中的表單裏沒有任何未完成的工作。 • QueryUnload 事件是發生在所有表單中任何一個釋放前,而 Unload 是在每個單一表單釋放時發生。

  11. MDI- 屬性 • Me.ActiveForm • Me.ActiveControl • If Typeof ActiveControl Is TextBox then • …… • end if

  12. MDI- 方法 • Arrange arg • vbCascade 0 • vbTileHorizontal 1 • vbTileVertical 2 • vbArrangeIcons 3

  13. MDI • 試試 VB應用程式精靈

More Related