Erik Brown9781932394658, 1932394-65-6
Table of contents :
Windows Forms in Action, Second Edition……Page 1
preface……Page 20
preface to the first edition……Page 22
acknowledgments……Page 24
about this book……Page 26
what’s new in 2.0……Page 34
PART 1 Hello Windows Forms……Page 38
Getting started with Windows Forms……Page 40
1.1 Programming in C#……Page 41
1.1.1 Namespaces and classes……Page 43
1.1.3 C# types……Page 45
1.1.4 The Main method……Page 48
1.1.5 The Application class……Page 49
1.1.6 Program execution……Page 50
1.2 Windows Forms controls……Page 51
1.2.1 The using directive……Page 52
1.2.2 The Control class……Page 54
1.2.3 The Controls property……Page 55
1.3 Loading files……Page 56
1.3.1 Events……Page 58
1.3.2 The OpenFileDialog class……Page 60
1.4 Resizing forms……Page 63
1.4.1 The Anchor property……Page 66
1.4.2 The Dock property……Page 67
1.5 Recap……Page 69
Getting started with Visual Studio……Page 70
2.1 Programming with Visual Studio……Page 71
2.1.1 Creating a project……Page 72
2.1.2 Executing a program……Page 74
2.1.3 Viewing the source code……Page 75
2.2.1 The AssemblyInfo file……Page 80
2.2.3 The Toolbox window……Page 83
2.3.1 Handling events in Visual Studio……Page 89
2.3.2 Handling exceptions……Page 93
2.4.1 Assigning the Anchor property……Page 95
2.4.2 Assigning the Dock property……Page 97
2.5 Recap……Page 98
PART 2 Basic Windows Forms……Page 100
Menus……Page 104
3.1.1 Control classes……Page 105
3.1.2 Container classes……Page 107
3.2.1 Menu terminology……Page 109
3.2.2 Menus in .NET……Page 110
3.3.1 Adding a menu strip……Page 112
3.3.2 Adding a menu item……Page 115
3.3.3 Adding drop-down menu items……Page 118
3.4.1 Adding handlers via the designer window……Page 124
3.4.2 Adding handlers via the properties window……Page 125
3.5 Recap……Page 127
Context menu and status strips……Page 129
4.1 Context menu strips……Page 130
4.1.1 Creating a context menu……Page 131
4.1.2 Adding items to a context menu……Page 132
4.1.3 Sharing a context menu……Page 134
4.2 Drop-down events and event arguments……Page 136
4.2.1 Handling a submenu item click……Page 137
4.2.2 Altering a submenu before it appears……Page 142
4.3.1 Creating a status strip……Page 145
4.3.2 Adding status strip labels……Page 146
4.4 Recap……Page 152
Reusable libraries……Page 153
5.1 Class libraries……Page 154
5.1.1 Creating a class library……Page 155
5.1.2 Using the command-line tools……Page 158
5.1.3 Creating the Photograph class……Page 159
5.1.4 Defining class properties……Page 162
5.2.2 Overriding object methods……Page 165
5.3 Interfaces……Page 168
5.3.1 Interfaces and collections……Page 169
5.3.2 Appreciating collection classes……Page 170
5.4.1 Generic classes……Page 175
5.4.2 Appreciating generic collections……Page 177
5.4.3 Disposing of resources……Page 181
5.5 Recap……Page 183
Files and common dialog boxes……Page 185
6.1.1 Changing the menu bar……Page 186
6.1.2 Managing an album……Page 189
6.2.1 Creating a new album……Page 196
6.2.2 Opening an album……Page 198
6.2.3 Saving an album……Page 200
6.2.4 Printing and exiting……Page 203
6.3.1 Stream classes……Page 204
6.3.2 Writing an album to disk……Page 206
6.3.3 Reading an album from disk……Page 210
6.4.1 Adding and removing images……Page 211
6.4.2 Navigating an album……Page 213
6.5 Recap……Page 215
Dialog boxes……Page 217
7.1 Message boxes……Page 218
7.1.1 Creating an OK message box……Page 220
7.1.2 Creating a YesNo message box……Page 221
7.1.3 Creating a YesNoCancel message box……Page 222
7.2.1 Comparing Close and Dispose……Page 225
7.2.2 Intercepting the Form.Close method……Page 227
7.3 Forms and panels……Page 229
7.3.1 The Form class……Page 230
7.3.2 Creating a dialog box……Page 232
7.4 Modeless dialog boxes……Page 233
7.4.1 Creating a modeless dialog box……Page 234
7.4.2 Adding panels and labels to a form……Page 236
7.4.3 Updating the PixelDialog controls……Page 240
7.4.4 Displaying a modeless dialog box……Page 243
7.4.5 Updating the PixelDialog form……Page 245
7.4.6 Tracking mouse movement……Page 246
7.5 Recap……Page 248
Text boxes……Page 249
8.1 Form inheritance……Page 250
8.1.1 Creating a base form……Page 251
8.1.2 Creating a derived form……Page 254
8.2 Standard text boxes……Page 256
8.2.1 Adding text boxes……Page 257
8.2.2 Adding a multiline text box……Page 262
8.2.3 Hooking up a dialog box……Page 266
8.3.1 Handling key presses……Page 268
8.3.2 Masking text……Page 270
8.4 Recap……Page 276
Buttons……Page 277
9.1.1 The Button class……Page 278
9.1.2 Expanding the PhotoAlbum class……Page 280
9.1.3 Storing album data……Page 282
9.2 Radio buttons……Page 283
9.2.1 The RadioButton class……Page 284
9.2.2 Creating an album dialog box……Page 285
9.3.1 The CheckBox class……Page 287
9.3.2 Using check box buttons……Page 288
9.3.3 Completing the AlbumEditDialog form……Page 290
9.3.4 Hooking up a dialog box (again)……Page 292
9.4.1 The ToolTip class……Page 293
9.4.2 Displaying tooltips……Page 295
9.4.3 Building extender providers……Page 298
9.4.4 The ErrorProvider class……Page 300
9.5 Recap……Page 303
Handling user input and encryption……Page 305
10.1.2 Handling the KeyPress event……Page 306
10.1.3 Handling the KeyDown and KeyUp events……Page 308
10.1.4 Preprocessing command keys……Page 309
10.2.1 The MouseEventArgs class……Page 311
10.2.2 Implementing FlybyTextProvider using mouse events……Page 314
10.2.3 Using the FlybyTextProvider class……Page 317
10.3.1 The Cryptography namespace……Page 319
10.3.2 Encrypting data……Page 321
10.3.3 Writing encrypted data……Page 323
10.3.4 Reading encrypted data……Page 324
10.3.5 Storing encrypted albums……Page 325
10.4 Link labels……Page 328
10.4.1 The LinkLabel class……Page 329
10.4.2 Saving encrypted albums……Page 330
10.4.3 Opening encrypted albums……Page 331
10.5 Recap……Page 334
List boxes……Page 336
11.1.1 The ListControl classes……Page 337
11.1.2 Creating a new solution……Page 339
11.1.3 Refactoring application code……Page 340
11.2 Simple list boxes……Page 345
11.2.1 The ListBox class……Page 347
11.2.2 Displaying a data source……Page 348
11.2.3 Selecting list items……Page 352
11.3 Multiselection list boxes……Page 354
11.3.1 Enabling multiple selection……Page 355
11.3.2 Reordering list items……Page 358
11.3.3 Removing list items……Page 361
11.4 Recap……Page 362
Combo boxes……Page 364
12.1.1 The ComboBox class……Page 365
12.1.2 Creating a combo box……Page 367
12.1.3 Selecting combo box items……Page 369
12.1.4 Modifying the data source……Page 370
12.2 Editable combo boxes……Page 372
12.2.1 Creating a combo box (again)……Page 373
12.2.2 Updating a combo box dynamically……Page 376
12.3.1 Understanding automatic completion……Page 378
12.3.2 Using auto-completion in a combo box……Page 381
12.4.1 The formatting interfaces……Page 382
12.4.2 Implementing an IFormattable interface……Page 383
12.4.3 Using formatting in list controls……Page 387
12.4.4 Implementing custom formatters……Page 389
12.5 Recap……Page 392
Tab controls and pages……Page 393
13.1.1 The TabControl class……Page 394
13.1.2 Creating tab controls……Page 395
13.2.1 The TabPage class……Page 399
13.2.2 Creating tab pages……Page 400
13.2.3 Enclosing existing controls in a tab page……Page 403
13.3 Owner-drawn tabs……Page 406
13.3.1 The DrawItem event……Page 407
13.3.2 Drawing page tabs……Page 408
13.3.3 Using a custom tab control……Page 412
13.4 Owner-drawn list boxes……Page 413
13.4.1 Custom list items……Page 414
13.4.2 Assigning item size……Page 415
13.4.3 Drawing list items……Page 417
13.5 Recap……Page 418
Dates, calendars, and progress bars……Page 420
14.1.1 The DateTimePicker class……Page 421
14.1.2 Creating a DateTimePicker control……Page 424
14.2 Date and time formats……Page 426
14.2.1 Formatting date and time values……Page 427
14.2.2 Customizing a DateTimePicker control……Page 430
14.3 Calendars……Page 431
14.3.1 The MonthCalendar class……Page 432
14.3.2 The UserControl class……Page 433
14.3.3 Creating a calendar control……Page 434
14.3.4 Initializing a calendar……Page 436
14.3.5 Handling mouse clicks in a calendar control……Page 438
14.4.1 Creating an images user control……Page 442
14.4.2 The ProgressBar class……Page 445
14.4.3 Performing a background task……Page 447
14.5 Recap……Page 450
Bells and whistles……Page 452
15.1.1 Bitmaps……Page 453
15.1.2 Icons……Page 457
15.1.3 Cursors……Page 462
15.2 Embedded resources and sounds……Page 463
15.2.1 Embedding a resource……Page 464
15.2.2 Using the project resource file……Page 465
15.2.3 Playing a sound……Page 468
15.3 Track bars……Page 470
15.3.1 The TrackBar class……Page 471
15.3.2 Using track bars……Page 472
15.4.2 Using timers……Page 476
15.5 Recap……Page 479
Tool strips……Page 480
16.1 Tool strip fundamentals……Page 481
16.1.1 The ToolStrip classes……Page 482
16.1.2 Creating a tool strip……Page 484
16.2.1 The ToolStripItem classes……Page 485
16.2.2 Adding standard tool strip items……Page 486
16.2.3 Item alignment, overflow, and other features……Page 489
16.3 Image lists……Page 490
16.3.2 Creating an image list……Page 491
16.3.3 Adding custom tool strip buttons……Page 494
16.4.1 The ToolStripContainer class……Page 495
16.4.2 Embedding a tool strip in a container……Page 497
16.5.1 Toggle buttons……Page 500
16.5.2 Drop-down buttons……Page 504
16.5.3 Split buttons……Page 506
16.6 Recap……Page 510
PART 3 Advanced Windows Forms……Page 512
Custom controls……Page 514
17.1 Extending existing controls……Page 515
17.1.1 Designing a scrollable picture box……Page 516
17.1.2 Creating a scrollable picture box……Page 518
17.1.3 Implementing a scrollable picture box……Page 520
17.2.1 Creating a Control-based class……Page 522
17.2.2 Common features of custom controls……Page 526
17.3.1 Painting the control……Page 528
17.3.2 Resizing the control……Page 530
17.3.3 Handling property changes……Page 532
17.5 Custom controls in Visual Studio……Page 534
17.5.1 Customizing class behavior……Page 535
17.5.2 Customizing class member behavior……Page 537
17.5.3 Customizing design time behavior……Page 540
17.6 Recap……Page 543
Explorer interfaces and tree views……Page 544
18.1.1 Single document interfaces……Page 545
18.1.2 Multiple document interfaces……Page 546
18.1.3 Explorer interfaces……Page 547
18.2.1 The SplitContainer class……Page 548
18.2.2 The TreeView class……Page 551
18.2.3 Creating an explorer interface……Page 553
18.3.1 The TreeNode class……Page 555
18.3.2 Creating tree nodes……Page 556
18.4 Custom tree views……Page 560
18.4.1 Creating a custom tree view……Page 561
18.4.2 Creating custom tree nodes……Page 562
18.4.3 Using interfaces with custom nodes……Page 563
18.4.4 Expanding and collapsing tree nodes……Page 568
18.4.5 Selecting and editing tree nodes……Page 570
18.4.6 Integrating a custom tree view control……Page 574
18.5 Recap……Page 577
List views……Page 578
19.1.1 The ListView class……Page 579
19.1.2 Creating a list view……Page 582
19.1.3 Populating a list view……Page 585
19.2.1 Defining column headers……Page 588
19.2.2 Populating list view columns……Page 591
19.2.3 Sorting list view columns……Page 594
19.3 List view features……Page 599
19.3.1 Selecting items……Page 600
19.3.2 Editing item labels……Page 603
19.3.3 Activating items……Page 606
19.4 Virtual Items……Page 608
19.5 Recap……Page 611
Multiple document interfaces……Page 612
20.1 MDI forms……Page 613
20.1.1 Creating an MDI container……Page 614
20.1.2 Creating an MDI child……Page 615
20.1.3 Updating the entry point……Page 616
20.2 Merged menus……Page 618
20.2.1 Assigning merge actions……Page 620
20.2.2 Assigning merge indexes……Page 621
20.2.3 Opening and closing child forms……Page 624
20.3 MDI children……Page 626
20.3.1 Merging tool strips……Page 627
20.3.2 Displaying pixel data……Page 631
20.3.3 Opening an album twice……Page 636
20.3.4 Updating the title bar……Page 637
20.4 MDI child window management……Page 639
20.4.1 Arranging MDI children……Page 640
20.4.2 Displaying an MDI child list menu……Page 642
20.5 Recap……Page 644
Data binding……Page 645
21.1 Data grid views……Page 646
21.1.2 Creating a data grid view……Page 647
21.1.3 Populating a data grid view……Page 651
21.2 Columns and rows……Page 655
21.2.1 Creating columns……Page 656
21.2.2 Creating combo box columns……Page 661
21.2.3 Understanding bands and rows……Page 663
21.3.1 The DataGridViewCell class……Page 667
21.3.2 Using the cell class……Page 668
21.3.3 Saving a modified album……Page 671
21.4 Recap……Page 672
Two-way binding and binding sources……Page 674
22.1.1 The IBindingList interface……Page 675
22.1.2 Creating a binding list……Page 677
22.2 Editable objects……Page 680
22.2.2 Creating an editable object……Page 681
22.3 Simple data binding……Page 684
22.3.1 The BindingSource class……Page 685
22.3.2 Altering the MyAlbumData application……Page 687
22.3.3 Performing simple binding……Page 689
22.3.4 Updating data bound controls……Page 693
22.3.5 Binding navigators……Page 697
22.4 Recap……Page 700
Odds and ends .NET……Page 702
23.1 Printing……Page 703
23.1.1 Using the print classes……Page 704
23.1.2 Drawing a print page……Page 706
23.2 Drag-and-drop……Page 710
23.2.1 Initiating drag-and-drop……Page 711
23.2.2 Receiving drag-and-drop……Page 713
23.3 Web browsing……Page 716
23.3.1 Creating an about box……Page 717
23.3.2 The WebBrowser class……Page 719
23.3.3 Browse to a web site……Page 720
23.4.1 Storing the Location setting……Page 723
23.4.2 Defining a custom setting……Page 727
23.5 Deployment……Page 728
23.5.1 Creating a setup project……Page 729
23.5.2 Publishing a ClickOnce application……Page 733
23.6 Recap……Page 736
Appendix A……Page 738
A.1.2 Namespaces……Page 739
A.2 Types……Page 740
A.2.1 Classes……Page 741
A.2.2 Structures……Page 751
A.2.3 Interfaces……Page 752
A.2.4 Enumerations……Page 753
A.3 Language elements……Page 754
A.3.2 Operators……Page 755
A.3.3 Keywords……Page 756
A.4 Special features……Page 765
A.4.1 Exceptions……Page 766
A.4.2 Arrays……Page 768
A.4.5 Boxing……Page 769
A.4.6 Documentation……Page 770
Appendix B .NET namespaces……Page 772
B.4 System.Drawing……Page 773
B.7 System.Net……Page 774
B.9 System.Resources……Page 775
B.11 System.Threading……Page 776
B.14 System.Xml……Page 777
Appendix C Visual index……Page 778
C.1 Objects (part 1)……Page 780
C.2 Objects (part 2)……Page 781
C.3 Marshal by reference objects……Page 782
C.4 Components……Page 783
C.5 Common dialogs……Page 784
C.6 Controls (part 1)……Page 785
C.7 Controls (part 2)……Page 786
C.8 Scrollable controls……Page 787
C.9 Container controls……Page 788
C.10 Tool strip item classes……Page 789
C.11 Enumerations……Page 790
C.12 Event data……Page 792
C.13 Interfaces……Page 793
Appendix D For more information……Page 795
index……Page 800
Reviews
There are no reviews yet.