Components

754 196 0
Components

Đ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

Components The Component class represents an object that is marshaled by reference and can exist within a container. This figure shows the complete set of Windows Forms classes derived from the System.ComponentModel.Component class. The CommonDialog class represents a component that provides a standard interface for common functionality required by Windows Forms applications. This figure shows the com- plete set of Windows Forms classes derived from the System.Windows.Forms.Common- Dialog class. Common dialogs Windows Forms Programming with C# E RIK B ROWN MANNING Greenwich (74° w. long.) For online information and ordering of this and other Manning books, go to www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact: Special Sales Department Manning Publications Co. 209 Bruce Park Avenue Fax: (203) 661-9018 Greenwich, CT 06830 email: orders@manning.com ©2002 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Manning Publications Co. Copyeditor: Lois Patterson 209 Bruce Park Avenue Typesetter: Syd Brown Greenwich, CT 06830 Cover designer: Leslie Haimes ISBN 1930110-28-6 Printed in the United States of America 12345678910–VHG–0605040302 In memory of Thelma Rose Wilson, and for her beautiful daughter whom I love vii brief contents Part 1 Hello Windows Forms 1 1 Getting started with Windows Forms 3 2 Getting started with Visual Studio .NET 34 Part 2 Basic Windows Forms 67 3 Menus 69 4 Status bars 102 5 Reusable libraries 126 6 Common file dialogs 161 7 Drawing and scrolling 194 8 Dialog boxes 224 9 Basic controls 263 10 List controls 314 11 More controls 353 12 A .NET assortment 383 13 Toolbars and tips 410 Part 3 Advanced Windows Forms 437 14 List views 439 15 Tree views 485 16 Multiple document interfaces 525 17 Data binding 564 18 Odds and ends .NET 603 ix contents brief contents vii contents ix preface xix about this book xxi acknowledgments xxviii about .NET xxx about the cover illustration xxxiv Part 1 Hello Windows Forms 1 1 Getting started with Windows Forms 3 1.1 Programming in C# 4 Namespaces and classes 6 ✦ Constructors and methods 8 ✦ C# types 9 ✦ The entry point 11 The Application class 11 ✦ Program execution 13 1.2 Adding controls 13 Shortcuts and fully qualified names 15 Fields and properties 16 ✦ The Controls property 18 1.3 Loading files 18 Events 20 ✦ The OpenFileDialog class 22 Bitmap images 24 1.4 Resizing forms 26 Desktop layout properties 28 ✦ The Anchor property 29 ✦ The Dock property 31 1.5 Recap 33 [...]... namespace Also of note is the IComponent interface, which defines the members supported by all components We discuss interfaces in chapter 5, and the Component class in chapter 3 A container is an object that can hold zero or more components A container is simply a grouping mechanism, and ensures that sets of components are encapsulated and manipulated in similar ways Containers are used throughout the... by the StatusBar class, which is a control Status bars are the subject of chapter 4 Controls may also be containers in that they may contain a set of controls or components The StatusBar class is a container for zero or more StatusBarPanel components One of the more important container controls is the Form class, which represents an application window for display on the Windows desktop The Form class... classes in the Windows Forms namespace This part continues the development of our MyPhotos application, shown in figure 2 as it appears in chapter 13 As you can see, part 2 covers the core user interface components required to build Windows Forms applications, including menus, status bars, dialog windows, text boxes, and combo boxes xx ABOUT THIS BOOK The MyPhotos application will display the contents... namespace in given in appendix C Before we discuss specific classes, there are three terms that are critical to understanding the NET Framework in general and the Windows Forms namespace specifically, namely components, containers, and controls The book covers these terms in detail, so this section will provide only a brief introduction and a few examples A component is an object that permits sharing between... buttons, text boxes, trees, and dialog boxes are all represented by control classes The one exception is menus, which are the subject of chapter 3 and revisited again in chapter 16 Menu objects are all components, and are treated in a special manner by the Form class itself The controls in the Windows Forms namespace are discussed throughout the book Many of the more common controls appear in chapter... 11, “More controls,” and chapter 13, “Tool bars and tips.” Advanced controls such as list views, tree views, and data grids are covered in part 3 of the book In addition to the controls, containers, and components found in the Windows Forms namespace, there are a number of other objects provided to support the development of Windows-based applications Some of these are presented in chapter 12, “A NET . Components The Component class represents an object that is marshaled by reference

Ngày đăng: 23/10/2013, 20:15

Từ khóa liên quan

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

Tài liệu liên quan