Multiple Document Interfaces

29 1.4K 4
Multiple Document Interfaces

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Multiple Document Interfaces

MDI (Multiple Document Interfaces) Click to edit Master subtitle style 2/28/10 Tổng quát • Phần lớn ứng dụng Windows rơi vào loại sau:    2/28/10 Single Document Interfaces (SDI) Explorer Interfaces Multiple Document Interfaces (MDI) Single Document Interface • • Mỗi tài liệu thể cửa sổ đơn Trong Windows tiêu biểu cho loại giao diện Notepad hay Wordpad 2/28/10 Cửa sổ SDI 2/28/10 Explorer Interface • • • Đây cửa sổ mà thông tin hiển thị theo hệ thống phân cấp Thông thường TreeView control dùng để hiển thị hệ thống phân cấp Thông tin chi tiết nút TreeView chọn hiển thị ListView control 2/28/10 Cửa sổ Explorer Interface 2/28/10 Khái niệm MDI • • Multiple Document Interface (MDI) đặc tả quản lý tài liệu Microsoft Windows Mô tả cấu trúc cửa sổ giao diện người dùng, cho phép người sử dụng làm việc với nhiều tài liệu ứng dụng đơn 2/28/10 Ví dụ • • Windows trì nhiều ứng dụng Windows hình đơn Một ứng dụng MDI trì nhiều cửa sổ tài liệu vùng client đơn 2/28/10 • Đặc tả MDI xuất từ Windows 2.0, ứng dụng MDI lúc khó viết cần nhiều cơng sức lập trình • Từ Windows 3.0 trở đi, nhiều chức mở rộng hỗ trợ đưa vào 2/28/10 Các thành phần MDI • Cửa sổ ứng dụng chương trình MDI theo kiểu cổ điển gồm có  Thanh tiêu đề  Một trình đơn  Một đường viền thay đổi kích thước  Một icon trình đơn hệ thống  Các nút minimize/maximize/close 2/28/10 MDI Separator bar and child windows 2/28/10 1515 Child windows list or more child windows enables the More Windows option ArrangeIcons 2/28/10 TileHorizontal Cascade TileVertical • • Trên NET, việc phân biệt cửa sổ bình thường cửa sổ MDI khơng thật rõ ràng Có thể biến đổi cửa sổ thành cửa sổ MDI Parent cách đặt this.IsMdiContainer = true; 2/28/10 • • Khi hiển thị MDI container, biểu mẫu trở thành màu xám Muốn thêm cửa sổ MDI Child, cần đặt thuộc tính MDI Parent biểu mẩu Child hàm Parent_Load() 2/28/10 private void Parent_Load (object sender, System.EventArgs e) { Child frmChild = new Child(); frmChild.MdiParent = this; frmChild.Show(); } 2/28/10 Minh hoạ MDI Form 2/28/10 Các thao tác thường dùng Thuộc tính/Hàm Mơ tả ActiveMdiChild IsMdiChild IsMdiContainer MdiChildren MdiParent Gets the MDI child window that is currently active Gets whether the form is an MDI child Gets whether the form is an MDI container form Gets the set of MDI children contained by this form as an array of Form object Gets or sets the MDI container for this form If set, then this form is an MDI child form MergedMenu Gets the MainMenu object representing the current merged menu for an MDI container form LayoutMdi Arranges the MDI children within this form using a given layout style 2/28/10 Thuộc tính/Hàm Mơ tả an MDI child form actived or closed MdiChildActivat Occurs when aplication Note thatisMDI children not with an MDI e receive the Actived and Deatived events MdiList Merges the MenuItem objects in a given menu with those contained by this menu Gets or sets whether this menu should be populated with a list of MDI child forms contained by the associated form MergeOrder Gets or sets the relative position of this menu item when it is merged with another menu MergeType Gets or sets how this menu should be merged with other menus The default is MergeType.Add MergeMenu 2/28/10 • • Trong project có nhiều MDI Parent Có thể chuyển đổi MDI Child từ MDI Parent sang MDI Parent khác cách thay đổi thuộc tính MdiParent 2/28/10 Sắp xếp MDI Child • • Để tạo danh sách MDI Child, cần thêm top-level menu item (thường mang tên Window), cho thuộc tính MdiList = true Bộ máy Windows.Forms tự động thêm item vào cuối submenu cho cửa sổ MDI Child 2/28/10 Người dùng chuyển từ cửa sổ sang cửa sổ khác cách sử dụng trình đơn 2/28/10 Sắp xếp theo kiểu Cascade Tile • • Nếu muốn xếp theo kiểu Cascade Tile, cần thêm chức vào trình đơn Mỗi MDI container hổ trợ hàm LayoutMdi(), hàm nhận giá trị từ Enumeration MdiLayout xếp tự động cửa sổ 2/28/10 • Đoạn chương trình xếp theo kiểu Cascade private void mnuCascade_Click ( Object sender, System.EventArgs e) { this.LayoutMdi (MdiLayout.Cascade) } • Đoạn chương trình xếp theo kiểu Tile Horizontal private void mnuTileH_Click ( Object sender , System.EventArgs e) { this.LayoutMdi (MdiLayout.TileHorizontal) } 2/28/10 • • Ngồi ra, tạo cách xếp riêng tùy theo ứng dụng Ví dụ, đoạn chương trình sau cho phép thu nhỏ lại tất cửa sổ mở private void mnuMinimizeAll_Click (Object sender, System.EventArgs e) { foreach (Form frm in this.MdiChildren) { frm.WindowState = FormWindowState.Minized; } } 2/28/10 Merge Menu Khi cần trộn menu Container với menu MDIChild hành Tự tìm hiểu 2/28/10 ... dụng Windows rơi vào loại sau:    2/28/10 Single Document Interfaces (SDI) Explorer Interfaces Multiple Document Interfaces (MDI) Single Document Interface • • Mỗi tài liệu thể cửa sổ đơn Trong... ngồi cửa sổ ứng dụng 2/28/10 loại MDI • • Document application Workspace application 2/28/10 MDI SDI Single Document Interface 2/28/10 MDI Multiple Document Interface Parent’s icons: minimize,... chọn hiển thị ListView control 2/28/10 Cửa sổ Explorer Interface 2/28/10 Khái niệm MDI • • Multiple Document Interface (MDI) đặc tả quản lý tài liệu Microsoft Windows Mô tả cấu trúc cửa sổ giao

Ngày đăng: 12/09/2012, 15:05

Hình ảnh liên quan

Windows trong một màn hình đơn. - Multiple Document Interfaces

indows.

trong một màn hình đơn Xem tại trang 8 của tài liệu.

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan