Datasheet

Creating Windows Forms
Although C# and .NET are particularly suited to Web development, they still offer splendid support for
so-called fat-client or thick-client apps, applications that have to be installed on the end user’s machine
where most of the processing takes place. This support is from Windows Forms.
A Windows Form is the .NET answer to a Visual Basic 6 Form. To design a graphical window interface,
you just drag controls from a toolbox onto a Windows Form. To determine the window’s behavior, you
write event-handling routines for the form’s controls. A Windows Form project compiles to an executable
that must be installed alongside the .NET runtime on the end user’s computer. Like other .NET project
types, Windows Form projects are supported by both Visual Basic 2005 and C#. Chapter 28, “Windows
Forms,” examines Windows Forms more closely.
Using the Windows Presentation Foundation (WPF)
One of the newest technologies to hit the block is the Windows Presentation Foundation (WPF). WPF
makes use of XAML in building applications. XAML stands for Extensible Application Markup Language.
This new way of creating applications within a Microsoft environment is something that was introduced
in 2006 and is part of the .NET Framework 3.0. This means that in order to run any WPF application,
you are going to need to make sure that the .NET Framework 3.0 is installed on the client machine. WPF
applications will be available for Windows Vista, Windows XP, and Windows Server 2003 (the only
operating systems which allow for the installation of the .NET Framework 3.0).
XAML is the XML declaration that is used to create a form which represents all the visual aspect and
behaviors of the WPF application. While it is possible to work with a WPF application programmatically,
WPF is a step in the direction of declarative programming, which the industry is moving to. Declarative
programming means that instead of creating objects through programming in a compiled language such
as C#, VB, or Java; instead, you declare everything through XML-type programming. Chapter 31, “Windows
Presentation Foundation” goes into detail on how to build these new types of applications using XAML
and C#.
Windows Controls
Although Web Forms and Windows Forms are developed in much the same way, you use different kinds of
controls to populate them. Web Forms use Web server controls, and Windows Forms use Windows Controls.
A Windows Control is a lot like an ActiveX control. After a Windows Control is implemented, it com-
piles to a DLL that must be installed on the client’s machine. In fact, the .NET SDK provides a utility
that creates a wrapper for ActiveX controls, so that they can be placed on Windows Forms. As is the
case with Web Controls, Windows Control creation involves deriving from a particular class,
System.Windows.Forms.Control.
Windows Services
A Windows Service (originally called an NT Service) is a program designed to run in the background in
Windows NT/2000/XP/2003 (but not Windows 9x). Services are useful where you want a program to be
running continuously and ready to respond to events without having been explicitly started by the user.
A good example is the World Wide Web Service on Web servers, which listens for Web requests from clients.
24
Part I: The C# Language
24727c01.qxd:WroxPro 5/7/07 12:12 PM Page 24