Sample Content from Programming Microsoft Windows Forms

Total Page:16

File Type:pdf, Size:1020Kb

Sample Content from Programming Microsoft Windows Forms Programming Microsoft® Windows® Forms Charles Petzold To learn more about this book, visit Microsoft Learning at http://www.microsoft.com/MSPress/books/7824.aspx 9780735621534 Publication Date: November 2005 A04T621535.fm Page v Friday, September 30, 2005 10:18 AM Table of Contents Introduction. xi Your Background and Needs . .xi Organization of This Book . xii System Requirements. xiii Prerelease Software . xiii Technology Updates. .xiii Code Samples . .xiv Support for This Book . xiv Questions and Comments . .xiv The Author’s Web Site . .xiv Special Thanks. xv 1 Creating Applications . 1 Orientation . 1 Programming Tools . 2 The Docs . 3 Development . 5 The Littlest Programs . 5 Visual Studio Projects. 6 References . 8 From Console to Windows . 9 Fixing the Flaws . 11 Events and Event Handlers . 13 Inheriting from Form . 16 Properties and Events in Visual Studio . 19 Children of the Form . 22 Subclassing Controls . 26 Device-Independent Coding . 29 Assembly Information . 33 Dialog Boxes . 34 DLLs . .44 What do you think of this book? Microsoft is interested in hearing your feedback about this publication so we can continually improve our books and learning resources for you. To participate in a brief We want to hear from you! online survey, please visit: www.microsoft.com/learning/booksurvey/ v A04T621535.fm Page vi Friday, September 30, 2005 10:18 AM vi Table of Contents 2 The Control Cornucopia . 47 Controls in General . 48 Parents and Children . 48 Visibility and Response . 50 Location and Size . 51 Fonts and Color . 52 Keeping Track of Controls . 53 Image Lists . 54 ToolTips . 54 Static (and Not Quite so Static) Controls . 55 GroupBox . 55 Label . 56 LinkLabel . 56 PictureBox . 59 ProgressBar . 60 Push Buttons and Toggles . 60 Button . 61 CheckBox . 61 RadioButton . 62 Scroll Bars . 64 Horizontal and Vertical Scrolls. 65 Track Bars . 67 Text-Editing Controls . 67 MaskedTextBox . 69 TextBox . 69 RichTextBox . 69 List and Combo Boxes . 70 ListBox . 71 CheckedListBox . 73 ComboBox . 74 Up/Down Controls . 75 NumericUpDown . 75 DomainUpDown . 76 Dates and Times. ..
Recommended publications
  • The Hidden Language of Computer Hardware and Software Charles
    The Hidden Language of Computer Hardware and Software Charles Petzold тайный язык информатики Чарльз Петцольд Москва 2001 г. УДК 004 ÁÁÊ 32.973.26–018 Ï33 Петцольд Ч. Ï33 Êод. — М.: Издательско-торговый дом «Русская Редакция», 2001. — 512 с.: ил. ISBN 5–7502–0159–7 Эта книга — азбука компьютерных техноëогий. Шаг за ша- ãом автор знакомит читателя с сущностью кодирования информа- ции, рассказывает об истории возникновения компьютеров, на практических примерах помогает освоить основные концепции ин- формационных техноëогий, подробно излагает принципы рабо- ты процессора и других устройств компьютера. Написанная живо, доступно, иногда иронично, книга богато иллюстрирована, состоит из 25 глав и предметного указателя. Издание адресовано в первую очередь студентам вузов (как гуманитарных, так и технических), а также всем, кто интересует- ся принципами создания и работы компьютеров. УДК 004 ÁÁÊ 32.973.26–018 Ïодãотовлено к печати по лицензионному доãовору с Microsoft Corporation, Редмонд, Вашингтон, США. Использованные в примерах и упражнениях названия компаний и продуктов, персо- нажи и события вымышлены, за исключением особо отмеченных случаев. Любые со- впадения с реальными компаниями, продуктами, людьми и событиями являются слу- чайными. Портреты Чарльза Бэббиджа, Джорджа Буля, Луи Брайля, Германа Холлерита, Сэмюэ- ля Морзе и Джона фон Неймана публикуются с разрешения Corbis Images и отредак- тированы для этой книги Джоэлем Пэнчотом (Joel Panchot). Обложка журнала Popular Electronics (январь 1975 г.) воспроизводится с разрешения Ziff-Davis и семьи Ziff. Все остальные иллюстрации подãотовлены Джоэлем Пэнчотом. Macintosh является охраняемым товарным знаком корпорации Apple Computer. Microsoft, MS-DOS è Windows являются либо товарными знаками, либо охраняемыми товарными знаками корпорации Microsoft в США и/или других странах. Все другие то- варные знаки являются собственностью соответствующих фирм.
    [Show full text]
  • NET Book Zero
    .NET Book Zero What the C or C++ Programmer Needs to Know about C# and the .NET Framework by Charles Petzold www.charlespetzold.com Version 1.1, January 1, 2007 © Charles Petzold, 2006-2007 .NET Book Zero Charles Petzold Table of Contents Chapter 1. Why This Book? ................................................................ 2 Chapter 2. Why .NET? ........................................................................ 5 Chapter 3. Runtimes and SDKs .......................................................... 7 Chapter 4. Edit, Compile, Run, Disassemble .................................... 11 Chapter 5. Strings and the Console .................................................. 22 Chapter 6. Primitive Data Types ....................................................... 51 Chapter 7. Operators and Expressions ............................................. 68 Chapter 8. Selection and Iteration .................................................... 75 Chapter 9. The Stack and the Heap .................................................. 83 Chapter 10. Arrays ........................................................................... 88 Chapter 11. Methods and Fields ....................................................... 95 Chapter 12. Exception Handling ......................................................108 Chapter 13. Classes, Structures, and Objects ..................................117 Chapter 14. Instance Methods .........................................................126 Chapter 15. Constructors ................................................................135
    [Show full text]
  • Read a Sample
    Code Nation explores the rise of software development as a social, cultural, and technical phenomenon in American history. The movement germinated in government and university labs during the 1950s, gained momentum through corporate and counterculture experiments in the 1960s and 1970s, and became a broad-based computer literacy movement in the 1980s. As personal computing came to the fore, learning to program was transformed by a groundswell of popular enthusiasm, exciting new platforms, and an array of commercial practices that have been further amplified by distributed computing and the Internet. The resulting society can be depicted as a “Code Nation”—a globally- connected world that is saturated with computer technology and enchanted by software and its creation. Code Nation is a new history of personal computing that emphasizes the technical and business challenges that software developers faced when building applications for CP/M, MS-DOS, UNIX, Microsoft Windows, the Apple Macintosh, and other emerging platforms. It is a popular history of computing that explores the experiences of novice computer users, tinkerers, hackers, and power users, as well as the ideals and aspirations of leading computer scientists, engineers, educators, and entrepreneurs. Computer book and magazine publishers also played important, if overlooked, roles in the diffusion of new technical skills, and this book highlights their creative work and influence. Code Nation offers a “behind-the-scenes” look at application and operating-system programming practices, the diversity of historic computer languages, the rise of user communities, early attempts to market PC software, and the origins of “enterprise” computing systems. Code samples and over 80 historic photographs support the text.
    [Show full text]
  • DISTRIBUTED APPS CUTTING EDGE Action Filters in ASP.NET MVC Appfabric Service Bus Discovery Dino Esposito Page 6 Juval Lowy
    THE MICROSOFT JOURNAL FOR DEVELOPERS OCTOBER 2010 VOL 25 NO 10 COLUMNS DISTRIBUTED APPS CUTTING EDGE Action Filters in ASP.NET MVC AppFabric Service Bus Discovery Dino Esposito page 6 Juval Lowy . 30 DATA POINTS Runtime Data Sharing Through an Entity Framework Preview: Code First, ObjectSet and DbContext Enterprise Distributed Cache Julie Lerman page 14 Iqbal Khan . 42 CLR INSIDE OUT New Features and Improved Building a Real-Time Transit Application Performance in Silverlight 4 Using the Bing Map App SDK Justin Van Patten and Luan Nguyen . 50 Andrew Pardoe page 20 FORECAST: CLOUDY Connected Devices Using the .NET Micro Framework Performance-Based Scaling Colin Miller . 60 in Windows Azure Joseph Fultz page 86 THE WORKING PROGRAMMER PLUS: Multiparadigmatic .NET, Part 2 Getting Started with Windows Ted Neward page 91 UI FRONTIERS Phone Development Tools Multi-Touch Inertia Joshua Partlow . 70 Charles Petzold page 95 Scalable Multithreaded Programming DON’T GET ME STARTED Devs and Designers with Thread Pools Should Be Friends Ron Fosner . 80 David Platt page 100 Untitled-5 2 3/5/10 10:16 AM Sure, Visual Studio 2010 has a lot of great functionality— we’re excited that it’s only making our User Interface components even better! We’re here to help you go beyond what Visual Studio 2010 gives you so you can create Killer Apps quickly, easily and without breaking a sweat! Go to infragistics.com/beyondthebox today to expand your toolbox with the fastest, best-performing and most powerful UI controls available. You’ll be surprised by your own strength! Infragistics Sales 800 231 8588 Infragistics Europe Sales +44 (0) 800 298 9055 Infragistics India +91-80-6785-1111 twitter.com/infragistics Copyright 1996-2010 Infragistics, Inc.
    [Show full text]
  • MCTS Self-Paced Training Kit (Exam 70-536)
    ● ● ● ● ● ● ● ● ● ● ● How to access your CD files The print edition of this book includes a CD. To access the CD files, go to http://aka.ms/626195/files, and look for the Downloads tab. Note: Use a desktop web browser, as files may not be accessible from all ereader devices. Questions? Please contact: [email protected] Microsoft Press Additional Resources for Developers from Microsoft Press ® ® Published and Forthcoming Titles on Microsoft Visual Studio Visual Basic Programming Microsoft Data Access Inside Microsoft Windows Visual C# 2008: Communication Foundation ® Microsoft Visual Basic 2008 The Language Microsoft ADO.NET 2.0 Justin Smith Step by Step Express Edition: Donis Marshall 978-0-7356-2306-4 Build a Program Now! 978-0-7356-2540-2 Rebecca M. Riordan Patrice Pelland 978-0-7356-2164-0 Other 978-0-7356-2541-9 Programming Microsoft Programming Microsoft Developer Topics Visual C# 2005: Microsoft Visual Basic 2008 The Language ADO.NET 2.0 Debugging Microsoft Step by Step Core Reference Donis Marshall .NET 2.0 Applications Michael Halvorson 978-0-7356-2181-7 David Sceppa John Robbins 978-0-7356-2537-2 978-0-7356-2206-7 978-0-7356-2202-9 Programming Microsoft Microsoft Visual Basic 2005 Visual C# 2005: Programming the Microsoft I. M. Wright’s “Hard Code” Step by Step The Base Class Library ADO.NET Entity Framework Eric Brechner Michael Halvorson Francesco Balena David Sceppa 978-0-7356-2435-1 978-0-7356-2131-2 978-0-7356-2308-8 978-0-7356-2529-7 The Practical Guide to ® Programming Windows CLR via C#, Programming Microsoft Defect
    [Show full text]
  • List of Programmers 1 List of Programmers
    List of programmers 1 List of programmers This list is incomplete. This is a list of programmers notable for their contributions to software, either as original author or architect, or for later additions. A • Michael Abrash - Popularized Mode X for DOS. This allows for faster video refresh and square pixels. • Scott Adams - one of earliest developers of CP/M and DOS games • Leonard Adleman - co-creator of RSA algorithm (the A in the name stands for Adleman), coined the term computer virus • Alfred Aho - co-creator of AWK (the A in the name stands for Aho), and main author of famous Dragon book • JJ Allaire - creator of ColdFusion Application Server, ColdFusion Markup Language • Paul Allen - Altair BASIC, Applesoft BASIC, co-founded Microsoft • Eric Allman - sendmail, syslog • Marc Andreessen - co-creator of Mosaic, co-founder of Netscape • Bill Atkinson - QuickDraw, HyperCard B • John Backus - FORTRAN, BNF • Richard Bartle - MUD, with Roy Trubshaw, creator of MUDs • Brian Behlendorf - Apache • Kent Beck - Created Extreme Programming and co-creator of JUnit • Donald Becker - Linux Ethernet drivers, Beowulf clustering • Doug Bell - Dungeon Master series of computer games • Fabrice Bellard - Creator of FFMPEG open codec library, QEMU virtualization tools • Tim Berners-Lee - inventor of World Wide Web • Daniel J. Bernstein - djbdns, qmail • Eric Bina - co-creator of Mosaic web browser • Marc Blank - co-creator of Zork • Joshua Bloch - core Java language designer, lead the Java collections framework project • Bert Bos - author of Argo web browser, co-author of Cascading Style Sheets • David Bradley - coder on the IBM PC project team who wrote the Control-Alt-Delete keyboard handler, embedded in all PC-compatible BIOSes • Andrew Braybrook - video games Paradroid and Uridium • Larry Breed - co-developer of APL\360 • Jack E.
    [Show full text]
  • The Hidden Language of Computer Hardware and Software
    The Hidden Language of Computer Hardware and Software Charles Petzold PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 2000 by Charles Petzold All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Library of Congress Cataloging-in-Publication Data Petzold, Charles, 1953– Code / Charles Petzold. p. cm. Includes index. ISBN 0-7356-0505-X -- ISBN 0-7356-1131-9 (paperback) 1. Computer programming. 2. Coding theory. I. Title. QA76.6 .P495 1999 005.7’2 21--dc21 99-040198 ISBN: 978-0-7356-1131-3 Printed and bound in the United States of America. 16 17 18 19 20 21 22 23 24 QG 7 6 5 4 3 2 Distributed in Canada by Penguin Books Canada Limited. A CIP catalogue record for this book is available from the British Library. Microsoft Press books are available through booksellers and distributors worldwide. For further information about international editions, contact your local Microsoft Corporation office or contact Microsoft Press International directly at fax (425) 936-7329. Visit our Web site at mspress.microsoft.com. Send comments to [email protected]. Macintosh is a registered trademark of Apple Computer, Inc. Microsoft, MS-DOS, and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Other product and company names mentioned herein may be the trademarks of their respective owners. Images of Charles Babbage, George Boole, Louis Braille, Herman Hollerith, Samuel Morse, and John von Neumann appear courtesy of Corbis Images and were modified for this book by Joel Panchot.
    [Show full text]
  • Rejected Books Report Title Author ISBN Violation Rejection Note
    Mission: To promote public Oregon Department of Corrections (ODOC) safety by holding offenders 04/11/2019 18:16 PM accountable for their actions and reducing the risk of future criminal behavior Rejected Books Report Title Author ISBN Violation Rejection Note $1 Prototype Greg Nudelman 9781503383708 Material that Threatens Material that Threatens Code 2.05 100 Deadly Skills Clint Emerson 9781476796055 Material that Threatens Material that Threatens Page #'s 14-18, 42-43, 74-75 Code 2.01, 2.07 100 Naked Girls Hegre 9780817452971 Sexually Explicit Material Sexually Explicit Material 12 Beast V3 9781626922617 Sexually Explicit Material Sexually Explicit Material Code 1.01, 1.02, 1.03, 1.05 120 Days Of Sodom, The MARQUIS DE SADE 9780141394343 Sexually Explicit Material Sexually Explicit Material Code 1.01, 1.02, 1.03 1980s Glamour 20th Century Pinups 9781906672652 Sexually Explicit Material Sexually Explicit Material 200 Classic Cartoons 4 Disc Set Any items which a inmate Any items which a shall not possess inmate shall not possess Code 2.08 4 DVD Set 2019 Premium Dated Planner Any items which a inmate Any items which a shall not possess inmate shall not possess Code 2.09 Wire bound day planner 25000 Years Of Ertoic Freedom 9780810948464 Sexually Explicit Material Sexually Explicit Material Page 1 of 148 Report Created on 04/11/2019 Title Author ISBN Violation Rejection Note 3 Dd A 3-D Celebration Of Breasts 9781934734803 Sexually Explicit Material Sexually Explicit Material 1C PP 9,13,16,26,27 THIS BOOK IS ON THE ORIGINAL VIOLATION LIST
    [Show full text]
  • The Hidden Language of Computer Hardware and Software Charles
    The Hidden Language of Computer Hardware and Software Charles Petzold PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 2000 by Charles Petzold All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Library of Congress Cataloging-in-Publication Data Petzold, Charles, 1953– Code / Charles Petzold. p. cm. ISBN 978-0-735-69260-2 -- ISBN 0-7356-1131-9 (paperback) 1. Computer programming. 2. Coding theory. I. Title. QA76.6 .P495 1999 005.7'2 21--dc21 99-040198 Printed and bound in the United States of America. 123456789 QWM543210 Distributed in Canada by Penguin Books Canada Limited. A CIP catalogue record for this book is available from the British Library. Microsoft Press books are available through booksellers and distributors worldwide. For further information about international editions, contact your local Microsoft Corporation office or contact Microsoft Press International directly at fax (425) 936-7329. Visit our Web site at mspress.microsoft.com. Send comments to [email protected]. Macintosh is a registered trademark of Apple Computer, Inc. Microsoft, MS-DOS, and Windows are either registered trademarks or trademarks of Microsoft Corpo- ration in the United States and/or other countries. Other product and company names mentioned herein may be the trademarks of their respective owners. Images of Charles Babbage, George Boole, Louis Braille, Herman Hollerith, Samuel Morse, and John von Neumann appear courtesy of Corbis Images and were modified for this book by Joel Panchot.
    [Show full text]
  • Programming Windows®, Sixth Edition
    Programming Windows ®, Sixth Edition Charles Petzold PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 2013 by Charles Petzold All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Library of Congress Control Number: 2012955549 ISBN: 978-0-7356-7176-8 Printed and bound in the United States of America. Second Printing Microsoft Press books are available through booksellers and distributors worldwide. If you need support related to this book, email Microsoft Press Book Support at [email protected]. Please tell us what you think of this book at http://www.microsoft.com/learning/booksurvey. Microsoft and the trademarks listed at http://www.microsoft.com/about/legal/en/us/IntellectualProperty/ Trademarks/EN-US.aspx are trademarks of the Microsoft group of companies. All other marks are property of their respective owners. The example companies, organizations, products, domain names, email addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, email address, logo, person, place, or event is intended or should be inferred. This book expresses the author’s views and opinions. The information contained in this book is provided without any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors
    [Show full text]
  • DATA in the CLOUD CUTTING EDGE Dynamic Action Filters Introducing Datamarket in ASP.NET MVC Elisa Flasko
    THE MICROSOFT JOURNAL FOR DEVELOPERS NOVEMBER 2010 VOL 25 NO 11 COLUMNS DATA IN THE CLOUD CUTTING EDGE Dynamic Action Filters Introducing DataMarket in ASP.NET MVC Elisa Flasko .............................................................................. 26 Dino Esposito page 6 Getting Started with SQL Azure Development FORECAST: CLOUDY SQL Azure and Windows Azure Lynn Langit ............................................................................. 30 Table Storage Joseph Fultz page 12 Synchronizing Multiple Nodes in Windows Azure DATA POINTS Joshua Twist ............................................................................ 40 Using the Entity Framework to Reduce Latency Connecting SharePoint to Windows Azure to SQL Azure with Silverlight Web Parts Julie Lerman page 23 Steve Fox ................................................................................ 50 TEST RUN Web UI Test Automation with the WebBrowser Control PLUS: James McCaffrey page 78 THE WORKING Scalable Multithreaded Programming with Tasks PROGRAMMER Ron Fosner .............................................................................. 58 Multiparadigmatic .NET, Part 3: Procedural Programming A Coder’s Guide to Writing API Documentation Ted Neward page 82 Peter Gruenbaum .................................................................... 70 SECURITY BRIEFS Web Application Confi guration Security Revisited Bryan Sullivan page 86 UI FRONTIERS The Intricacies of Touch Controls Charles Petzold page 92 DON’T GET ME STARTED A Real Pain in the Neck David Platt
    [Show full text]
  • EXTENDING DOS a Programmers's Guide to Protected-Mode DOS Second Edition
    EXTENDING DOS A Programmers's Guide to Protected-Mode DOS Second Edition Edited by Ray Duncan Ray Duncan Charles Petzold Andrew Schulman M. Steven Baker Ross P. Nelson Stephen R. Davis Robert Moote Addison-Wesley Publishing Company, Inc. Reading, Massachusetts Menlo Park, California New York Don Mills, Ontario Wokingham, England Amsterdam Bonn Sydney Singapore Tokyo Madrid San Juan Paris Seoul Milan Mexico City Taipei Chapter 1—Programming the IBM PC j By Ross P. Nelson DOS Lives -i The Quest for RAM 2 The IBM PC Architecture 5 A New Family Member 7 Solving Real Problems IQ Using Protected Mode 25 DOS Extenders 23 Intel's 32-bit Microprocessors 24 Operating Environments 3Q What About OS/2? 31 Choosing Your Market 32 Chapter 2—Expanded Memory and the EMS 35 By Ray Duncan Components of Expanded Memory 37 Obtaining Access to Expanded Memory 40 Using Expanded Memory 44 EMS Pitfalls for Drivers and TSRs 49 EMS Emulators 52 EMS Example Program 54 Chapter 3—Extended Memory and the XMS 75 By Ray Duncan Reaching Extended Memory in Real Mode 78 The ROM BIOS Extended Memory Functions 79 Primitive Extended Memory Management 85 The eXtended Memory Specification (XMS) EXTENDING DOS, Second Edition Programming Example: The XMSDISK.SYS Driver 96 XMS Example Program 97 LOADALL: The Back Door to Extended Memory 116 Chapter 4—16-bit Protected-Mode DOS Extenders 121 By Andrew Schulman 123 Isn't the 286 Outdated? 124 DOS: The Outer Limits Protected-Mode MS-DOS ^7 No More Overlays BigMalloc Protected-Mode C++ Creating the Illusion 143 INT 21h Isn't Enough 146 The RUN286 Loader 150 Compatibility 153 Debugging with CVP and TDW under DOS 159 Isn't There Any Work Involved? 162 Bugs! 164 Real-Mode Practices 173 Limits to Transparency 188 New Features 191 Benefits and Limitations 295 Chapter 5—32-bit Protected-Mode DOS Extenders By M.
    [Show full text]