Windows Forms 2.0 Programming
Windows Forms 2.0 Programming
0 Programming
By Chris Sells, Michael Weinhardt
...............................................
Publisher: Addison Wesley Professional
Pub Date: May 16, 2006
Print ISBN-10: 0-3212-6796-6
Print ISBN-13: 978-0-321-26796-2
Pages: 1296
"The books Chris Sells writes are always insightful and this newest addition is no different. This
book in particular is for those who want to understand not just the flashy surface of Windows
Forms 2.0, but also how it fits into the .NET environment. Readers will have this book at their
desks, not stuck on their shelves, for quite a long time."
Yoshimatsu Fumiaki, Software Engineer based in Tokyo Japan
"Chris and Mike have done an excellent job presenting the information you need to be successful
with Windows Forms."
Jessica Fosler, Dev Tech Lead, Microsoft
"This book is the 'must have' teaching and reference book for WinForms 2.0."
Jim Rittenhouse, Senior Software Engineer, Siemens
Windows Forms 2.0 Programming is the successor to the highly praised Windows Forms
Programming in C#. This edition has been significantly updated to amalgamate the sheer mass
of new and improved support that is encompassed by Windows Forms 2.0, the .NET Framework
2.0, and V isual Studio 2005. This is the one book developers need in order to learn how to
build and deploy leading-edge Windows Forms 2.0 applications.
Readers will gain a deep understanding from Sells and Weinhardt's practical, well-balanced
approach to the subject and clear code samples.
Windows Forms 2.0 fundamentals, including forms, dialogs, data validation, help, controls,
components, and rendering
Static and dynamic layout, snap lines, HTML-style flow and table layout, automatic resizing, and
automatic cross-DP I scaling
O ffice 2003-style tool strip control coverage, including dynamic layout and custom rendering
Design-time integration with the V isual Studio 2005 Properties Window and Smart Tags
Resource management, strongly typed resources, and internationalization considerations
2 / 664
Windowsapplication
Forms 2.0 Programming
Strongly typed
and user settings
By Chris Sells, Michael Weinhardt
...............................................
Publisher: Addison Wesley Professional
Pub Date: May 16, 2006
Print ISBN-10: 0-3212-6796-6
Print ISBN-13: 978-0-321-26796-2
Pages: 1296
ClickO nce application development publishing, shell integration, and partial trust security
Best practices for developers transitioning from Windows Forms 1.0 and MFC
3 / 664
...............................................
Publisher: Addison Wesley Professional
Pub Date: May 16, 2006
Print ISBN-10: 0-3212-6796-6
Print ISBN-13: 978-0-321-26796-2
Pages: 1296
nts
FormTranspar
ency Formand
Context Menus
Tool Strips
Status Strips
MultipleDocumentInte
rface Applications
Visual Inheritance
Where
AreWe?
Chapter 3.
Dialogs
Standard
Dialogs
FormStyl
es Data
Exchange
Data
Validation
Implemen
ting Help
Where
AreWe?
Chapter 4.
Layout
Fixed
Layout
DynamicLa
yout
Layout
Controls
Layout
Optimizatio
n
CustomLay
out Where
AreWe?
Chapter5.
DrawingBasi
cs Drawing to
the Screen
Colors
5 / 664
Brush
es
Pens
Shape
s
Paths
Image
s
Where
AreWe?
Chapter6.
DrawingText
Fonts
Strings
6 / 664
OwnerDrawn
Controls
Extending
Existing
Controls
CustomContro
ls
User
Controls
Hosting
COMControls
Where
AreWe?
Chapter11. DesignTimeIntegration:ThePropertie
sWindow DesignTimeComponents
Hosts, Containers,
and Sites Debugging
Design-Time
Functionality The
DesignMode Property
Attributes
Code
Serializati
on Batch
Initializati
on
Extender
Property
Providers Type
Converters
UI Type Editors
Where AreWe?
Chapter12. DesignTimeIntegration:DesignersandS
martTags Designers
Smart
Tags
Where
AreWe?
Chapter13.
Resources
Resource Basics
Strongly Typed
Resources
Application
Internationalizati
on Where
8 / 664
AreWe?
Chapter14.
Windows Forms 2.0 Programming
By Chris Sells, Michael Weinhardt
Applications
...............................................
Applications
Publisher: Addison Wesley Professional
Pub Date: May 16, 2006
Single-Instance
Print ISBN-10: 0-3212-6796-6
Print ISBN-13: 978-0-321-26796-2
Applications
Pages: 1296
Where AreWe?
Chapter 15. Settings
The
ApplicationEnvironment
Application, User, and
Roaming-User Settings
Strongly Typed Settings
Using Strongly Typed
Settings
Designer Settings
Alternative Storage for
Settings
Where
AreWe?
Chapter16.
DataBindingBasics
The Land before Data
Binding
Simple
Data Binding and
ItemData Sources
Simple Binding and List
Data Sources
9 / 664
WordsAboutMFC
MFCVersus
Windows Forms
MFCand Windows
Forms Interop
Windows Forms as
a Better MFC
AppendixC.
DelegatesandEvents
Delegates
Events
Anonymous
Delegates
Happiness in
the Universe
AppendixD.
ComponentandContro
lSurvey Components
Controls
AppendixE.
DragandDrop
Enabling Drag and Drop
Adding Support for Multiple
Drag-and-Drop Effects
Customizing Drag and Drop
Drag and Drop of Multiple
Data Items
File Drag and Drop
AppendixF.
DocumentManage
ment
TheFileDocumentC
omponent Shell
Integration
The
MruMenuManager
Component
Opening Files Dragged and
Dropped fromthe Shell
Bibliography
ColorIns
ert
Index
11 / 664
Copyright
Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in this book, and the publisher was
aware of a trademark claim, the designations have been printed with initial capital letters or in
all capitals.
The .NET logo is either a registered trademark or trademark of Microsoft Corporation in the
United States and/or other countries and is used under license from Microsoft. The following
articles were originally printed in MSDN Magazine, and are reprinted in this book with permission.
".NET Zero Deployment: Security and
V ersioning Models in the Windows Forms Engine
Help You Create and Deploy Smart Clients" by Chris Sells, MSDN Magazine, July 2002. "V isual
Studio .NET: Building Windows Forms Controls and Components with Rich Design-Time
Features" by Michael Weinhardt and Chris Sells, MSDN Magazine, A pril 2003. "V isual Studio
.NET: Building Windows Forms Controls and Components with Rich Design-Time Features, Part
2" by Michael Weinhardt and Chris Sells, MSDN Magazine, May 2003. ".NET Framework 2.0: Craft
a Rich UI for Your .NET A pp with Enhanced Windows Forms Support" by Michael Weinhardt and
Chris Sells, MSDN Magazine, May 2004. "Smart Tags: Simplify UI Development with Custom
Designer A ctions in V isual Studio" by Michael Weinhardt, MSDN Magazine, July 2005. "Draft a
Rich UI: Ground Rules for Building Enhanced Windows Forms Support into Your .NET A pp" by
Michael Weinhardt and Chris Sells, MSDN Magazine, May 2005.
The authors and publisher have taken care in the preparation of this book, but make no
expressed or implied warranty of any kind and assume no responsibility for errors or omissions.
No liability is assumed for incidental or consequential damages in connection with or arising out
of the use of the information or programs contained herein.
The publisher offers excellent discounts on this book when ordered in quantity for bulk
purchases or special sales, which may include electronic versions and/or custom covers and
content particular to your business, training goals, marketing focus, and branding interests. For
more information, please contact:
U.S. Corporate and
Government Sales (800)
382-3419
corpsales@pearsontechg
roup.com
For sales outside the United States please contact:
International Sales
international@pearsoned
.com
Library of Congress Cataloging-in-Publication Data:
Sells, Chris.
Windows Forms 2.0
programming/Chris Sells &
12 / 664
Michael Weinhardt.
p. cm.
ISBN 0-321-26796-6
(pbk. : alk. paper) 1.
Microsoft .NET
Framework. 2. Computer
softwareDevelopment. I.
Weinhardt, Michael. II.
Title.
QA
76.76.M52S44
2006
005.2'768dc22
2006000194
Copyright 2006 Chris Sells and Michael Weinhardt A ll rights reserved. Printed in the United
States of A merica. This publication is protected by copyright, and permission must be obtained
from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or
likewise. For information regarding permissions, write to:
Pearson Education, Inc.
Rights and
Contracts
Department 75 A
rlington Street,
Suite 300
Boston, MA 02116
Fax: (617) 848-7047
Text printed in the United States on recycled paper at Edwards Brothers in A nn A rbor, Michigan
First printing, May 2006
"Some books are different; the content can't be Googled from the Internet, the
authors have real-life experiences to share, the code can be used in real-world
projects. This is one of those books. A nd it's not a simple upgrade of the 1 st edition;
this book has been completely refitted to present WinForms 2.0 as it should be
presented."
Neal Myrddin, Independent Developer
"Chris and Michael nail the soul of Windows Forms 2.0. This book provides an
insightful view into the design of Windows Forms and the integration of new 2.0
features. It is just as applicable for the first-time Windows Forms programmer as the
seasoned line of business developer. The What's New in 2.0 appendix is worth the
price of admission alone."
Mike Harsh, Windows Forms Program Manager, Microsoft, Inc.
"This book takes an amazingly broad and deep technology, and breaks it into
manageable pieces that are easily consumed. You cannot survive building a complex
WinForms application without this book."
13 / 664
14 / 664
15 / 664
Fritz O nion, Essential ASP.NET with Examples in Visual Basic .NET, 0-201-76039-8
Ted Pattison and Dr. Joe Hummel, Building Applications and
Components with Visual Basic .NET, 0-201-73495-8 Dr. Neil
Roodyn, eXtreme .NET: Introducing eXtreme Programming
Techniques to .NET Developers, 0-321-30363-6 Chris Sells,
Windows Forms Programming in C#, 0-321-11620-8
Chris Sells and Justin Gehtland, Windows Forms
Programming in Visual Basic .NET, 0-321-12519-3 Paul V
ick, The Visual Basic .NET Programming Language, 0-32116951-4
Damien Watkins, Mark Hammond, Brad A brams, Programming
in the .NET Environment, 0-201-77018-0 Shawn Wildermuth,
Pragmatic ADO.NET: Data Access for the Internet World, 0-20174568-2
Paul Yao and David Durant, .NET Compact Framework Programming with C#, 0-321-17403-8
Paul Yao and David Durant, .NET Compact Framework Programming with Visual Basic .NET, 0-32117404-6
For more information go to www.awprofessional.com/msdotnetseries/
17 / 664
18 / 664
Foreword
A long, long time ago when I began programming P C GUIs, there were none of these fancy
framework thingies. O ne wrote a whole lot of C code in a case statement long enough to cut a
giant's undershirt out of. I'd spent a couple weeks understanding and implementing DDE (yes,
DDE) in the application we were building (and frankly, it was not the most pleasant experience)
when I ran across an article in a magazine showing how this fancy thing called "Smalltalk" could
do DDE in a couple of lines of code. Wow! I thought. That's the way I want to program! I've been
working with and on UI frameworks pretty much ever since, which is how I ended up working on
Windows Forms at Microsoft.
For V 1 of Windows Forms, our goal was to produce a comprehensive UI framework that
combined the ease of use of V B with the extensibility and flexibility of MFC. A long the way,
we picked up additional goals, including rich design-time extensibility, GDI+ support, and
support for partial trust for No Touch Deployment (NTD). I think we did a reasonable job of
meeting these goals. Despite the focus on the "web stuff" when we first released, there are an
enormous number of people using Windows Forms today to build all types of applications, from
photo management software to applications supporting core business processes. I find seeing
the interesting applications people build with Windows Forms one of the more rewarding parts
of my job. However, to be honest, there are areas where we could have done better, for
example, NTD had no V isual Studio support and could be complex to debug when things went
wrong, so overall, I have to give V 1 of Windows Forms a "shows promise" rating.
V 2 of Windows Forms is about delivering on that promise. This is a major upgrade to Windows
Forms. A lmost every area of Windows Forms design-time and run-time has been improved. A s
Chris and Michael call out in A ppendix A : What's New in Windows Forms 2.0, we have
incorporated completely new features and a large number of improvements to our existing
features (apparently we have 329 new types, 139 updated types, and 14,323 new members).
Rather than repeat A ppendix A , I'm going to call out three new features that I think illustrate
how we achieved our goals for this version of Windows Forms: solve deployment, enable greatlooking apps, and enhance productivity.
Deployment
I think the single most significant feature in V 2 of the .NET Framework (not just Windows Forms,
but the whole .NET Framework) is ClickO nce. ClickO nce delivers
on the promise of No Touch Deployment to bring easy, reliable, and manageable web-based
deployment to client applications. Deploying your application via the web is now simply a
matter of stepping through a wizard in V isual Studio 2005.
Great-Looking Apps
Ever since I joined Microsoft, customers have asked for the ability to build applications that
look like Microsoft O ffice "out of the box," and you can do exactly that with V 2 of Windows
Forms using the new menu strip, tool strip, and status strip controls (ToolStrip, MenuStrip, and
StatusStrip). Not only do the strip controls support the standard Windows and O ffice look and
19 / 664
feel, but they can also be customized to look like pretty much anything you fancy.
Productivity
We've added a whole set of design-time and run-time improvements that we believe will help
you to be more productive. O ne of my favorite new designer features is SnapLines, which allows
you to quickly align controls with each other as you lay out your forms. O nce you've used a
designer with SnapLines, you never want to go back, it's the designer equivalent of IntelliSense.
The Future
A fter shipping V 2, our thoughts are naturally turning to the future. Predicting the future is a
dangerous business, most of the predictions from when I was a kid mean we should be
supporting actors in either The Jetsons or 1984 by now, and so I'm a little nervous about making
any long-term predictions. However, I can say a few things based on where we are and what I
would like to see us do. First, the .NET Framework and managed code is here to stay: It is the
programming model of the present and the future. Learning to use the .NET Framework and
Windows Forms is a solid investment for the future. Second, to paraphrase Samuel Clemens
terribly, "Reports of the death of client apps are greatly exaggerated." Client applications are
here to stay, can now be deployed as easily as web applications, provide significant business
value, and will provide more value as time progresses. Third, as part of our continued
investment in Windows Forms, we will ensure that Windows Forms works well with new
technologies coming down the pipe such as those in WinFX. This allows you to build applications
today with the knowledge that you will be able to enhance those applications in the future using
both Windows Forms and these new technologies as they become available. Finally, from a
Windows Forms perspective, I believe we need to broaden what we provide into a framework and
design experience that addresses the end-to-end process of building a client application. We
have a great designer to help you build your UI, but you still have to write way too much code to
build your whole application. I would like to see us provide a great designer-based experience
for your entire application, not just your forms.
So hopefully what I've said about Windows Forms has got you at least a little curious to find out
more (which is where this book comes in). The first edition of this book was a great overview of
and introduction to Windows Forms. The same is true of this second edition. Whether you are
learning Windows Forms for the first time or if you just want to get a handle on the new stuff
we've done in V 2, this book will help you. It covers all of the significant feature areas, from the
basics of creating Forms, through ToolStrips and data binding to deployment with ClickO nce.
The book is a great balancing act: It neither ignores V isual Studio 2005 nor reduces itself to a
simplistic "Click here then click here" walkthrough of V isual Studio 2005 features. The book not
only explains the concepts and shows you how to use those concepts in code, but it also shows
you how the designer helps you to be more productive by automatically generating the code for
you. This leaves you with a solid understanding of both how things work and how to use V isual
Studio 2005 to get things done as productively as possible. The chapters on data binding (16
and 17) are a great example of this approach. The source code examples are another great
balancing act: They are neither too short to be useful nor so long as to be overwhelming. To
quote A lan Cooper, they are "Goldilocks code" examples because they are "just right."
I would like to particularly highlight the chapters on data binding (Chapters 16 and 17), not
just because data binding is very close to my heart, but because the book does an excellent
20 / 664
job of explaining how data binding works and how to use it effectively. I would also like to
highlight the chapters on writing design-time behavior for your controls and components
(Chapters 11 and 12) because this is a subject that is often neglected. These chapters alone
make this a "must read" book.
So, in summary, this book will leave you not only in a position to effectively use what we provide
as part of Windows Forms but also with the understanding you need to write your own run-time
and design-time extensions to what we provide.
I'd like to close with some acknowledgments and thanks. First, thanks to the entire Windows
Forms team, who have worked tirelessly to build and ship what I believe is a great product. I'm
very proud of what we have achieved. Second, my thanks to Michael and Chris not only for
producing a book that does a great job of
explaining our product and will make it easier for our customers to use, but also for their
contributions to the wider Windows Forms community. Thanks to Michael for his great articles
on MSDN and feedback on Windows Forms V 2particularly his feedback on the ToolStrip
controls. Thanks to Chris for his seemingly boundless enthusiasm for Windows Forms, his
excellent writing on Windows Forms, his deep understanding of Windows Forms, MFC, and
Windows, and his polite and measured but enthusiastic and copious feedback on every aspect
of the product. Both Mike and Chris have helped enormously both in promoting understanding of
the product and in helping make Windows Forms as good as it is today. A nd finally, my thanks
to our customers: Every single feature in Windows Forms V 2 is based on your feedback. So to
all of you who took the time to give us feedback and suggestions: Thanks! Please keep it
coming!
I hope you have fun using Windows Forms.
Mark Boulter
P M Technical Lead,
Client Development Tools, Microsoft
21 / 664
22 / 664
Preface
Windows 1.0 programmers had a straightforward life. They had almost no choices about how to
do things; either there was an application programming interface
(A P I), or there wasn't, and
most of the time there wasn't. This meant that developers had to build almost everything by
hand. A t the time, this wasn't a problem. A ll Windows programmers had the same limitations,
so everyone's apps more or less operated with the same limited set of functionality.
A modern Windows developer, on the other hand, is inundated with choices. The invention of
the web alone gives us static Hypertext Markup Language (HTML), server-based user interface
(UI) interaction via A SP.NET, and client-side UI interaction via A ctiveX controls or A JA X (to
name a few).[1] O n the client side, we have native frameworks like Microsoft Foundation
Classes (MFC), A ctive Template Library (A TL), and the next-generation managed framework
known as the Windows Presentation Foundation (WP F is part of WinFX, the follow-on to the
.NET Framework). How does a developer choose? Where does Windows Forms 2.0, the topic of
this book, fit into this pantheon?
[1] AJAXstands for Asynchronous JavaScript and XML, as defined by Jesse James
Garrett, "Ajax: A New Approach to Web Applications,"
http://www.adaptivepath.com/publications/essays/archives/000385.php
(http://tinysells.com/38).
Client technologies on Windows provide a range of reach and richness in inverse proportion to
each other. Reach is the ability of a user interface (UI) to work across operating systems,
whereas richness is the ability for a UI to take advantage of the operating system on which it
runs. So even though static HTML works almost everywhere, to the extent that your HTML uses
client-side JScript, reach is diminished for browsers that don't support the scripting constructs
being used. Even further down the reach scale are A ctiveX controls, which work only on
Windows but allow full access to its richness.[2]
[2] At one point, the Component Object Model (COM) and ActiveXwere made to work
across platforms, but they have long since been relegated to Windows only.
A t the other extreme we have WP F, a completely new managed framework built on top of
DirectX. WP F encompasses documents, layout, animation, 2-D, 3-D, text, and graphics
primitives in a single, cohesive whole. This framework provides the richest client technology
that Microsoft has ever built, and it takes maximum advantage of the platform on which it runs,
including any hardware 3-D graphics acceleration that may be available. However, at the time
of this writing, WP F has not yet shipped and works only under Windows XP, Windows Server
2003, and Windows V ista.[3]
[3] WinFX(which inclues WPF) and Windows Vista are scheduled to ship in 2006.
Where does that leave Windows Forms 2.0? It doesn't quite offer the richness of WP F, but it's
far richer than the HTML-based technologies. Windows Forms 2.0 also is much richer than
Windows Forms 1.0, with greatly enhanced support for flexible layout, modern menu strip and
23 / 664
tool strip controls, data binding, multithreading, typed resources and settings, and, most
importantly, ClickO nce deployment.
With ClickO nce, for the first time, users can deploy Windows applications as easily as web
applications. Even better, ClickO nce allows Windows applications to be installed locally,
integrated with the Start menu, and accessed even if no network connection is available. These
options are not available for users of Web applications.
So Windows Forms 2.0 is high on the richness scale, but what about the reach scale? Unlike
web applications, Windows Forms requires that users' machines operate on Windows,
specifically Windows 98 or later for P Cs. However, it also supports other devices, such as
Pocket P Cs or Smartphones, via the .NET Compact Framework. This means that you can write
a Windows Forms 2.0 application and run it on your Windows smartphone.
Based on this level of richness and reach, what kinds of applications should you build with
Windows Forms? A s it turns out, folks have used Windows Forms to build almost every kind of
application, including productivity applications, utilities, enterprise tools, and more (even
games). Windows Forms can be used to build smaller things, such as Microsoft's own internal
human resources application (called HeadTrax), or larger things, such as most of the UI
enhancements that have been built on top of V isual Studio since the 2002 edition. This range
of applications can be built because of Windows Forms' range of features and tools, its reach,
and, as of this version, the maturity of the implementation based on community usage and
feedback.
In fact, the .NET developer community has embraced Windows Forms to a degree that defies
the early .NET focus on web-based applications. Based on talking to my friends in the training
industry and on the sales of the first edition of this book, I conclude that a large and growing
number of developers write Windows Forms applications. It's for those developers that we've
written this book.
W ho Should Read This Book?
When writing this book, we wanted to provide real-world Windows Forms coverage for
programmers who've programmed in .NET (and those who haven't). To that end, we briefly
introduce core .NET topics as they come up. However, we don't pretend to cover the .NET
Framework completely. It's too large a topic. Instead, when we think more information would be
useful, we reference another work that provides the full details. In particular, you'll find that
we've referenced Essential .NET, by Don Box, with Chris Sells, a great deal, making it a good
companion to this book. In the same category, we also recommend Advanced .NET Remoting, by
Ingo Rammer, and Applied Microsoft .NET Framework Programming, by Jeffrey Richter. (For
more details on these books, see the Bibliography.)
O ne core .NET topic is of special importance to Windows Forms programmers, and we cover it in
more detail in A ppendix C: Delegates and Events. This coverage is particularly important if
you're new to .NET, although we don't recommend diving into that topic until you've got a
Windows Forms-specific frame of reference (which is provided about one-third of the way
through Chapter 1: Hello, Windows Forms).
A lso of particular importance to former (or soon-to-be former) MFC programmers, we've
provided A ppendix B: Moving from MFC, and A ppendix F: Document Management. A lthough
24 / 664
Windows Forms doesn't provide all the features of MFC, we've worked hard on the material and
code samples in this book to plug most of the gaps.
O ne other note: Many years ago, one of the authors wrote his first five-day training course.
The topic, Windows 95, 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 like days for everyone involved. The details of a particular control
are interesting only when you're putting it to use, and when that time comes, the controlspecific documentation and V isual Studio's IntelliSense help support do a marvelous job of
giving you the information you need.
To that end, this book covers none of the standard controls completely. Instead, when a control
is interesting in the context of the current topic (such as the DataGridV iew control in Chapter
17: A pplied Data Binding) we cover that control appropriately. A lso, to give you a list of all the
components and controls and to introduce you to each one's major functionality, A ppendix D:
Component and Control Survey provides a list of the standard controls and components. We
wouldn't think of wasting your time by attempting to be more thorough than the reference
documentation that comes with the .NET Framework software development kit (SDK) and V isual
Studio 2005. Instead, this book focuses on the real-world scenarios that aren't covered in detail
elsewhere. Finally, to help you understand the differences between components and controls
and how to build both, we've provided Chapter 9: Components and Chapter 10: Controls.
Conventions
If you've decided to take the plunge with this book, we'd like to thank you for your faith and
express our hope that we live up to it. To aid you in reading the text, we want to let you in on
some conventions we use.
First, there is the mode of address that we use throughout the book (except for this preface).
Because Chris and Michael worked so closely and so hard on every word in this book, the use
of "I" really means "both authors," whereas the use of "we" means "the authors and you." A
lthough we sometimes use "you" directly, Michael and Chris lean toward the inclusive.
The wonderful thing about Windows Forms is how visual it is, and that's why we use a lot of
figures to illustrate its features. Some of those pictures really need to be in color to make the
point, so be sure to check the color pages at the center of this book for those color plates.
A s useful as figures are, we both think primarily in code. Code is shown in monospace type:
25 / 664
System.Console.WriteLine("
Hello, Windows Forms.");
Console application activation is also shown in monospace type:
C:\> csc.exe
hello.cs
When a part of a code s