Windows Forms Programming in C#

Paperback (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 96%)
Other sellers (Paperback)
  • All (23) from $1.99   
  • New (5) from $49.41   
  • Used (18) from $1.99   

Overview

Praise for Windows Forms Programming in C#

“Chris may have a strong affinity for semi-colons, but anybody who’s programming Windows Forms needs to read this book.”

     —Brian Randell, Visual Basic Guru and DevelopMentor Instructor

“Chris Sells has done it again. This book has everything a developer needs to know to write serious WinForms applications. Chris leaves no stone unturned in explaining the WinForms programming model and arming developers with the knowledge they need to exploit WinForms to the fullest. And, as if that weren’t enough, Chris’s writing style makes this book a page-turner for geeks. I couldn’t put it down! Until John Grisham gets the .NET religion, you won’t find a better WinForms book anywhere.”

     —Jeff Prosise, co-founder of Wintellect, author of Programming Microsoft .NET

“Chris is clearly *the* expert on web deployment of WinForms. In this book, Chris explains this material clearly and the power of the technology really shows. Unlike other WinForms books, this manuscript takes a more practical approach to the use of programming tools, such as Visual Studio. Sells’s book strikes a nice balance between theory and practice. Windows Forms is an important technology that needs more press. Chris Sells’ book is in great position to be the definitive work on the emerging technology.”

     —Brian Graff, Sr. SW Engineer, PreEmptive Solutions, Inc.

“Chris has written the best WinForms book around. Period.”

     —Pierre Nallet, DevelopMentor Instructor

“Chris does a nice job of presenting the core elements of WinForms complete with many concise samples and graphic depictions of UI features in action. Even more compelling, however, is how Chris anticipates how most developers will want to use these features, and presents techniques and paradigms of usage that will be invaluable for any serious WinForms developer. This book is destined to become dog-eared in the hands anyone building WinForms applications.”

     —Fritz Onion, DevelopMentor instructor and author of Essential ASP.NET

“I don’t want just a description of the WinForms widgets. I can get that online or from other books. What I want is a roadmap for pitfalls to avoid, and innovative solutions for common problems. That is where this book shines.”

     —Johan Ericcson, SW Engineer, Agilent

“This is the definitive book for every Windows Programmer.”

     —Fumiaki Yoshimatsu, Sr. Engineer, Intoferia Corporation

“After browsing through countless books that introduce me to Windows Forms basics, it is refreshing to find a book that dives right into some real hard-core programming. This is, without a doubt the best and most useful C#/WinForms book I have ever read. I would suggest this book to be essential reading for very serious .NET WinForms developer who wants to work smarter instead of harder.”

     —Serge Shimanovsky, Software Developer, Rueters Group PLC

“In this book, Chris Sells discusses how the Windows Forms classes and their supporting infrastructure can be used to write robust and rich smart client applications. If you’re an experienced Windows programmer who has previously used MFC or directly utilized the Win32 API to write such applications, you will find Chris’s direct delivery very appropriate for transferring your knowledge to the managed classes. If you’re a developer with less Windows development experience, you’ll find the treatment of core concepts in application UI programming indispensable.”

     —From the foreword by Mike Blaszczack, Architect, SQL Server Data Warehousing, Microsoft


"I think this book does a great job of hitting a huge number of features—sometimes I forget how much there is to WinForms!" —Chris Anderson, Software Architect, Microsoft Windows Forms team

Programming Windows Forms in C# is the ultimate guide to using the Microsoft .NET forms package. Readers learn how to build smart client applications that take full advantage of both the rich user interface features of the Microsoft Windows operating system and the deployment features of HTML-based applications. Author Chris Sells draws upon his WinForms research and programming experience to provide what the Windows Forms documentation could not: a clear picture of exactly how C# programmers will want to use WinForms.

Well-written and easy to navigate, this book presents the building blocks of WinForms and the best practices for creating stand-alone client applications and front ends to databases and Web services. Readers gain an understanding of the rationale behind aspects of WinForms' design and will find out how to avoid or solve common problems. Figures illustrate WinForms' user interface features and code samples are used throughout the book to demonstrate best practices. All code has been tested with Visual Studio .NET 1.1 and is available at www.sellsbrothers.com, where readers will also find updates to the book.

