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
Trang 1By 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
Table of Contents | Index
"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."
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
Fritz Onion, cofounder of Pluralsight, author of Essential ASP.NET, and ASP.NET MVP
Trang 2"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 All of us who found the first edition of this book to be an indispensible part of our reference library will appreciate this updated edition that describes WinForms 2.0."
Johan Ericsson, Software Engineer, Agilent Technologies
"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."
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-DPI scaling
• Office 2003-style tool strip control coverage, including dynamic layout and custom rendering
• Design-time integration with the Visual Studio 2005 Properties Window and Smart Tags
Trang 3considerations
• Strongly typed application and user settings
centric, and document-centric applications
• SDI, MDI, Single Instancing, Multiple-Instance SDI, Single-Instance MDI, database- • Databinding data-source management, drag-and-drop databinding, the BindingSource, the BindingNavigator, and applied databinding
• Events, delegates, multithreaded UIs, long-running operations, simplified
multithreading with the BackgroundWorker, and asynchronous web service calls
• ClickOnce application development publishing, shell integration, and partial trust security
• Best practices for developers transitioning from Windows Forms 1.0 and MFC
Trang 4
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
Trang 10Many of the designations used by manufacturers and sellers todistinguish their products are claimed as trademarks Wherethose designations appear in this book, and the publisher wasaware of a trademark claim, the designations have been printedwith initial capital letters or in all capitals
The NET logo is either a registered trademark or trademark ofMicrosoft 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 Versioning Models in the WindowsForms Engine Help You Create and Deploy Smart Clients" by
Chris Sells, MSDN Magazine, July 2002 "Visual Studio NET:
Building Windows Forms Controls and Components with RichDesign-Time Features" by Michael Weinhardt and Chris Sells,
MSDN Magazine, April 2003 "Visual Studio NET: Building
Time Features, Part 2" by Michael Weinhardt and Chris Sells,
Trang 11The publisher offers excellent discounts on this book whenordered in quantity for bulk purchases or special sales, whichmay include electronic versions and/or custom covers andcontent particular to your business, training goals, marketingfocus, and branding interests For more information, pleasecontact:
publication is protected by copyright, and permission must beobtained from the publisher prior to any prohibited
reproduction, storage in a retrieval system, or transmission in
Trang 12photocopying, recording, or likewise For information regardingpermissions, write to:
"Some books are differentthe 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 And it's not a simple upgrade of the1st edition; this book has been completely refitted to
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 areeasily consumed You cannot survive building a complexWinForms application without this book."
Trang 13fundamentals all Winforms developers need to know
Whether you're an experienced WinForms developer orjust beginning, you need this book."
Fritz Onion, cofounder of Pluralsight, author of Essential
ASP.NET, and ASP.NET MVP
"I don't want just a description of the WinForms widgets Ican get that online or from other books What I want is aroadmap for pitfalls to avoid, and innovative solutions forcommon problems That is where this book shines All of
us who found the first edition of this book to be an
indispensible part of our reference library will appreciatethis updated edition that describes WinForms 2.0."
Johan Ericsson, Software Engineer, Agilent Technologies
"The books Chris Sells writes are always insightful and thisnewest addition is no different This book in particular isfor 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 theirdesks, 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
Trang 14Forms."
Jessica Fosler, Dev Tech Lead, Microsoft
"This book is the 'must have' teaching and reference bookfor WinForms 2.0."
Jim Rittenhouse, Senior Software Engineer, Siemens
Dedication
To my wife, Melissa, and my sons John and Tom They define the heaven that exceeds my grasp And to my
parents, who made me a reader from the beginning and who passed on the secret writer gene, much to my
surprise.
Chris Sells
To Josef and Lili, for all that I am and all that I've done.
To Alex, for all that I would like to be and wish I could do Michael Weinhardt
Trang 15to write effective applications and managed code Learn fromthe leaders how to maximize your use of the NET Frameworkand its programming languages.
Trang 16Brad Abrams, NET Framework Standard Library Annotated
Reference Volume 1: Base Class Library and Extended Numerics Library, 0-321-15489-4
Brad Abrams and Tamara Abrams, NET Framework Standard
Library Annotated Reference, Volume 2: Networking Library, Reflection Library, and XML Library, 0-321-19445-4
Trang 19Chris Sells is a program manager for the Connected Systems
Division He's written several books, including Programming
Windows Presentation Foundation (O'Reilly), Windows Forms Programming in C# (Addison-Wesley), and ATL Internals
(Addison-Wesley) In his free time, Chris hosts various
conferences and makes a pest of himself on Microsoft internalproduct team discussion lists More information about Chrisandhis various projectsis available at http://www.sellsbrothers.com
Michael Weinhardt is a programmer/writer at Microsoft,
working on the Windows Client SDK Michael has coauthored avariety of articles with Chris, contributed to the "Wonders ofWindows Forms" column at MSDN Online, reviewed several
Windows technology books, and generally loves communicatingthe whys and wherefores of technology to his peers Michael issure that his parents attribute his fascination in technology totheir purchase of an Amiga 1000 in the mid-80s They would beright
Trang 20A long, long time ago when I began programming PC GUIs,
there were none of these fancy framework thingies One wrote
a whole lot of C code in a case statement long enough to cut agiant'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 mostpleasant experience) when I ran across an article in a magazineshowing 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 onWindows Forms at Microsoft
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 supportingcore business processes I find seeing the interesting
applications people build with Windows Forms one of the morerewarding parts of my job However, to be honest, there areareas where we could have done betterfor example, NTD had
no Visual Studio support and could be complex to debug whenthings went wrongso overall, I have to give V1 of Windows
Forms a "shows promise" rating
V2 of Windows Forms is about delivering on that promise This
is a major upgrade to Windows Forms Almost every area of
Trang 21Windows Forms 2.0, we have incorporated completely new
features and a large number of improvements to our existingfeatures (apparently we have 329 new types, 139 updated
types, and 14,323 new members) Rather than repeat Appendix
A, I'm going to call out three new features that I think illustratehow we achieved our goals for this version of Windows Forms:solve deployment, enable great-looking apps, and enhance
through a wizard in Visual Studio 2005
Great-Looking Apps
Ever since I joined Microsoft, customers have asked for the
ability to build applications that look like Microsoft Office "out ofthe box," and you can do exactly that with V2 of Windows
Forms using the new menu strip, tool strip, and status strip
controlsToolStrip, MenuStrip, and StatusStrip Not only do thestrip controls support the standard Windows and Office look andfeel, but they can also be customized to look like pretty muchanything you fancy
Productivity
We've added a whole set of design-time and run-time
Trang 22productive One of my favorite new designer features is
SnapLines, which allows you to quickly align controls with eachother as you lay out your forms Once you've used a designerwith SnapLines, you never want to go backit's the designer
equivalent of IntelliSense
The Future
After shipping V2, our thoughts are naturally turning to the
future Predicting the future is a dangerous businessmost of thepredictions from when I was a kid mean we should be
supporting actors in either The Jetsons or 1984 by nowand so
I'm a little nervous about making any long-term predictions.However, I can say a few things based on where we are andwhat I would like to see us do First, the NET Framework andmanaged code is here to stay: It is the programming model ofthe present and the future Learning to use the NET Frameworkand Windows Forms is a solid investment for the future
Second, to paraphrase Samuel Clemens terribly, "Reports of thedeath of client apps are greatly exaggerated." Client
applications are here to stay, can now be deployed as easily asweb applications, provide significant business value, and willprovide more value as time progresses Third, as part of ourcontinued investment in Windows Forms, we will ensure thatWindows Forms works well with new technologies coming downthe pipe such as those in WinFX This allows you to build
applications today with the knowledge that you will be able toenhance those applications in the future using both WindowsForms and these new technologies as they become available.Finally, from a Windows Forms perspective, I believe we need tobroaden what we provide into a framework and design
experience that addresses the end-to-end process of building aclient application We have a great designer to help you buildyour UI, but you still have to write way too much code to buildyour whole application I would like to see us provide a great
Trang 23So hopefully what I've said about Windows Forms has got you
at least a little curious to find out morewhich is where this bookcomes in The first edition of this book was a great overview ofand introduction to Windows Forms The same is true of thissecond edition Whether you are learning Windows Forms forthe first time or if you just want to get a handle on the newstuff we've done in V2, this book will help you It covers all ofthe significant feature areas, from the basics of creating Forms,through ToolStrips and data binding to deployment with
ClickOnce
The book is a great balancing act: It neither ignores Visual
Studio 2005 nor reduces itself to a simplistic "Click here thenclick here" walkthrough of Visual Studio 2005 features The
book not only explains the concepts and shows you how to usethose concepts in code, but it also shows you how the designerhelps you to be more productive by automatically generatingthe code for you This leaves you with a solid understanding ofboth how things work and how to use Visual Studio 2005 to getthings done as productively as possible The chapters on databinding (16 and 17) are a great example of this approach Thesource code examples are another great balancing act: Theyare neither too short to be useful nor so long as to be
overwhelming To quote Alan 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 isvery close to my heart, but because the book does an excellentjob of explaining how data binding works and how to use it
effectively I would also like to highlight the chapters on writingdesign-time behavior for your controls and components
(Chapters 11 and 12) because this is a subject that is oftenneglected These chapters alone make this a "must read" book
Trang 24to effectively use what we provide as part of Windows Formsbut also with the understanding you need to write your ownrun-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 workedtirelessly to build and ship what I believe is a great product I'mvery proud of what we have achieved Second, my thanks toMichael and Chris not only for producing a book that does a
great job of explaining our product and will make it easier forour 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
V2particularly his feedback on the ToolStrip controls Thanks toChris for his seemingly boundless enthusiasm for Windows
Forms, his excellent writing on Windows Forms, his deep
understanding of Windows Forms, MFC, and Windows, and hispolite and measured but enthusiastic and copious feedback onevery aspect of the product Both Mike and Chris have helpedenormously both in promoting understanding of the product and
in helping make Windows Forms as good as it is today And
finally, my thanks to our customers: Every single feature in
Windows Forms V2 is based on your feedback So to all of youwho took the time to give us feedback and suggestions:
Trang 25Windows 1.0 programmers had a straightforward life They hadalmost no choices about how to do things; either there was anapplication programming interface (API), or there wasn't, andmost of the time there wasn't This meant that developers had
to build almost everything by hand At the time, this wasn't aproblem All Windows programmers had the same limitations,
so everyone's apps more or less operated with the same limitedset of functionality
A modern Windows developer, on the other hand, is inundatedwith choices The invention of the web alone gives us static
Hypertext Markup Language (HTML), server-based user
interface (UI) interaction via ASP.NET, and client-side UI
interaction via ActiveX controls or AJAX (to name a few).[1] Onthe client side, we have native frameworks like Microsoft
Foundation Classes (MFC), Active Template Library (ATL), andthe next-generation managed framework known as the
Windows Presentation Foundation (WPF is part of WinFX, thefollow-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] AJAX stands 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 andrichness 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 theoperating system on which it runs So even though static HTMLworks almost everywhere, to the extent that your HTML usesclient-side JScript, reach is diminished for browsers that don'tsupport the scripting constructs being used Even further down
Trang 26primitives in a single, cohesive whole This framework providesthe richest client technology that Microsoft has ever built, and ittakes maximum advantage of the platform on which it runs,including any hardware 3-D graphics acceleration that may beavailable However, at the time of this writing, WPF has not yetshipped and works only under Windows XP, Windows Server
2003, and Windows Vista.[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 quiteoffer the richness of WPF, but it's far richer than the HTML-
based technologies Windows Forms 2.0 also is much richerthan Windows Forms 1.0, with greatly enhanced support forflexible layout, modern menu strip and tool strip controls, databinding, multithreading, typed resources and settings, and,
most importantly, ClickOnce deployment
With ClickOnce, for the first time, users can deploy Windowsapplications as easily as web applications Even better,
ClickOnce 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 availablefor users of Web applications
So Windows Forms 2.0 is high on the richness scale, but whatabout the reach scale? Unlike web applications, Windows Formsrequires that users' machines operate on Windows, specifically
Trang 27Compact Framework This means that you can write a WindowsForms 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? As it turnsout, folks have used Windows Forms to build almost every kind
of application, including productivity applications, utilities,
enterprise tools, and moreeven games Windows Forms can beused to build smaller things, such as Microsoft's own internalhuman resources application (called HeadTrax), or larger things,such as most of the UI enhancements that have been built ontop of Visual Studio since the 2002 edition This range of
applications can be built because of Windows Forms' range offeatures and tools, its reach, and, as of this version, the
maturity of the implementation based on community usage andfeedback
In fact, the NET developer community has embraced WindowsForms 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 developerswrite Windows Forms applications It's for those developers thatwe've written this book
Who Should Read This Book?
When writing this book, we wanted to provide real-world
Windows Forms coverage for programmers who've programmed
in NETand those who haven't To that end, we briefly introducecore NET topics as they come up However, we don't pretend tocover the NET Framework completely It's too large a topic.Instead, when we think more information would be useful, wereference another work that provides the full details In
particular, you'll find that we've referenced Essential NET, by
Trang 28Also of particular importance to former (or soon-to-be former)MFC programmers, we've provided Appendix B: Moving fromMFC, and Appendix F: Document Management Although
Windows Forms doesn't provide all the features of MFC, we'veworked hard on the material and code samples in this book toplug most of the gaps
One other note: Many years ago, one of the authors wrote hisfirst five-day training course The topic, Windows 95, included afew hours of coverage on the new controls: what they lookedlike, 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 thattime comes, the control-specific documentation and Visual
Studio's IntelliSense help support do a marvelous job of givingyou 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 topicsuch as the DataGridView control in Chapter
17: Applied Data Bindingwe cover that control appropriately.Also, to give you a list of all the components and controls and tointroduce you to each one's major functionality, Appendix D:
Trang 29Conventions
If you've decided to take the plunge with this book, we'd like tothank 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 someconventions we use
First, there is the mode of address that we use throughout thebook (except for this preface) Because Chris and Michael
worked so closely and so hard on every word in this book, theuse of "I" really means "both authors," whereas the use of "we"means "the authors and you." Although 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 thepoint, so be sure to check the color pages at the center of thisbook for those color plates
As useful as figures are, we both think primarily in code Code
is shown in monospace type:
System.Console.WriteLine("Hello, Windows Forms.");
Trang 30// Shortened "System.Windows.Forms.Form" base class
class MyForm : Form {
// fields
Trang 31// Removed "private" specifier and "System.ComponentModel" namespace void MyForm_Load(object sender, EventArgs e) {
Trang 32Contact
The up-to-date information for this book, including the sourcecode and the errata, are maintained at
http://www.sellsbrothers.com/writing/wfbook This site also letsyou send feedback about the book, both complimentary andless so
Michael's Acknowledgments
Writing a book is not just the application of pen to paper, nor isits creation confined to the authors Whether they know it ornot, many people have helped make this book what it is
My parents, Josef and Lili: Without a doubt, I could not haveseen this book through to the end if it weren't for the
immeasurable and unquestioning love and support of my
parents They've been there for me in this way since the day Iwas born, which I find truly staggering How can I thank themenough? I simply cannot Instead, I try and do the best I can bymaking the most out of the life they've provided For this
reason, I put everything I had into this book
My brother, Alex: When he applied to attend a university, hedefinitely met the entry requirements However, he was told bythe university that he shouldn't bother because it would be veryunlikely he would complete his studies successfully Of course,they were very wrong When I endure some of the darker
moments in writing and want to throw it all away, I think of all
he has accomplished in his life Then I very quickly realize thatwriting so completely pales in comparison, before pulling myhead in and keeping on writing He is a big inspiration in mylife, and he helped me to stay the course on this book I
thought he should know
Trang 33I instantly think of them
"Mr Windows Forms," Mark Boulter: Even though I've nevermet Mark in the physical world, he has played a huge role infueling my passion for Windows Forms and the desire to tell itsstory I'd always hoped that he would write the foreword for thisbook, and I am honored he did
My safety net, Microsoft's Jessica Fosler: When I had technicaland conceptual questions that often needed quick responses,Jessica always provided articulate, comprehensive, and promptanswers, for which I am very grateful And, as if that weren'tenough, Jessica made time to review our entire book, providethorough and positive commentary, and, for good measure,
threw in some great prose
Our main reviewer, Christophe Nasarre: Christophe performedtwo reviews in a very limited time It is almost scary how good
Ellis, Shawn Farkas, David Guyer, Mike Harsh, Zach Kramer,Steve Lasker, Elizabeth Maher, Chris Meyer, Mark Rideout, and
Trang 34conceptual commentary that dramatically improved the quality
of the end result
Our user reviewers, William Bartholomew, Ron Green, Kym
Phillpotts, and Fumiaki Yoshimatsu: No technology book can bereleased without reviews from people who will actually use thetechnology and will lean on our book to learn about it From thisperspective, these guys provided valuable insight that nicelyjuxtaposed the more technical focus provided by the
Microsofties
Betsy Hardinger, Grammar Guru Extraordinaire: Betsy, as Chrislikes to call her, is a grammar geek She loves what she does.She's incredible at what she does She's funny She puts Strunkand White to shame
And, last but not least, Addison-Wesley: This is my first
experience with a technical book publisher, and it was a greatone The editors pretty much let us tell the story the way wewanted, always making sure we had what we needed and neverpressuring us Thanks!
Chris's Acknowledgments
Although this book is dedicated to my family, I'd also like toacknowledge them here I work from my home, and in
completing the book I often had to spend a great deal of extratime to get the thing out the door My wife, Melissa, is alwaysenormously understanding when I have a deadline and gives
me the space I need to meet it Also, I tend to leave my officedoor open because I like my family, and often my boys, Johnand Tom, will come in to talk to me about their day Even
though they're only eleven and ten, respectively, they're
Trang 35is me if I overpromise and underdeliver to those two, I'll tellyou)
Although my family gave me the space to write, this book wouldnot be what it is without the efforts of my coauthor Michael
dedicated most of two years to this book Michael's job was
primarily to update the chapters based on the additions andchanges in Windows Forms 2.0, but he did far more than that.His efforts in re-evaluating each and every part of the story andhis willingness to try new ways to present information produced
a far better book than the first edition You should keep an eyeout for Michael's future writings He's definitely one of the goodones
I also need to give special thanks to Mark Boulter for having apositive influence both on the Windows Forms technology and
on my understanding of it, and also for writing our foreword Hedoesn't consider himself a writer, so I literally had to call himand beg for his participation after he told me "no," but I
couldn't imagine anyone else I'd want to do it
Special attention needs to be paid to any book's reviewers
Without the reviewers, authors might think that when they'vewritten prose that covers a topic, they're actually finished Oh,hated reviews, which correct this assumption, and sweet
reviewers, who make sure our readers aren't tortured with
inaccurate or unreadable prose and uncompiling code Our
grand inquisitor was Christophe Nasarre, who flayed us so
thoroughly in our first round of reviews that we asked him to bethe sole reviewer in the second round Christophe is such a
wonderful reviewer that he's always busy with reviews, but hewas able to squeeze us into an extremely short period while stillfinding things I'm embarrassed to have written in the first
place Thanks, Christophe! This book is immeasurably betterbecause of your efforts
Trang 36Microsoft, including Ryan Dorrell, Kym Phillpotts, Fumiaki
Yoshimatsu, Ron Green, and William Bartholomew Externalreviewers are particularly important because they're not
steeped in the internal history of Windows Forms, and they
represent our target audience Thanks, guys!
On the other hand, this book represents not only Mike's and mywork with Windows Forms, but also a large number of Microsoftemployees who took the time to review our chapters in theirareas of expertise and make sure we weren't missing the
important things This group includes Joe Stegman, Steve
Lasker, Andrew Coates, Chris Meyer, Elizabeth Maher, David
Guyer, Jessica Fosler, Sameer Bhangar, Felix Cheung, Mark
Rideout, Shreeman Dash, Shawn Farkas, Erick Ellis, Mike Harsh,Jamie Cool, Zach Kramer, and Barry Briggs Of special note areSteve Lasker, who gave us especially deep feedback on the databinding chapters on very short notice, and Jessica Fosler, whowas our final authority on a huge range of topics Michael and Itried very hard to make sure that we didn't slaughter the story
of your technology; thanks for all the details we couldn't havefound any other way
as well as inspired me to dig ever deeper
Wesley In increasingly tight times, they still manage to provide
Last but not least, I'd like to thank the fine folks at Addison-me an environment where I can write what I think best Specialthanks go to Betsy Hardinger: copy editor, frustrated fictionauthor, kindred spirit, and hyphen mentor In addition to turning
my prose into English, she also managed to catch technical
inconsistencies that hard-core developers missed Thanks,
Trang 37These folks, along with a bunch I'm sure I've missed, havehelped shape everything good that comes through in this book.The errors that remain are our own
Trang 38As easy to use as Windows Forms is, the sheer amount of
functionality it provides can make it intimidatingespecially whencombined with the huge number of features in Visual Studio
2005 (VS05) solely for the purpose of building Windows Formscode This chapter takes a quick look at Windows Forms,
including forms, controls, application settings, resources,
dialogs, drawing, printing, data binding, threading, and evendeployment over the web We also look at how the VS05
integrated development environment (IDE) facilitates WindowsForms development The remaining chapters will stuff you full,providing the sumptuous details of these topics, but in this
chapter, you'll get your first taste
Trang 39
}
Trang 40application.[2] The Main method must be a member of a class,and hence the need for MyFirstApp However, the NET runtimedoesn't create an instance of the MyFirstApp class when ourcode is loaded and executed, so our Main method must be
separation is necessary when you have thousands of Microsoftemployees working on the NET Framework, hundreds of thirdparties extending it, and millions of programmers trying to learn