c# co ban 8

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

Upload: baotuyet113

Post on 22-Jul-2015

483 views

Category:

Documents


0 download

TRANSCRIPT

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

SDI Application

SDI (1)

New Document

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

MDI Application

MDI (2)

Inner Window (or)

Child Window

Outer Window (or)

Parent Window

MDI Application

Designing an MDI application

IsMdiContainer = true

MDI Application

Activating and Deactivating Windows

Deactivate child window

Active child window

MDI Application

As in MDI form during design

As with the control at runtime

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;

Main Menu

PROPERTIES

EVENTS

Select PopupClick

TextShortCut

PerformSelect

Parent PerformClick

METHODS

IndexShowShortCut

MenuItems

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

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

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

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

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ệ.

Exception Handling

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