Special Offers

Programming Microsoft® Windows® with Microsoft Visual Basic® .NET (Core Reference)
Author Charles Petzold
Pages 1344
Disk N/A
Level All Levels
Published 07/31/2002
ISBN 9780735617995
ISBN-10 0-7356-1799-6
Price(USD) $59.99
To see this book's discounted price, select a reseller below.

More Information

About the Book
Table of Contents
Sample Chapter
Companion Content
Related Series
Related Books
About the Author

Support: Book & CD

Rate this book
Barnes Noble Amazon Quantum Books


Table of Contents

1   Console Thyself1
    The Return of the Console2
    Anatomy of a Program6
    .NET Namespaces7
    String Formatting9
    Visual Basic Data Types11
    The Leap to Objects16
    Shared Methods21
    Exception Handling23
    Throwing Exceptions25
    Getting and Setting Properties27
    Instances and Inheritance34
    A Bigger Picture38
    Naming Conventions39
    Beyond the Console40
2   Hello, Windows Forms43
    The Message Box45
    The Form51
    Showing the Form53
    It's an Application and We Want to Run It55
    Variations on a Theme57
    Form Properties58
    Event-Driven Input60
    Handling the Paint Event62
    Displaying Text66
    The Paint Event Is Special!71
    Multiple Forms, Multiple Handlers71
    Inheriting Forms74
    The OnPaint Method76
    Is the Module Necessary?77
    Events and "On" Methods79
3   Essential Structures85
    Classes and Structures86
    Two-Dimensional Coordinate Points87
    Arrays of Points89
    The Size Structure90
    The Float Versions91
    A Rectangle Is a Point and a Size93
    Rectangle Properties and Methods94
    A Nice-Sized Form97
    The Form and the Client99
    Point Conversions103
    The Color Structure104
    The 141 Color Names105
    Pens and Brushes107
    System Colors108
    The Known Colors112
    What to Use?112
    Getting a Feel for Repaints113
    Centering Hello World116
    Measuring the String120
    Text in a Rectangle122
4   An Exercise in Text Output127
    System Information127
    Spacing Lines of Text128
    Property Values129
    Formatting into Columns131
    Everything Is an Object133
    Listing the System Information137
    Windows Forms and Scroll Bars140
    Scrolling a Panel Control141
    The Heritage of ScrollableControl145
    Scrolling Without Controls146
    Actual Numbers149
    Keeping It Green150
    Don't Be a Pig153
    Reflecting on the Future155
5   Lines, Curves, and Area Fills161
    How to Get a Graphics Object162
    Pens, Briefly163
    Straight Lines165
    An Introduction to Printing167
    Properties and State173
    Multiple Connected Lines177
    Curves and Parametric Equations182
    The Ubiquitous Rectangle185
    Generalized Polygons188
    Easier Ellipses188
    Arcs and Pies190
    Filling Rectangles, Ellipses, and Pies197
    Off by 1199
    Polygons and the Filling Mode200
6   Tapping into the Keyboard205
    Ignoring the Keyboard205
    Who's Got the Focus?206
    Keys and Characters207
    Keys Down and Keys Up209
    The Keys Enumeration210
    Testing the Modifier Keys221
    Reality Check222
    A Keyboard Interface for SysInfo223
    KeyPress for Characters225
    Control Characters225
    Looking at the Keys226
    Invoking the Win32 API231
    Handling Input from Foreign Keyboards233
    Input Focus237
    The Missing Caret238
    Echoing Key Characters242
    Right-to-Left Problems246
7   Pages and Transforms249
    Device Independence Through Text249
    How Much Is That in Real Money?250
    Dots Per Inch253
    What's with the Printer?254
    Manual Conversions256
    Page Units and Page Scale258
    Pen Widths263
    Page Transforms266
    Saving the Graphics State267
    Metrical Dimensions268
    Arbitrary Coordinates272
    What You Can't Do275
    Hello, World Transform276
    The Big Picture281
    Linear Transforms282
    Introducing Matrixes285
    The Matrix Class286
    Shear and Shear Alike289
    Combining Transforms291
