Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
C# ПІДРУЧНИКИ / c# / Manning - Windows.forms.programming.with.c#.pdf
Скачиваний:
108
Добавлен:
12.02.2016
Размер:
14.98 Mб
Скачать
Compo-

the framework includes new support for Windows application development, web site access and deployment, remote program communication, database interaction, security, local and remote installation, and other technologies as well.

My goal is not to enumerate all of the technologies to be found in .NET, nor try to convince you of its advantages or disadvantages. There are a number books and articles that provide this information, and you would probably not be reading this introduction if you were not aware of at least some of them. My point is only to indicate that Microsoft has taken a fresh approach to its many technologies and products, and endeavored to integrate these various initiatives under a single offering called the

.NET Framework.

WINDOWS FORMS OVERVIEW

As we mentioned in the About this book section, all objects in the .NET Framework, and indeed in C# itself, are organized into namespaces. Appendix B provides an overview of the more commonly-used namespaces defined by the .NET Framework.

This book focuses on the System.Windows.Forms namespace used to build Windows-based applications. This section provides a summary of the classes defined by this namespace. A graphical index of the Windows Forms 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 applications. The

nent class encapsulates this notion, and is the basis for most of the members of the Windows Forms 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 Windows Forms namespace whenever a group of objects is required. The Container class encapsulates the container concept, with the IContainer interface defining the members required by all containers.

A control is a component with a visual aspect. In the Windows Forms namespace, a control is a component that presents a graphical interface on the Windows desktop. The Windows Forms Control class, discussed in chapter 4, is the basis for all Windows Forms controls. It is worth noting that the System.Web.UI namespace defines a Control class as well to represent graphical objects that appear on web pages.

Generally speaking, any visual interface you see on the Windows desktop is a control, and any behind-the-scenes object is a component. For example, a status bar panel

xxx

ABOUT .NET

is represented by the StatusBarPanel class, which is a component. The actual status bar you see in an interface is represented 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 is introduced in chapter 1 and discussed throughout the book, most notably in chapter 7, “Drawing and scrolling,” chapter 8, “Dialog boxes,” and chapter 16, “Multiple document interfaces.”

Most visual elements of graphical interfaces such as 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 9, “Basic controls,” chapter 10, “List controls,” 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 assortment,” and chapter 18, “Odds and ends .NET.” Of specific importance is the concept of data binding, covered in chapter 17.

A book on creating Windows Forms programs would be remiss if it did not also discuss the creation of reusable libraries. Chapter 5 discusses this concept by building a photo album library that is then reused throughout the remainder of the book. In particular, chapter 6, “Common dialogs,” makes use of this library.

WINDOWS FORMS OVERVIEW

xxxi

Соседние файлы в папке c#