This book focuses on the topics readers need to understand in order to build real-world applications. These topics include:

Form layout

  • Multiple top-level windows
  • Non-rectangular windows
  • Accessing data from the middle tier, filesystems, XML, databases, and Web services
  • Classes outside the System.WinForms namespace, including System.Drawing and System.Security
  • Custom drawing
  • Hosting and building controls
  • Design-time integration
  • Data binding
  • Multithreaded user interfaces
  • Deploying WinForms over the Web
  • Moving from MFC
  • Delegates and events
  • Serialization basics

Programming Windows Forms in C# is the tutorial for experienced Windows programmers who are serious about mastering Windows Forms.

Read More Show Less

Product Details

  • ISBN-13: 9780321116208
  • Publisher: Addison-Wesley
  • Publication date: 8/22/2003
  • Series: Microsoft .NET Development Series
  • Edition description: Older Edition
  • Pages: 736
  • Sales rank: 864,498
  • Product dimensions: 7.00 (w) x 9.00 (h) x 1.80 (d)

Meet the Author

Chris Sells is a content strategist on the Microsoft MSDN content team. Previously, he was the director of software engineering at DevelopMentor. Chris is the author of Windows Telephony Programming (Addison-Wesley, 1998) and Windows Forms Programming in Visual Basic .NET (Addison-Wesley, 2004), and coauthor of Effective COM (Addison-Wesley, 1999), ATL Internals (Addison-Wesley, 1999), and Essential .NET, Volume 1 (Addison-Wesley, 2003).

0321116208AB07142003

Read More Show Less

Read an Excerpt

As a fairly public figure in the Windows developer community, I often get asked if I think that .NET is going to "take off." I always answer the same thing; it's not a matter of "if," it's a matter of "when." Microsoft's .NET Framework has so many benefits that even as a grizzled old C++/Win32 guy, I wasn't able to resist the siren song of a managed development environment. It's ironic that the temporary dip in the economy has caused folks to avoid anything new just when .NET comes along to deliver significant reductions in time to market and cost while simultaneously increasing code quality. The organizations that have already adopted .NET know that it's going to have a long and happy life, especially as it gets pushed further and further into Microsoft's own plans for the future of the Windows platform, both on the server and on the client.

The primary server-side technology in .NET is ASP.NET, which provides the infrastructure needed to build web sites and web services. ASP.NET provides the reach to deploy web sites to anyone by aiming at the baseline of features provided by the middle generation web browsers. To provide the highest level of functionality possible, ASP.NET does most of the work on the server-side, leaving the client-side HTML as a thin wrapper to trigger server-side requests for new pages of data. The server-side handles practically everything, from data manipulation to user preferences to the rendering of simple things like menus and toolbars. This model provides the greatest availability across operating systems and browsers.