8   Taming the Mouse295
    The Dark Side of the Mouse296
    Ignoring the Mouse297
    Some Quick Definitions297
    Information About the Mouse298
    The Mouse Wheel299
    The Four Basic Mouse Events300
    Doing the Wheel303
    Mouse Movement307
    Tracking and Capturing the Mouse309
    Adventures in Tracking312
    Clicks and Double-Clicks322
    Mouse-Related Properties323
    Entering, Leaving, Hovering324
    The Mouse Cursor325
    An Exercise in Hit-Testing334
    Adding a Keyboard Interface336
    Putting the Children to Work338
    Hit-Testing Text343
    Scribbling with the Mouse345
9   Text and Fonts351
    Fonts Under Windows351
    Talking Type352
    Font Heights and Line Spacing354
    Default Fonts356
    Variation on a Font357
    Creating Fonts by Name359
    A Point Size by Any Other Name.364
    Clash of the Units369
    Font Properties and Methods371
    New Fonts from FontFamily378
    Understanding the Design Metrics380
    Arrays of Font Families385
    Font Collections391
    Variations on DrawString392
    Anti-Aliased Text394
    Measuring the String396
    The StringFormat Options398
    Grid Fitting and Text Fitting400
    Horizontal and Vertical Alignment403
    The Hotkey Display408
    A Clip and a Trim410
    Start a Tab417
10   The Timer and Time425
    The Timer Class426
    The DateTime Structure430
    Local Time and Universal Time432
    The Tick Count436
    Calendars Around the World439
    A Readable Rendition441
    A Simple Culture-Specific Clock447
    The Retro Look452
    An Analog Clock457
    A Little Puzzle Called Jeu de Taquin463
11   Images and Bitmaps469
    Bitmap Support Overview471
    Bitmap File Formats472
    Loading and Drawing477
    Image Information482
    Rendering the Image487
    Fitting to a Rectangle490
    Rotate and Shear495
    Displaying Part of the Image497
    Drawing on the Image502
    More on the Image Class507
    The Bitmap Class510
    Hello World with a Bitmap513
    The Shadow Bitmap514
    Binary Resources517
    The Image List528
    The Picture Box531
12   Buttons and Labels and Scrolls (Oh My!)535
    Buttons and Clicks536
    Keyboard and Mouse540
    Control Issues541
    Deeper into Buttons542
    Appearance and Alignment546
    Buttons with Bitmaps549
    Multiple Handlers or One?552
    Drawing Your Own Buttons552
    Dropping Anchor557
    Dock Around the Clock561
    Children of the Form564
    The Check Box569
    The Three-State Alternative573
    The Label Control574
    Tab Stops and Tab Order577
    Identifying the Controls578
    The Auto-Scale Option581
    A Hexadecimal Calculator587
    Radio Buttons and Group Boxes592
    Scroll Bars596
    The Track Bar Alternative604
13   Béziers and Other Splines611
    The Bézier Spline in Practice612
    A More Stylish Clock617
    Collinear Béziers619
    Circles and Arcs with Béziers621
    Bézier Art624
    The Mathematical Derivation626
    The Canonical Spline630
    Canonical Curve Derivation638
14   Menus641
    Menus and Menu Items642
    Menu Shortcut Keys645
    Your First Menu647
    Unconventional Menus651
    MenuItem Properties and Event653
    Checking the Items655
    Working with Context Menus659
    The Menu Item Collection663
    The Standard Menu (A Proposal)669
    The Owner-Draw Option674
15   Paths, Regions, and Clipping685
    A Problem and Its Solution685
    The Path, More Formally691
    Creating the Path694
    Rendering the Path698
    Path Transforms702
    Other Path Modifications705
    Clipping with Paths712
    Clipping Bitmaps717
    Regions and Clipping721
