Danh mục

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    
tailieu_vip

Hỗ trợ phí lưu trữ khi tải xuống: 29,000 VND Tải xuống file đầy đủ (114 trang) 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 ...

Tài liệu được xem nhiều: