实例介绍
【实例简介】Windows forms 开发教程
【实例截图】
【核心代码】
Contents CHAPTER 1 Hello, Windows Forms 1 Windows Forms from Scratch 1 Windows Forms in Visual Studio .NET 7 Arranging Controls 13 Controls 16 Application Settings 19 Resources 23 Dialogs 27 Drawing 30 Printing 32 Data Binding 33 Multithreaded User Interfaces 36 Deployment 38 Where Are We? 39 CHAPTER 2 Forms 41 Showing Forms 41 Owner and Owned Forms 42 Form Lifetime 45 Form Opening 46 Form Deactivation and Reactivation 48 Form Closing 49 Form Notification 51 Flashing Notification 51 System Tray Notification 52 System Tray-Only Applications 54 Form Size and Location 57 Restricting Form Size 62 Form Z-Order 63 Form Adornments 64 Form Transparency 65 Nonrectangular Forms 67 Form and Context Menus 70 Context Menus 76 Tool Strips 78 Status Strips 80 Multiple Document Interface Applications 83 Visual Inheritance 95 Where Are We? 98 CHAPTER 3 Dialogs 99 Standard Dialogs 100 Form Styles 101 Deciding on Modal Versus Modeless at Run-Time 103 Data Exchange 103 Handling OK and Cancel 104 Modeless Form Data 109 Data Validation 110 Regular Expressions and Validation 111 Masked Text Entry and Validation 113 Data Format Notification 114 Combined Validation 115 Thorough Validation 116 Implementing Help 120 Tool Tips 121 Using ErrorProvider for General Information 121 Handling the Help Button and F1 124 Using HTML Help 126 Compiled HTML Help 128 Using the HelpProvider Component 132 Showing Help Contents, Index, and Search 133 Where Are We? 133 CHAPTER 4 Layout 137 Fixed Layout 137 Position and Size 137 Control Z-Order 142 Control Tab Order 144 Dynamic Layout 145 Anchoring 145 Docking 149 Docking and Z-Order 150 Docking with Tool Strip Controls 153 Automatic Resizing 161 Automatic Scaling 163 Layout Controls 166 Splitting 167 Grouping 168 Flow Layout 170 TableLayoutPanel 173 Layout Optimization 176 Custom Layout 176 Where Are We? 177 CHAPTER 5 Drawing Basics 179 Drawing to the Screen 180 Handling the Paint Event 181 Triggering the Paint Event 182 Colors 184 Known Colors 185 Color Translation 188 Brushes 188 Solid Brushes 189 Texture Brushes 189 Hatch Brushes 190 Linear Gradient Brushes 191 Path Gradient Brushes 193 Pens 196 Line Caps 197 Dashes 199 Pen Alignment 200 Joins 200 Creating Pens from Brushes 202 Shapes 203 Curves 203 Smoothing Modes 205 Saving and Restoring Graphics Settings 205 Paths 207 Fill Modes 209 Images 210 Loading and Drawing Images 211 Scaling, Clipping, Panning, and Skewing 212 Rotating and Flipping 214 Recoloring 215 Transparency 216 Animation 217 Drawing to Images 220 Screen Copying 222 Icons 223 Cursors 225 Where Are We? 229 CHAPTER 6 Drawing Text 231 Fonts 231 Creating Fonts 233 Font Families 234 System Fonts 236 Font Characteristics 238 Font Height 240 Strings 242 Formatting 242 Strings and Paths 250 The TextRenderer 251 Formatting with TextRenderer 253 A Tale of Two Technologies 255 Shell Consistency 256 Internationalization 257 Device-Independent Drawing 258 Font Edge Smoothing Support 260 Performance 261 Integration with GDI Graphical Rendering 261 Text-Formatting Comparison 261 Integration 263 Where Are We? 264 CHAPTER 7 Advanced Drawing 265 Page Units 265 Converting Pixels to Page Units 268 Transforms 269 Scaling 270 Scaling Fonts 271 Rotation 272 Translation 274 Shearing 275 Combining Transforms 276 Transformation Helpers 277 Path Transformations 278 Regions 280 Constructing and Filling a Region 280 Clipping to a Region 281 Region Combination Operations 282 Optimized Drawing 283 Double Buffering 284 Manual Double Buffering 286 Double Buffering Performance Considerations 289 Other Drawing Options 289 Where Are We? 290 CHAPTER 8 Printing 291 Print Documents 291 Print Controllers 293 Print Preview 294 PrintPreviewDialog Control Box Icon 297 Basic Print Events 298 Margins 301 Page Settings 305 Printer Settings 308 Print Range 310 Targeting the Printer 314 Useful Printing Techniques 315 Word Wrapping and Pagination 316 Per-Page Page Setting Configuration 320 Dynamic Page Counting 322 Where Are We? 325 CHAPTER 9 Components 327 Components Defined 327 Using Components 328 Creating Custom Components 332 Deriving Directly from System. ComponentModel.Component 332 Component Resource Management 334 Implementing IComponent 337 Adding a Custom Component to the Toolbox 343 Custom Functionality 344 Extending Existing Components 349 Where Are We? 351 CHAPTER 10 Controls 353 Controls Defined 353 Using Controls 354 Themed Controls 356 Tool Strip Render Modes 358 Owner-Drawn Controls 362 ControlPaint 365 Themed Control Rendering 368 Extending Existing Controls 369 Custom Controls 371 Deriving Directly from System.Windows. Forms.Control 371 Control Rendering 373 Custom Implementation 374 EventChanged 377 Ambient Properties 379 Control Input 383 Scrolling 389 Windows Message Handling 392 User Controls 393 Testing User Controls 395 Hosting COM Controls 397 Where Are We? 398 CHAPTER 11 Design-Time Integration: The Properties Window 399 Design-Time Components 399 Hosts, Containers, and Sites 400 Debugging Design-Time Functionality 403 The DesignMode Property 405 Attributes 405 Changing the Toolbox Icon 406 Properties Window Integration 407 Code Serialization 413 Batch Initialization 415 ISupportInitializeNotification 419 Extender Property Providers 421 Type Converters 428 Custom Type Converters 431 Expandable Object Converter 436 Custom Type Code Serialization with TypeConverters 439 UI Type Editors 442 Drop-Down UI Type Editors 445 Modal UI Type Editors 448 Where Are We? 451 CHAPTER 12 Design-Time Integration: Designers and Smart Tags 453 Designers 453 ComponentDesigner 455 ControlDesigner 459 Design-Time-Only Properties 462 Smart Tags 465 Designer Actions 466 Designer Action Lists 467 Smart Tag Properties 467 Smart Tag Method Items 478 Poor Man’s Smart Tag Panel Appearance 481 Custom Smart Tag Panel Appearance 484 Adding a Smart Tag Method Item to the Context Menu 493 Toggling the Label Text of a Smart Tag Item 494 Designer Action Lists 498 Dynamic Designer Actions 499 Where Are We? 503 CHAPTER 13 Resources 505 Resource Basics 505 Manifest Resources 506 Strongly Typed Resources 511 Application Resources (.resx) Files 511 Managing Resources 513 Resource Persistence 516 Using Typed Resources 518 The Resource Manager 520 Strongly Typed Resource Classes 522 Designer Resources 526 Embedding Native Resources 530 Application Internationalization 530 Culture Information 532 Resource Localization 533 Resource Localization for Nondevelopers 537 Resource Probing 540 Resource Resolution 542 Input Language 543 Reading Direction 545 Where Are We? 547 CHAPTER 14 Applications 549 Applications 549 Application Lifetime 551 Application Context 552 Application Events 555 UI Thread Exceptions 555 Passing Command Line Arguments 559 Single-Instance Applications 560 Single-Instance Detection and Management 560 Multiple-SDI Applications 563 Single-MDI Applications 572 Where Are We? 577 CHAPTER 15 Settings 579 The Application Environment 579 Compile-Time Settings 579 Run-Time Settings 582 Application, User, and Roaming-User Settings 589 What Is a Setting? 590 Settings Files 590 Managing Settings 591 Editing Settings 592 Application Configuration Files 595 The Configuration Manager 598 User Configuration Files 601 Strongly Typed Settings 604 Using Strongly Typed Settings 606 Using the Settings Class 606 Loading and Inspecting Settings 607 Updating Settings 609 Saving Settings 611 Rolling Back Settings 611 Migrating Settings 613 Designer Settings 617 Properties Window Configuration 617 Property Binding 618 Persisting Form State, Size, and Position 622 Support for Automatic Tool Strip Layout 623 Alternative Storage for Settings 625 The Registry 625 Special Folders 627 Where Are We? 628 CHAPTER 16 Data Binding Basics 629 The Land before Data Binding 629 Simple Data Binding and Item Data Sources 634 Simple Binding and List Data Sources 636 Complex Binding and List Data Sources 642 IBindingList 645 BindingList<T> 647 Two-Way List Change Synchronization 648 Two-Way Item Change Synchronization 650 The BindingSource Component 651 Turning an Item Type into a List Data Source 651 Using BindingSource at Design Time 653 Design-Time Data Sources 654 Databases 655 Web Services 659 Objects 661 Configuring the BindingSource 664 Data Source Persistence 667 Binding UI Elements in the Designer 668 BindingSource as a Bindable List Data Source 668 Where Are We? 680 CHAPTER 17 Applied Data Binding 681 Drag-and-Drop Data Binding 681 DataGridView Bound UIs 682 Details Bound UIs 684 Fundamentals of Data-Bound UIs 685 Item UIs 685 List UIs 700 Data Views 711 Real-World Data-Bound UIs 716 Master-Details UIs 717 List-Item UIs 722 Hierarchical UIs 728 Multiple Data Contexts 730 TypeConverters 732 Where Are We? 736 CHAPTER 18 Multithreaded User Interfaces 737 Long-Running Operations 737 Progress Indication 737 Asynchronous Operations 740 Safety and Multithreading 743 Simplified Multithreading 750 Reporting Progress 752 Shared Data 763 Asynchronous Web Services 766 Web Service Components 771 Where Are We? 774 CHAPTER 19 ClickOnce Deployment 775 A Day in the Life of ClickOnce Deployment 776 Publishing an Application 777 Launching an Application 782 ClickOnce Configuration 785 Bootstrapping 786 Application Files 789 Publisher Details 790 Install Mode 793 Versioning 794 ClickOnce Security 798 Code Signing 798 Code Access Security 808 Managing Permissions 814 Determining Required Permissions 814 Ascertaining Required Permissions 816 Considerations for Partially Trusted Assemblies 817 Gathering Assembly Information 817 Handling Keystrokes 819 Communicating via Web Services 819 Reading and Writing Files 823 Handling Multiple Partial Trust Deployment Zones 823 Debugging Partially Trusted Applications 825 Processing Command Line Arguments 825 Where Are We? 828 APPENDIX A What’s New in Windows Forms 2.0 829 A Few Words About Windows Forms 829 Windows Forms 2.0 Enhancements 830 Windows Forms 2.0: The Improvements 832 Forms 832 Drawing 834 Printing 835 Components and Controls 835 Design-Time Integration 837 Resources 838 Applications 839 Settings 839 Data Binding 840 Multithreaded User Interfaces 842 ClickOnce Deployment 843 APPENDIX B Moving from MFC 845 A Few Words About MFC 845 MFC Versus Windows Forms 847 The Differences 849 Strategy 855 MFC and Windows Forms Interop 856 Hosting MFC COM Controls in Windows Forms 856 Hosting Windows Forms Controls in MFC 859 Windows Forms as a Better MFC 863 APPENDIX C Delegates and Events 867 Delegates 867 Interfaces 868 Delegates 869 Static Listeners 871 Events 872 Harvesting All Results 873 Asynchronous Notification: Fire and Forget 873 Asynchronous Notification: Polling 874 Asynchronous Notification: Delegates 875 Anonymous Delegates 876 Happiness in the Universe 877 APPENDIX D Component and Control Survey 881 Components 881 BackgroundWorker 881 BindingNavigator 881 BindingSource 881 ColorDialog 881 ErrorProvider 882 FolderBrowserDialog 882 FontDialog 882 HelpProvider 882 ImageList 882 NotifyIcon 883 OpenFileDialog 883 PageSetupDialog 883 PrintDialog 883 PrintDocument 883 PrintPreviewDialog 884 SaveFileDialog 884 SoundPlayer 884 Timer 884 Tool Tip 884 Controls 884 Button 885 CheckBox 885 CheckedListBox 885 ComboBox 886 ContextMenuStrip 887 DataGridView 887 DateTimePicker 887 DomainUpDown 888 FlowLayoutPanel 888 GroupBox 888 HScrollBar 888 Label 889 LinkLabel 889 ListBox 890 ListView 891 MaskedTextBox 892 MenuStrip 893 MonthCalendar 893 NumericUpDown 893 Panel 894 PictureBox 894 PrintPreviewControl 894 ProgressBar 894 RadioButton 895 RichTextBox 896 SplitContainer 896 StatusStrip 896 TabControl 896 TableLayoutPanel 896 TextBox 896 ToolStrip 897 ToolStripContainer 897 TrackBar 897 TreeView 897 VScrollBar 898 WebBrowser 899 APPENDIX E Drag and Drop 901 Enabling Drag and Drop 901 The Drag Source 901 The Drop Target 902 Drop Targets and COM 905 Drag and Drop in Operation 906 Adding Support for Multiple Drag-and-Drop Effects 908 Adding Multiple Drag-and-Drop Effects to the Drag Source 908 Adding Multiple Drag-and-Drop Effects to the Drop Target 908 Customizing Drag and Drop 911 Using Custom Cursors 911 Controlling Drag-and-Drop Completion 913 Drag and Drop of Multiple Data Items 914 Dragging Multiple ListView Items 914 Pieces of an Explorer-Style UI 915 Initiating a Drag Operation 919 Drag in Action 920 Completing a Drag Operation 923 File Drag and Drop 925 APPENDIX F Document Management 927 The FileDocument Component 931 Dirty Bit Management 932 File Management 933 Handling the File Menu Items 935 MDI and the FileDocument Component 937 Shell Integration 940 Integrating with the Shell 940 Document Icons 942 Start | Documents 944 The MruMenuManager Component 945 Getting an MRU Menu 946 Configuring the MRU Menu Appearance 947 Adding a File to the MRU Menu 949 Opening an MRU File 950 Persisting the MRU Menu across Application Sessions 951 MruMenuManager and MDI Applications 952 Opening Files Dragged and Dropped from the Shell 954 Bibliography 957 Index 961
Windows Forms 2.0 programming by Chris Sells Michael Weinhardt (z-lib.org).pdf
好例子网口号:伸出你的我的手 — 分享!
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论