16   Dialog Boxes725
    Your First Modal Dialog Box726
    Modal Dialog Box Termination731
    Accept and Cancel733
    Screen Location734
    The About Box738
    Defining Properties in Dialog Boxes742
    Implementing an Apply Button747
    The Modeless Dialog Box751
    The Common Dialog Boxes755
    Choosing Fonts and Colors756
    Using the Windows Registry763
    The Open File Dialog Box768
    The Save File Dialog Box776
17   Brushes and Pens781
    Filling in Solid Colors782
    Hatch Brushes782
    The Rendering Origin792
    Texture Brushes795
    Linear Gradient Brushes800
    Path Gradient Brushes810
    Tiling the Brush814
    Pens Can Be Brushes Too822
    A Dash of Style826
    Caps and Joins829
18   Edit, List, and Spin837
    Single-Line Text Boxes837
    Multiline Text Boxes842
    Cloning Notepad845
    The Notepad Clone with File I/O851
    Notepad Clone Continued860
    Special-Purpose Text Boxes875
    The Rich Text Box876
    The List Box884
    List Box + Text Box = Combo Box891
    Up-Down Controls897
19   Font Fun909
    Getting Started909
    Brushed Text911
    Font Transforms919
    Text and Paths930
    Nonlinear Transforms944
20   Toolbars and Status Bars951
    The Basic Status Bar952
    The Status Bar and Auto-Scroll954
    Status Bar Panels957
    StatusBarPanel Properties959
    Menu Help963
    The Basic Toolbar970
    Toolbar Variations974
    Toolbar Events978
    Toolbar Styles983
21   Printing993
    Printers and Their Settings994
    Page Settings1002
    Defining a Document1006
    Handling PrintDocument Events1008
    The Page Dimensions1014
    The Print Controller1018
    Using the Standard Print Dialog Box1023
    Setting Up the Page1027
    Print Preview1031
22   Tree View and List View1039
    Tree Views and Tree Nodes1055
    Images in Tree Views1059
    Tree View Events1060
    Node Navigation1062
    The Directory Tree1065
    Displaying Images1071
    List View Basics1078
    List View Events1086
23   Metafiles1095
    Loading and Rendering Existing Metafiles1096
    Metafile Sizes and Rendering1098
    Converting Metafiles to Bitmaps1106
    Creating New Metafiles1108
    The Metafile Boundary Rectangle1116
    Metafiles and the Page Transform1119
    The Metafile Type1122
    Enumerating the Metafile1125
24   Clip, Drag, and Drop1133
    Items and Formats1134
    The Tiny (But Powerful) Clipboard Class1134
    Getting Objects from the Clipboard1136
    Clipboard Data Formats1145
    Clipboard Viewers1155
    Setting Multiple Clipboard Formats1164
    Drag and Drop1169
APPENDIX A   Files and Streams1179
    The Most Essential File I/O Class1179
    FileStream Properties and Methods1182
    The Problem with FileStream1186
    Other Stream Classes1187
    Reading and Writing Text1188
    Binary File I/O1197
    The Environment Class1200
    File and Path Name Parsing1202
    Parallel Classes1204
    Working with Directories1206
    File Manipulation and Information1212
APPENDIX B   Math Class1217
    Numeric Types1217
    Checking Integer Overflow1218
    The Decimal Type1219
    Floating-Point Infinity and NaNs1222
    The Math Class1224
    Floating-Point Remainders1227
    Powers and Logarithms1227
    Trigonometric Functions1228
APPENDIX C   String Theory1233
    The Char Type1235
    String Constructors and Properties1237
    Copying Strings1239
    Converting Strings1241
    Concatenating Strings1241
    Comparing Strings1243
    Searching the String1247
    Trimming and Padding1249
    String Manipulation1251
    Formatting Strings1252
    Array Sorting and Searching1252
    The StringBuilder Class1255

Last Updated: August 7, 2002
Top of Page