Top Banner
Lập trình trên Windows với Microsoft® .NET
14
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: C# co ban 8

Lập trình trên Windows với Microsoft® .NET

Page 2: C# co ban 8

SDI Application

SDI (1)

New Document

An SDI application can have only one active window at a time

Page 3: C# co ban 8

MDI Application

MDI (2)

Inner Window (or)

Child Window

Outer Window (or)

Parent Window

Page 4: C# co ban 8

MDI Application

Designing an MDI application

IsMdiContainer = true

Page 5: C# co ban 8

MDI Application

Activating and Deactivating Windows

Deactivate child window

Active child window

Page 6: C# co ban 8

MDI Application

As in MDI form during design

As with the control at runtime

Page 7: C# co ban 8

Main Menu

Displays a menu at runtime

MainMenu can be created in two ways:

Using the MainMenu control, and menu designer at design time

Creating an instance of the MainMenu class at runtime

MainMenu myMainMenu = new MainMenu();

this.Menu = myMainMenu;

Page 8: C# co ban 8

Main Menu

PROPERTIES

EVENTS

Select PopupClick

TextShortCut

PerformSelect

Parent PerformClick

METHODS

IndexShowShortCut

MenuItems

Page 9: C# co ban 8

Context Menu

Các Context menu cho phép người dùng truy cập vào các lệnh thường dùng bằng cách click chuột phải

Các Context menu được tạo ra với help của ContextMenu control

Page 10: C# co ban 8

ToolBar

Th ng n m ngay bên d i thanh menuườ ằ ướ Các nút l nh trong ToolBar t ng đ ng v i các item trong menuệ ươ ươ ớ

Các tùy chọn xuất hiện khác:

• DropDownButton

• Separator

• ToggleButton

ToolBar control icon as in ToolBox

Page 11: C# co ban 8

Form Level & Control Level Validations

Kiểm tra dữ liệu trong tất cả các fields trên form

Enable và Disable các controls dựa trên dữ liệu người dùng nhập

KeyPressKeyDownKeyUp

Page 12: C# co ban 8

L iỗ Mô tả

Syntax Error X y ra khi nh p vào các dòng mã l nh b sai t khóa, thi u ả ậ ệ ị ừ ếd u ch m câu, sai tên bi nấ ấ ế

Run-time Error X y ra khi m t l nh th th c hi n m t hành đ ng không ả ộ ệ ử ự ệ ộ ộh p lợ ệ

Logic Error X y ra khi m t ng d ng th c thi không có l i cú pháp ả ộ ứ ụ ự ỗsyntax errors ho c run-time error nh ng k t qu không nh ặ ư ế ả ưmong mu nố

Các kiểu thông báo lỗi

Page 13: C# co ban 8

ErrorProvider Control

Properties Methods

BlinkRate GetError

BlinkStyle SetError

ContainerControl

Icon

ErrorProvider control có thể được dùng để hiển thị một error icon khi người dùng nhập vào giá trị không hợp lệ.

Page 14: C# co ban 8

Exception Handling

Exceptions có thể được quản lý với sự hỗ trợ của: