Windows Forms Programming in C#
by Chris Sells
2020-05-15 11:23:10
Windows Forms Programming in C#
by Chris Sells
2020-05-15 11:23:10
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...
Read more
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 and 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. Toward
Less