Bài giảng Lập trình môi trường Window: Chương 3 - Ngô Thanh Hùng
Số trang: 114
Loại file: pdf
Dung lượng: 1.38 MB
Lượt xem: 16
Lượt tải: 0
Xem trước 10 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Chương 3 Bao gồm nội dung về lập trình GUI; cấu trúc ứng dụng Window Form; các lớp cơ sở; menu, dialog cùng các ví dụ về câu lệnh và giao diện. Mời quý đọc giả xem chi tiết bài giảng.
Nội dung trích xuất từ tài liệu:
Bài giảng Lập trình môi trường Window: Chương 3 - Ngô Thanh Hùng Lập trình GUI 1CuuDuongThanCong.com https://fb.com/tailieudientucntt Lập trình GUI• User interface modeling• User interface architecture• User interface coding 2 CuuDuongThanCong.com https://fb.com/tailieudientucnttThe Control class hierarchy 3 CuuDuongThanCong.com https://fb.com/tailieudientucntt Windows Forms Application Structure• A Windows Forms application has three pieces – the application itself – forms in the application – controls on the form Application MyForm Label label1 ―Hell…‖ mainForm Button button1 ―OK‖ 4 CuuDuongThanCong.com https://fb.com/tailieudientucntt GUI Tree Structure GUI Internal structureForm Form containers ButtonPanel Button Panel Label Label 5 CuuDuongThanCong.com https://fb.com/tailieudientucnttCách tạo WinForm bằng Console Application 6 CuuDuongThanCong.com https://fb.com/tailieudientucntt• Project Add Reference 7 CuuDuongThanCong.com https://fb.com/tailieudientucntt Form• Một « form » là một cửa sổ màn hình - một đơn vị giao diện người dùng do Microsoft đưa ra kể từ Windows 1.0• Một ứng dụng Windows Forms (WinForms) phải có ít nhất một cửa sổ « main form » (cửa sổ chính• Form có thể chứa các component• Form có thể có các file resource 8 CuuDuongThanCong.com https://fb.com/tailieudientucntt Ví dụ 1class Program { static void Main(string[] args) { Form f = new Form(); Application.Run(f); } } 9 CuuDuongThanCong.com https://fb.com/tailieudientucntt Ví dụ 2class Program { static void Main(string[] args) { MessageBox.Show(Hello World); } } 10 CuuDuongThanCong.com https://fb.com/tailieudientucntt Application classExit Stops all running message loops and closes all windows in the application. Note that this may not force the application to exitRun Starts a standard message loop on the current thread. If a Form is given, also makes that form visible.DoEvents Processes any Windows messages currently in the message queue. 11 CuuDuongThanCong.com https://fb.com/tailieudientucntt Ví dụ 3public static void Main() { Form form1 = new Form(); Form form2 = new Form(); form1.Text = Form passed to Run(); form2.Text = Second form; form2.Show(); Application.Run(form1); MessageBox.Show(Application.Run() has returned control back to Main. Bye, bye!, TwoForms); } 12 CuuDuongThanCong.com https://fb.com/tailieudientucntt Ví dụ 3 13CuuDuongThanCong.com https://fb.com/tailieudientucntt Form PropertiesThuộc tính Kiểu Mô tảFormBorderStyle FormBorderStyle: Kiểu đường viền FixedDialog, Fixed3D…ControlBox ...
Nội dung trích xuất từ tài liệu:
Bài giảng Lập trình môi trường Window: Chương 3 - Ngô Thanh Hùng Lập trình GUI 1CuuDuongThanCong.com https://fb.com/tailieudientucntt Lập trình GUI• User interface modeling• User interface architecture• User interface coding 2 CuuDuongThanCong.com https://fb.com/tailieudientucnttThe Control class hierarchy 3 CuuDuongThanCong.com https://fb.com/tailieudientucntt Windows Forms Application Structure• A Windows Forms application has three pieces – the application itself – forms in the application – controls on the form Application MyForm Label label1 ―Hell…‖ mainForm Button button1 ―OK‖ 4 CuuDuongThanCong.com https://fb.com/tailieudientucntt GUI Tree Structure GUI Internal structureForm Form containers ButtonPanel Button Panel Label Label 5 CuuDuongThanCong.com https://fb.com/tailieudientucnttCách tạo WinForm bằng Console Application 6 CuuDuongThanCong.com https://fb.com/tailieudientucntt• Project Add Reference 7 CuuDuongThanCong.com https://fb.com/tailieudientucntt Form• Một « form » là một cửa sổ màn hình - một đơn vị giao diện người dùng do Microsoft đưa ra kể từ Windows 1.0• Một ứng dụng Windows Forms (WinForms) phải có ít nhất một cửa sổ « main form » (cửa sổ chính• Form có thể chứa các component• Form có thể có các file resource 8 CuuDuongThanCong.com https://fb.com/tailieudientucntt Ví dụ 1class Program { static void Main(string[] args) { Form f = new Form(); Application.Run(f); } } 9 CuuDuongThanCong.com https://fb.com/tailieudientucntt Ví dụ 2class Program { static void Main(string[] args) { MessageBox.Show(Hello World); } } 10 CuuDuongThanCong.com https://fb.com/tailieudientucntt Application classExit Stops all running message loops and closes all windows in the application. Note that this may not force the application to exitRun Starts a standard message loop on the current thread. If a Form is given, also makes that form visible.DoEvents Processes any Windows messages currently in the message queue. 11 CuuDuongThanCong.com https://fb.com/tailieudientucntt Ví dụ 3public static void Main() { Form form1 = new Form(); Form form2 = new Form(); form1.Text = Form passed to Run(); form2.Text = Second form; form2.Show(); Application.Run(form1); MessageBox.Show(Application.Run() has returned control back to Main. Bye, bye!, TwoForms); } 12 CuuDuongThanCong.com https://fb.com/tailieudientucntt Ví dụ 3 13CuuDuongThanCong.com https://fb.com/tailieudientucntt Form PropertiesThuộc tính Kiểu Mô tảFormBorderStyle FormBorderStyle: Kiểu đường viền FixedDialog, Fixed3D…ControlBox ...
Tìm kiếm theo từ khóa liên quan:
Công nghệ phần mềm Bài giảng kỹ thuật lập trình Lập trình môi trường Window Lập trình Windows Form Windows Form với C# lập trình GUITài liệu liên quan:
-
62 trang 404 3 0
-
Giáo trình Công nghệ phần mềm nâng cao: Phần 2
202 trang 230 0 0 -
Giáo trình Công nghệ phần mềm nâng cao: Phần 1
151 trang 198 0 0 -
Báo cáo chuyên đề Công nghệ phần mềm: Pattern searching
68 trang 191 0 0 -
Lecture Introduction to software engineering - Week 3: Project management
68 trang 189 0 0 -
Xây dựng mô hình và công cụ hỗ trợ sinh tác tử giao diện
13 trang 183 0 0 -
6 trang 176 0 0
-
Bài giảng Công nghệ phần mềm - Chương 2: Quy trình xây dựng phần mềm
36 trang 158 0 0 -
Bài giảng Lập trình Windows Form với C#: Chương 3 - Lê Thị Ngọc Hạnh
11 trang 152 0 0 -
Tìm hiểu về ngôn ngữ lập trình C: Phần 1 - Quách Tuấn Ngọc
211 trang 150 0 0