If, on the other hand, your targeted customers are Windows users, an HTML-based experience limits the users to a lowest-common denominator approach that is unnecessary. In fact, in an attempt to provide a richer client-side experience, many organizations that know they're targeting Windows users require specific versions of Microsoft's Internet Explorer (IE) web browser. However, as soon as that happens, IE becomes less of a browser and more of an HTML-based application runtime. And for that purpose, the HTML object model is fairly primitive, often requiring a lot of work to do things that are normally simple (like keeping track of a user's session state). If you're going to be targeting Windows users, the .NET Framework provides a much richer set of objects for building interactive user interfaces.

This brings me to the subject of this book: Windows Forms (WinForms). WinForms is the face of .NET on the client, providing a forms-based development environment meant to provide the best of the UI object models that have come before it. In addition, it provides one feature that no Windows-based development framework has provided to date - the deployment features of HTML-based web applications. The ability to combine the richness of Windows applications with the deployment of web applications signals a completely new world for Windows developers; one that makes me more than happy to give up the mess of unmanaged code.

Audience

When writing this book, I had two target audiences in mind. I wanted to provide real-world WinForms coverage for both the programmer that had already programmed in .NET as well as for the programmer that hadn't. Towards that end, I do briefly introduce core .NET topics as they come up. However, the .NET Framework itself is a large area that this book doesn't pretend to cover completely. Instead, when I think more information would be useful to the reader, I reference another work that provides the full details. In particular, I find that I've referenced Essential .NET, by Don Box, with Chris Sells, a great deal, making it a good companion to this book. In this same category, I can also recommend Pragmatic ADO.NET, by Shawn Wildermuth, Advanced .NET Remoting, by Ingo Rammer, .NET Web Services, by Keith Ballinger and Applied Microsoft .NET Framework Programming, by Jeffrey Richter.

Two core .NET topics are of special importance to WinForms programmers and I cover them in more detail in Appendix B: Delegates & Events and Appendix C: Serialization Basics. The coverage of delegates and events is particularly important if you're new to .NET, although I don't recommend diving into that topic until you've got a WinForms-specific frame of reference (which is provided about 1/3rd of the way through Chapter 1: Hello, Windows Forms).

I'd like to provide one other note for potential readers. Many years ago, I wrote my first five-day training course. The topic was Windows 95 and included a few hours of coverage on the new controls; what they looked like, what their properties, methods and events were and how to program against them. Those hours seemed to take days for both me and for the students. The details of a particular control are only interesting when you're putting that control to use and when that time comes, the control-specific documentation and IntelliSense do a marvelous job of giving you the information you need. Towards that end, this book covers none of the standard controls completely. Instead, as each control is interesting the context of the current topic, like the DataGrid control in Chapter 13: Data Binding & Data Grids, that control is covered appropriately. Also, Chapter 8: Controls and Chapter 9: Design-Time Integration introduces the broad range of categories of controls that WinForms provides, including the category of non-visual controls called components in .NET. Finally, to give you a visual to go with all of the controls and components and to introduce you to the major functionality of each of them, Appendix D: Standard WinForms Components & Controls provides a list of the standard controls and components. I wouldn't think to waste your time by attempting to be more thorough that that reference documentation that comes with the .NET Framework SDK and Visual Studio .NET. Instead, this book focuses on the real-world scenarios that aren't already covered in detail elsewhere.

Conventions

For those of you that have decided to take the plunge with this book, I'd like to thank you for your faith and express my hope that I live up to in. To aid you in reading the following text, I want to let you in on some conventions I use in my writing.

First and foremost, the wonderful thing about WinForms is how visual it is, which is why I use a lot of figures to illustrate its features. Some of those pictures really need to be color to make the point, so be sure to check the color pages at the center of this book for those figures.

As useful as figures are, I think primarily in code. Code will be shown in mono-faced type:

System.Console.WriteLine("Hello, WinForms.");

Console application activation will also be shown in mono-faced type:

C:\> csc.exe hello.cs

When a part of a code snippet or a command line activation is of particular interest, I mark it in bold and often provide a comment:

// Notice the use of the .NET System namespace System.Console.WriteLine("Hello, WinForms.");

When I want to direct your attention to a piece of code even more fully, I'll replace superfluous code with ellipses:

class MyForm : System.Windows.Forms.Form {
... // fields
private void MyForm_Load(object sender, System.ComponentModel.EventArgs e) {
MessageBox.Show("Hello from MyForm");
}
}

Further, to make the printed code more readable, I'll often drop namespaces and protection keywords when they don't provide additional information:

// Shortened "System.Windows.Forms.Form" base class
class MyForm : Form {
... // fields
// Removed "private" specifier and "System.ComponentModel" namespace
void MyForm_Load(object sender, EventArgs e) {
MessageBox.Show("Hello from MyForm");
}
}

When showing .NET attributes, I use their full name:

SerializableAttribute
class MyCustomType {...}

Some languages, like C#, allow the "Attribute" suffix to be dropped for convenience, but that makes it hard to find the details of the attribute class in the online documentation.

Also, I sometimes take error checking out of the printed code for clarity, but try to leave it in the sample code that comes with this book.In the prose itself, I often put a word or phrase in italics to indicate a new term that I'm about to define. As an example of this kind of term and its definition, hegemony is preponderant influence or authority, as well as a useful business practice.

Finally, I often mention keyboard shortcuts because I find them convenient. The ones I mention are the default Visual Studio Developer key bindings. If you're not using those key bindings, you'll need to map the keyboard shortcuts to your own settings.

Contact

The up-to-date information for this book, including the source code and the errata, are maintained at http://www.sellsbrothers.com/. This site also provides a way for you to send feedback to me about the book, both complimentary and less so.

0321116208P05022003

Read More Show Less

Table of Contents

Figures.

Tables.

Foreword.

Preface.

1. Hello, Windows Forms.

WinForms from Scratch.

Windows Forms in Visual Studio .NET.

Arranging Controls.

Controls.

Application Settings.

Resources.

Dialogs.

Drawing and Printing.

Data Binding.

Multithreaded User Interfaces.

Deployment.

Moving from MFC.

Where Are We?

2. Forms.

Showing Forms.

Owner and Owned Forms.

Form Lifetime.

Form Size and Location.

Restricting Form Size.

Z-Order.

Form Adornments.

Form Transparency.

Nonrectangular Forms.

Form Menus.

Context Menus.

Child Controls.

Control Z-Order.

Control Tab Order.

Themed Controls.

Hosting COM Controls.

Layout.

Form Auto-Scaling.

Anchoring.

Docking.

Docking and Z-Order.

Splitting.

Grouping.

Custom Layout.

Multiple Document Interface.

Menu Merging.

Visual Inheritance.

Where Are We?

3. Dialogs.

Standard Dialogs.

Styles.

Setting Modal Versus Modeless Behavior Dynamically.

Data Exchange.

Handling OK and Cancel.

Modeless Form Data.

Data Validation.

Regular Expressions and Validation.

Data Format Notification.

Thorough Validation.

Implementing Help.

Tooltips.

Using the ErrorProvider for General Information.

Handling the Help Button and F1.

Using HTML Help.

Compiled HTML Help.

Using the HelpProvider Component.

Showing Help Contents, Index, and Search.

Where Are We?

4. Drawing Basics.

Drawing to the Screen.

Handling the Paint Event.

Triggering the Paint Event.

Colors.

Known Colors.

Color Translation.

Brushes.

Solid Brushes.

Texture Brushes.

Hatch Brushes.

Linear Gradient Brushes.

Path Gradient Brushes.

Pens.

Line Caps.

Dashes.

Alignments.

Joins.

Creating Pens from Brushes.

Shapes.

Curves.

Smoothing Modes.

Saving and Restoring Graphics Settings.

Paths.

Fill Modes.

Images.

Loading and Drawing Images.

Scaling, Clipping, Panning, and Skewing.

Rotating and Flipping.

Recoloring.

Transparency.

Animation.

Drawing to Images.

Icons.

Cursors.

Where Are We?

5. Drawing Text.

Fonts.

Creating Fonts.

Font Families.

Font Characteristics.

Font Height.

Strings.

Formatting.

Strings and Paths.

Where Are We?

6. Advanced Drawing.

Page Units.

Converting Pixels to Page Units.

Transforms.

Scaling.

Scaling Fonts.

Rotation.

Translation.

Shearing.

Combining Transforms.

Transformation Helpers.

Path Transformations.

Regions.

Constructing and Filling a Region.

Clipping to a Region.

Region Combination Operations.

Optimized Drawing.

Double Buffering.

Other Drawing Options.

Where Are We?

7. Printing.

Print Documents.

Print Controllers.

Print Preview.

Basic Print Events.

Margins.

Page Settings.

Printer Settings.

Print Range.

Targeting the Printer.

Where Are We?

8. Controls.

Standard Controls.

Action Controls.

Value Controls.

List Controls.

Container Controls.

ImageLists.

Owner-Draw Controls.

Custom Controls.

Deriving Directly from the Control Class.

Testing Custom Controls.

Control Rendering.

Ambient Properties.

Custom Functionality.

Control Input.

Windows Message Handling.

Scrolling Controls.

Extending Existing Controls.

User Controls.

Drag and Drop.

The Drop Target.

The Drop Source.

Where Are We?

9. Design-Time Integration.

Components.

Standard Components.

Custom Components.

Design-Time Integration Basics.

Hosts, Containers, and Sites.

Debugging Design-Time Functionality.

The DesignMode Property.

Attributes.

Property Browser Integration.

Code Serialization.

Batch Initialization.

Extender Property Providers.

Type Converters.

Expandable Object Converter.

UI Type Editors.

Drop-Down UI Type Editors.

Modal UI Type Editors.

Custom Designers.

Design-Time-Only Properties.

Design-Time Context Menu Verbs.

Where Are We?

10. Resources.

Resource Basics.

Manifest Resources.

Typed Resources.

Resource Manager.

Designer Resources.

Resource Localization.

Culture Information.

Resource Probing.

Resource Localization.

Resource Localization for Nondevelopers.

Resource Resolution.

Input Language.

Where Are We?

11. Applications and Settings.

Applications.

Application Lifetime.

Application Context.

Application Events.

UI Thread Exceptions.

Single-Instance Applications.

Passing Command Line Arguments.

Multi-SDI Applications.

Environment.

Compile-Time Settings.

Environment Settings.

Settings.

Types of Settings.

.config Files.

Dynamic Properties.

The Registry.

Special Folders.

Settings and Streams.

Isolated Storage.

Versioned Data Paths.

Choosing a Settings Mechanism.

Where Are We?

12. Data Sets and Designer Support.

Data Sets.

Retrieving Data.

Creating Data.

Updating Data.

Deleting Data.

Tracking Changes.

Committing Changes.

Multitable Data Sets.

Constraints

Relations.

Navigation.

Expressions.

Designer Support.

Connection Objects.

Command Objects.

Data Adapter Objects.

Typed Data Sets.

Creating a Typed Data Set.

Constraints in Typed Data Sets.

Relations in Typed Data Sets.

Expressions in Typed Data Sets.

Adding a Typed Data Set to a Form.

Where Are We?

13. Data Binding and Data Grids.

Data Binding.

Bindings and Data Sources.

Simple Data Binding to Items.

Simple Data Binding to Lists

Simple Binding to Data Sets.

Binding Managers.

Current Data Row.

Changes to the Data Set.

Changes to the Control.

Complex Data Binding.

Data Views.

Master-Detail Relations.

Data Grids.

Formatting Data Grids.

Data Exchange and Data Grids.

Bringing It All Together.

Custom Data Sources.

Custom Item Data Sources.

Type Descriptors and Data Binding.

Type Conversion.

List Data Sources.

Where Are We?

14. Multithreaded User Interfaces.

Long-Running Operations.

Progress Indication.

Asynchronous Operations.

Safety and Multithreading.

Simplified Multithreading.

Canceling.

Communication with Shared Data.

Communicating via Method Parameters.

Communication via Message Passing.

Asynchronous Web Services.

Where Are We?

15. Web Deployment.

Hosting Controls in Internet Explorer.

Control Creation.

Control Interaction.

Code Access Security.

Checking for Permissions.

Awarding Permissions.

No-Touch Deployment.

Application Download.

Versioning.

Related Files.

Partially Trusted Assembly Considerations.

Allowing Partially Trusted Callers.

Settings.

Custom User Input.

Communicating via Web Services.

Reading and Writing Files.

Command Line Arguments.

Debugging NTD Applications.

Increasing Permissions.

Increasing Permissions Programmatically.

Deploying Permissions.

Authenticode.

Where Are We?

A. Moving from MFC.

A Few Words About MFC.

MFC Versus WinForms.

The Differences.

Strategy.

Genghis.

B. Delegates and Events.

Delegates.

Events.

Harvesting All Results.

Asynchronous Notification: Fire and Forget.

Happiness in the Universe.

C. Serialization Basics.

Streams.

Formatters.

Skipping a Nonserialized Field.

IDeserializationCallback.

ISerializable.

Data Versioning.

D. Standard WinForms Components and Controls.

Components and Controls Defined.

Standard Components.

Standard Dialogs.

Notify Icons.

Timer.

Image List.

Main Menus and Context Menus.

Standard Controls.

Non-Container Controls.

Container Controls.

Bibliography.

Index. 0321116208T08272003

Read More Show Less

Preface

As a fairly public figure in the Windows developer community, I often get asked if I think that .NET is going to "take off." I always answer the same thing; it's not a matter of "if," it's a matter of "when." Microsoft's .NET Framework has so many benefits that even as a grizzled old C++/Win32 guy, I wasn't able to resist the siren song of a managed development environment. It's ironic that the temporary dip in the economy has caused folks to avoid anything new just when .NET comes along to deliver significant reductions in time to market and cost while simultaneously increasing code quality. The organizations that have already adopted .NET know that it's going to have a long and happy life, especially as it gets pushed further and further into Microsoft's own plans for the future of the Windows platform, both on the server and on the client.

The primary server-side technology in .NET is ASP.NET, which provides the infrastructure needed to build web sites and web services. ASP.NET provides the reach to deploy web sites to anyone by aiming at the baseline of features provided by the middle generation web browsers. To provide the highest level of functionality possible, ASP.NET does most of the work on the server-side, leaving the client-side HTML as a thin wrapper to trigger server-side requests for new pages of data. The server-side handles practically everything, from data manipulation to user preferences to the rendering of simple things like menus and toolbars. This model provides the greatest availability across operating systems and browsers.

If, on the other hand, your targeted customers are Windows users, an HTML-based experience limits the users to a lowest-common denominator approach that is unnecessary. In fact, in an attempt to provide a richer client-side experience, many organizations that know they're targeting Windows users require specific versions of Microsoft's Internet Explorer (IE) web browser. However, as soon as that happens, IE becomes less of a browser and more of an HTML-based application runtime. And for that purpose, the HTML object model is fairly primitive, often requiring a lot of work to do things that are normally simple (like keeping track of a user's session state). If you're going to be targeting Windows users, the .NET Framework provides a much richer set of objects for building interactive user interfaces.

This brings me to the subject of this book: Windows Forms (WinForms). WinForms is the face of .NET on the client, providing a forms-based development environment meant to provide the best of the UI object models that have come before it. In addition, it provides one feature that no Windows-based development framework has provided to date - the deployment features of HTML-based web applications. The ability to combine the richness of Windows applications with the deployment of web applications signals a completely new world for Windows developers; one that makes me more than happy to give up the mess of unmanaged code.

Audience

When writing this book, I had two target audiences in mind. I wanted to provide real-world WinForms coverage for both the programmer that had already programmed in .NET as well as for the programmer that hadn't. Towards that end, I do briefly introduce core .NET topics as they come up. However, the .NET Framework itself is a large area that this book doesn't pretend to cover completely. Instead, when I think more information would be useful to the reader, I reference another work that provides the full details. In particular, I find that I've referenced Essential .NET, by Don Box, with Chris Sells, a great deal, making it a good companion to this book. In this same category, I can also recommend Pragmatic ADO.NET, by Shawn Wildermuth, Advanced .NET Remoting, by Ingo Rammer, .NET Web Services, by Keith Ballinger and Applied Microsoft .NET Framework Programming, by Jeffrey Richter.

Two core .NET topics are of special importance to WinForms programmers and I cover them in more detail in Appendix B: Delegates & Events and Appendix C: Serialization Basics. The coverage of delegates and events is particularly important if you're new to .NET, although I don't recommend diving into that topic until you've got a WinForms-specific frame of reference (which is provided about 1/3rd of the way through Chapter 1: Hello, Windows Forms).

I'd like to provide one other note for potential readers. Many years ago, I wrote my first five-day training course. The topic was Windows 95 and included a few hours of coverage on the new controls; what they looked like, what their properties, methods and events were and how to program against them. Those hours seemed to take days for both me and for the students. The details of a particular control are only interesting when you're putting that control to use and when that time comes, the control-specific documentation and IntelliSense do a marvelous job of giving you the information you need. Towards that end, this book covers none of the standard controls completely. Instead, as each control is interesting the context of the current topic, like the DataGrid control in Chapter 13: Data Binding & Data Grids, that control is covered appropriately. Also, Chapter 8: Controls and Chapter 9: Design-Time Integration introduces the broad range of categories of controls that WinForms provides, including the category of non-visual controls called components in .NET. Finally, to give you a visual to go with all of the controls and components and to introduce you to the major functionality of each of them, Appendix D: Standard WinForms Components & Controls provides a list of the standard controls and components. I wouldn't think to waste your time by attempting to be more thorough that that reference documentation that comes with the .NET Framework SDK and Visual Studio .NET. Instead, this book focuses on the real-world scenarios that aren't already covered in detail elsewhere.

Conventions

For those of you that have decided to take the plunge with this book, I'd like to thank you for your faith and express my hope that I live up to in. To aid you in reading the following text, I want to let you in on some conventions I use in my writing.

First and foremost, the wonderful thing about WinForms is how visual it is, which is why I use a lot of figures to illustrate its features. Some of those pictures really need to be color to make the point, so be sure to check the color pages at the center of this book for those figures.

As useful as figures are, I think primarily in code. Code will be shown in mono-faced type:

System.Console.WriteLine("Hello, WinForms.");

Console application activation will also be shown in mono-faced type:

C:\> csc.exe hello.cs

When a part of a code snippet or a command line activation is of particular interest, I mark it in bold and often provide a comment:

// Notice the use of the .NET System namespace
System.
Console.WriteLine("Hello, WinForms.");

When I want to direct your attention to a piece of code even more fully, I'll replace superfluous code with ellipses:

class MyForm : System.Windows.Forms.Form {
... // fields
private void MyForm_Load(object sender, System.ComponentModel.EventArgs e) {
MessageBox.Show("Hello from MyForm");
}

}

Further, to make the printed code more readable, I'll often drop namespaces and protection keywords when they don't provide additional information:

// Shortened "System.Windows.Forms.Form" base class
class MyForm : Form {
... // fields
// Removed "private" specifier and "System.ComponentModel" namespace
void MyForm_Load(object sender, EventArgs e) {
MessageBox.Show("Hello from MyForm");
}
}

When showing .NET attributes, I use their full name:

SerializableAttribute
class MyCustomType {...}

Some languages, like C#, allow the "Attribute" suffix to be dropped for convenience, but that makes it hard to find the details of the attribute class in the online documentation.

Also, I sometimes take error checking out of the printed code for clarity, but try to leave it in the sample code that comes with this book.In the prose itself, I often put a word or phrase in italics to indicate a new term that I'm about to define. As an example of this kind of term and its definition, hegemony is preponderant influence or authority, as well as a useful business practice.

Finally, I often mention keyboard shortcuts because I find them convenient. The ones I mention are the default Visual Studio Developer key bindings. If you're not using those key bindings, you'll need to map the keyboard shortcuts to your own settings.

Contact

The up-to-date information for this book, including the source code and the errata, are maintained at http://www.sellsbrothers.com/. This site also provides a way for you to send feedback to me about the book, both complimentary and less so.

0321116208P05022003

Read More Show Less

Customer Reviews

Average Rating 4.5
( 3 )
Rating Distribution

5 Star

(1)

4 Star

(2)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 3 Customer Reviews
  • Anonymous

    Posted June 19, 2006

    Forms

    How to write a complete Form

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted May 29, 2005

    Must buy for WinForm developers

    This book touches ALL issues of winform programming. Extensive coverage of forms, controls, GDI+ and database support. We used it as the textbook for our senior windows programming course and I had good support teaching from it. At work I was also able to reference the book on questions that I couldn't find the answer to anywhere else, including MSDN. The book is also very easy to read - overall a fantastic job by Chris Sells!

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted October 16, 2003

    Easy Coding

    The book divides naturally into two parts. Both use the .NET forms package that Microsoft developed to simplify low level coding. The first part is very straightforward graphics programming. Someone who has used X11 on unix, or java's AWT/Swing or, of course, earlier MFC graphics will see no surprises. Font properties, drawing of curves, pens etc are all here. A very complete graphics package. By placing the above discussion as the first part, the author lets you have easy immediate visual feedback if you choose to code the examples. It is always good for readers to tinker; helps retention. The second half is slightly more abstract. Issues like resources - internationalisation of labels for widgets you made in the first part. Plus, how to connect to data objects or databases. He gives a brief discussion of ADO.NET. Along the way, there is a simple exposition of XML. As you can guess, the second part deals with backend, under-the-bonnet tasks. Slightly more abstract than GUI building. The WinForms do indeed seem to handle all these issues clearly, which is vital to your ease of learning and use.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 3 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)