Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hung-Hsiang WuWindows Processing Design1 Chapter 4 簡單視窗程式 表單與標籤的屬性 按鈕與編輯的屬性 設計簡單的應用程式 表單常用事件 一般鍵盤及滑鼠常見的事件 表單視窗間的呼叫 表單間資料傳送應用 專案選擇設定.

Similar presentations


Presentation on theme: "Hung-Hsiang WuWindows Processing Design1 Chapter 4 簡單視窗程式 表單與標籤的屬性 按鈕與編輯的屬性 設計簡單的應用程式 表單常用事件 一般鍵盤及滑鼠常見的事件 表單視窗間的呼叫 表單間資料傳送應用 專案選擇設定."— Presentation transcript:

1 Hung-Hsiang WuWindows Processing Design1 Chapter 4 簡單視窗程式 表單與標籤的屬性 按鈕與編輯的屬性 設計簡單的應用程式 表單常用事件 一般鍵盤及滑鼠常見的事件 表單視窗間的呼叫 表單間資料傳送應用 專案選擇設定

2 Hung-Hsiang WuWindows Processing Design2 表單與標籤的屬性 設定表單的屬性 Border Style Caption Color Font Window State

3 Hung-Hsiang WuWindows Processing Design3 表單與標籤的屬性 cont. 設定標籤的屬性 Alignment Caption

4 Hung-Hsiang WuWindows Processing Design4 按鈕與編輯的屬性 設定按鈕的屬性 Caption Visible Enabled true or false

5 Hung-Hsiang WuWindows Processing Design5 按鈕與編輯的屬性 cont. 設定編輯的屬性 Text Max Length

6 Hung-Hsiang WuWindows Processing Design6 設計簡單的應用程式 程式的目的分析 撰寫程式 (Coding) 程式測試 (Testing) 及除錯 (Debugging) 簡單的 Hello 程式 - 利用 VCL 建立輸出入畫面 - 設定 Form 上的屬性值 - 撰寫程式內容

7 Hung-Hsiang WuWindows Processing Design7 設計簡單的應用程式 cont. 開啟新專案 (Application) 拉 元件至 Form 上 更改 Label & Button 屬性 - Caption - Font 更改 Form 屬性 - Caption - 視窗大小

8 Hung-Hsiang WuWindows Processing Design8 設計簡單的應用程式 cont. 編輯 Button1 事件程式 - 對物件 Click 兩次 - 將輸入 Close(); 程式片斷 或者 Application->Terminate();

9 Hung-Hsiang WuWindows Processing Design9 設計簡單的應用程式 cont. 執行編輯完的程式 - 利用工具列的 執行 - 選用下拉表單 Run / Run - 快速鍵 F9

10 Hung-Hsiang WuWindows Processing Design10 設計簡單的應用程式 cont. 結束程式執行 - 使用自己設計的 Button - 按右上角的 X - 選取 Run/Program Reset [Ctrl+F2]

11 Hung-Hsiang WuWindows Processing Design11 設計簡單的應用程式 con. 程式存檔 - 存入 Form 的檔案 (.cpp.dfm.h) - 存入 Project 的檔案 (.cpp.bpr.res)

12 Hung-Hsiang WuWindows Processing Design12 表單常用事件 FormClick 事件 FormDblClick 事件 FormCreate 事件 FormActivate 事件 FormPaint 事件

13 Hung-Hsiang WuWindows Processing Design13 表單常用事件 cont. 練習: 兩個 Edit 、一個 Button 、一個 Label 。 將輸入的兩個值,相加之後顯示在 Label

14 Hung-Hsiang WuWindows Processing Design14 一般鍵盤及滑鼠常見的事件 OnKeyDown 、 OnKeyPress 、 OnKeyUp OnChange OnClick OnDblClick OnExit OnMouseDown OnMouseUp

15 Hung-Hsiang WuWindows Processing Design15 一般鍵盤及滑鼠常見的事件 cont. OnKeyDown 、 OnKeyPress 、 OnKeyUp KeyDown -> KeyPress -> KeyUp 利用字元的 ASCII 碼 KeyPress 收到由鍵盤按鍵的字元 KeyDown 測到鍵盤有鍵被按住 KeyUp 被按住的鍵已放開

16 Hung-Hsiang WuWindows Processing Design16 一般鍵盤及滑鼠常見的事件 cont. 虛擬碼 (virtual key codes) 利用鍵盤虛擬碼輸入,將移動物件的位置

17 Hung-Hsiang WuWindows Processing Design17 表單視窗間的呼叫 開啟兩個表單 (Form1 and Form2) Form1 加入一個 Button( 顯示 ) Form2->Show(); 或者 Form2->ShowModal(); Form1 加入 include “ Unit2.h ” [File]->[Include Unit Hdr] or [Alt]+[F11] Form 隱藏指令 Form1->Hide();

18 Hung-Hsiang WuWindows Processing Design18 表單間資料傳送應用 將變數宣告成表單類別中的物件 public: //User declarations int num; 利用 Form->num 來取得資料 練習:將兩表單之間資料傳送

19 Hung-Hsiang WuWindows Processing Design19 Forms Application 專案選擇設定


Download ppt "Hung-Hsiang WuWindows Processing Design1 Chapter 4 簡單視窗程式 表單與標籤的屬性 按鈕與編輯的屬性 設計簡單的應用程式 表單常用事件 一般鍵盤及滑鼠常見的事件 表單視窗間的呼叫 表單間資料傳送應用 專案選擇設定."

Similar presentations


Ads by Google