Windows Forms Programming in Visual Basic .NET
| Figure 1.1 : WinForms Projects Figure 1.2 : The WinForms Designer Figure 1.3 : The Property Browser Figure 1.4 : List of Events Figure 1.5 : Nicely Laid-Out Form at Ideal Size Figure 1.6 : Nicely Laid-Out Form Resized Figure 1.7 : Setting the Anchor Property Figure 1.8 : Anchoring Text Boxes Top, Left, Right and Anchoring Buttons Bottom, Right Figure 1.9 : Setting the Dock Property Figure 1.10 : Docking and Splitting Figure 1.11 : Adding a New Project to an Existing Solution Figure 1.12 : A User Control Shown in the Designer Figure 1.13 : Hosting a User Control Figure 1.14 : Dynamic Properties for MainForm Figure 1.15 : A Dialog Box (See Plate 1) Figure 1.16 : ErrorProvider Providing an Error (See Plate 2) Figure 1.17 : Custom Drawing (See Plate 3) Figure 1.18 : A Database Connection in Server Explorer Figure 1.19 : A DataGrid Bound to a Data Set Figure 2.1 : Owner-Owned Relationship Figure 2.2 : A Child ListBox Control Clipped to the Client Area of Its Parent Form Figure 2.3 : The DesktopLocation, Location, ClientSize, and Size Properties (See Plate 4) Figure 2.4 : Opacity (See Plate 5) Figure 2.5 : Form Shown in Front of Notepad with TransparencyKey Set to BackColor Figure 2.6 : TransparencyKey Combined with FormBorderStyle.None Figure 2.7 : The VS.NET Menu Designer Figure 2.8 : Context Menu Designer Figure 2.9 : Z-Order and Tab Order Figure 2.10 : Unthemed Buttons in Windows XP Figure 2.11 : Themed Buttons in Windows XP Figure 2.12 : WinForms FlatStyles Figure 2.13 : Customize Toolbox Dialog Figure 2.14 : COM Component Added to the Toolbox Figure 2.15 : A Sample Form at Normal Size Fonts Figure 2.16 : Increasing the Form's Font Size at Normal Size Fonts Figure 2.17 : The Sample Form at Large Size Fonts Figure 2.18 : All Controls Anchored Top, Left Figure 2.19 : Setting the Anchor Property in the Property Browser Figure 2.20 : Anchoring Settings before Widening Figure 2.21 : Anchoring Settings after Widening Figure 2.22 : A Docking Example Figure 2.23 : Setting the Dock Property in the Property Browser Figure 2.24 : Two Status Bars Docked to the Bottom Edge Figure 2.25 : TextBox Whose DockStyle.Fill Has Higher Docking Priority than StatusBar Figure 2.26 : An Example of Splitting (with Pointer Indicating a Potential Drag) Figure 2.27 : Horizontal Splitting Figure 2.28 : Grouping, Docking, and Anchoring Figure 2.29 : A TabControl with Two TabPage Controls Figure 2.30 : Custom Layout Example Figure 2.31 : Sample MDI Form Figure 2.32 : An MDI Child Management Menu Figure 2.33 : MDI Parent File Menu with No MDI Children Figure 2.34 : MDI Parent File Menu with an MDI Child Figure 2.35 : The Parent and Child Menus in the Designer Figure 2.36 : Mixing Docking and MDI Figure 2.37 : Base Class Used in Visual Inheritance Figure 2.38 : EditorForm Derived from BaseForm Figure 2.39 : The Inheritance Picker Dialog Figure 3.1 : Typical Main Window Form Settings Figure 3.2 : Typical Modal Form Settings Figure 3.3 : Typical Modal Form Settings Figure 3.4 : A Sample Form Used as a Dialog (See Plate 6) Figure 3.5 : Sample Use of the ErrorProvider Component Figure 3.6 : Using Tooltips Figure 3.7 : Combining the ToolTip Component with the ErrorProvider Component Figure 3.8 : Using HelpProvider to Implement the Help Button Figure 3.9 : Showing the loanAmount Subtopic Figure 4.1 : Ellipse Form before Resizing Figure 4.2 : Ellipse Form after Resizing Figure 4.3 : Sample Brushes Figure 4.4 : Various TextureBrush WrapMode Values (See Plate 7) Figure 4.5 : Available Hatch Brush Styles Shown with Black Foreground and White Background Figure 4.6 : Normal, Triangle, and Bell Linear Gradient Brushes (See Plate 8) Figure 4.7 : Four Sample Uses of the PathGradientBrush Class (See Plate 9) Figure 4.8 : A PathGradientBrush with One Red Surrounding Point and Two Blue Ones (See Plate 10) Figure 4.9 : Examples from the LineCap Enumeration Figure 4.10 : Examples Using the DashStyle Enumeration Figure 4.11 : A Single Rectangle Drawn with a Pen Using a Compound Array Figure 4.12 : Pen Alignment Options (See Plate 11) Figure 4.13 : Sample PenJoin Values Figure 4.14 : Creating a Pen from a LinearGradientBrush Figure 4.15 : The Basic Shapes (See Plate 12) Figure 4.16 : Curves Drawn with Various Values of Tension Figure 4.17 : Three Bezier Curves Drawn Using the Same Set of Points in Different Orders Figure 4.18 : The Effect of Changing the SmoothingMode from AntiAlias to None Figure 4.19 : A Rounded Rectangle Composed of Arc Figures in a GraphicsPath Object (See Plate 13) Figure 4.20 : Starting a New Figure in a Path without Closing the Current Figure (See Plate 14) Figure 4.21 : Figures That Overlap Completely Act Subtractively Figure 4.22 : Overlapping Figures and the Alternate FillMode (See Plate 15) Figure 4.23 : Scaling an Image versus Clipping an Image Figure 4.24 : A Form That Pans an Image in Four Directions Figure 4.25 : An Example of Skewing an Image Figure 4.26 : The Rotating and Flipping Types from the RotateFlipType Enumeration (See Plate 16) Figure 4.27 : An Example of Mapping Color.Lime to Color.White (See Plate 17) Figure 4.28 : Using Color.Transparent in a Color Map (See Plate 18) Figure 4.29 : Sample Animation, First Frame Figure 4.30 : Sample Animation, Middle Frame Figure 4.31 : Sample Animation, Last Frame Figure 4.32 : Example of Drawing to an Image Figure 4.33 : Icon Properties from the SystemIcons Class as Shown under Windows XP Figure 4.34 : System Cursors from the Cursors Class Figure 5.1 : Automatic Word-Wrap Performed by DrawString Compared with Manual Word-Wrap Using Font.GetHeight (See Plate 19) Figure 5.2 : The Parts of a Font Family's Height Figure 5.3 : The Effect of the LineLimit StringFormatFlags Value Figure 5.4 : Examples of the StringTrimming Enumeration Figure 5.5 : StringDigitSubstitute Values as Applied to Thailand Thai Figure 5.6 : Examples of the TextRenderingHint Enumeration Figure 5.7 : Using a GraphicsPath Object to Simulate an Outline-Only Font Figure 6.1 : Manually Drawing in Inches Figure 6.2 : Scaling Font Height Independently of Font Width Figure 6.3 : Line from (0, 0) to (250, 0) Rotated by Degrees 0 “90 Figure 6.4 : Line from (25, 25) to (275, 25) Rotated by Degrees 0 “90 Figure 6.5 : Line from (25, 25) to (275, 25) Rotated by Degrees 0 “90 at (25, 25) Figure 6.6 : Rectangle (0, 0, 150, 150) Drawn at Two Origins Figure 6.7 : Drawing a Constant-Size Rectangle at Various Shearing Values Figure 6.8 : Path Flattening, Widening, and Warping Figure 6.9 : Rectangle Clipped to an Ellipse Region Figure 6.10 : Region Combination Operations Figure 7.1 : The Printing Dialog Shown by the PrintControllerWithStatusDialog Figure 7.2 : The PreviewPrintController in use by the PrintPreviewControl Figure 7.3 : The PrintPreviewControl Hosted in a Custom Form Figure 7.4 : Previewing Multiple Pages at Once in PrintPreviewControl Figure 7.5 : The PrintPreviewDialog Component Figure 7.6 : Printing Multiple Pages Figure 7.7 : PageBounds versus MarginBounds Figure 7.8 : PageSetupDialog Component with Default Page Settings Figure 7.9 : The PrintDialog Component Figure 8.1 : Custom Type Shown in a ListBox Control Figure 8.2 : Multicolumn ListView Figure 8.3 : A Parent Node and a Child Node in a TreeView Control Figure 8.4 : A DataGrid Showing a Collection of Custom Types Figure 8.5 : Container Controls in Action Figure 8.6 : A TreeView Using an ImageList Figure 8.7 : Owner-Drawn List Box Figure 8.8 : An Owner-Draw List Box Using Variable Height Figure 8.9 : An Owner-Drawn Status Bar Panel Using ControlPaint Figure 8.10 : Customizing the Toolbox Figure 8.11 : Custom Controls Added to the Toolbox in VS.NET Figure 8.12 : The EllipseLabel Custom Control Hosted on a Form Figure 8.13 : Setting the Font Property on the EllipseLabel Control Figure 8.14 : Setting the Font Property on the Hosting Form Figure 8.15 : A Contained Control Overriding the Value of the Ambient Font Property Figure 8.16 : A Custom Property in the Property Browser Figure 8.17 : A Custom Event Shown in the Property Browser Figure 8.18 : DisplayRectangle versus ClientRectangle (See Plate 20) Figure 8.19 : FileTextBox with a File That Does Not Exist (See Plate 21) Figure 8.20 : FileTextBox with a File Name That Does Exist (See Plate 22) Figure 8.21 : A Sample User Control in Action Figure 8.22 : A New User Control Figure 8.23 : The FileBrowseTextBox User Control in the Designer Figure 8.24 : Cryptic Drag-and-Drop Error Message Figure 8.25 : A Drag-and-Drop Operation Showing the None Effect Figure 8.26 : Drop Target Indicating the Copy Effect Figure 8.27 : Completed Drag-and-Drop Copy Operation Figure 8.28 : Dragging without Ctrl, Causing a Move Figure 8.29 : Dragging with Ctrl, Causing a Copy Figure 8.30 : After a Drag-and-Drop Move Operation Figure 9.1 : Locations of Components and Controls Hosted on a Form Figure 9.2 : The Timer Component Firing Every 100 Milliseconds Figure 9.3 : A New Component Design Surface Figure 9.4 : A Component Design Surface Hosting a Timer Component Figure 9.5 : Design-Time Architecture Figure 9.6 : Snazzy Clock Control Figure 9.7 : Design-Time Control Debugging Figure 9.8 : Default Toolbox Icon Figure 9.9 : New and Improved Toolbox Icon Figure 9.10 : Visual Studio.NET with a Clock Control Chosen Figure 9.11 : Alarm Property with CategoryAttribute and DescriptionAttribute Applied Figure 9.12 : Resetting a Property to Its Default Value Figure 9.13 : Default Property Highlighted in the Property Browser Figure 9.14 : Invalid Value Entered into the Property Browser Figure 9.15 : Form with Multiple Time Zones Figure 9.16 : One Provider Control for Each Client Control Figure 9.17 : One Provider Control for All Client Controls, Accessed with Code Figure 9.18 : One Provider Control for All Client Controls, Accessed with a Property Set Figure 9.19 : Extended Property in Action Figure 9.20 : The Property Browser and Design-Time Conversion Figure 9.21 : Enumeration Type Displayed in the Property Browser via EnumConverter Figure 9.22 : Complex Properties in the Property Browser Figure 9.23 : HandConverter in Action (See Plate 23) Figure 9.24 : Expanded Property Value Figure 9.25 : HandConverter Derived from ExpandableObjectConverter Figure 9.26 : Relationship between Root and Nested Properties and Design-Time Property Instance Figure 9.27 : Color Property Drop-Down UI Editor Figure 9.28 : Custom View Drop-Down UI Editor Figure 9.29 : The DigitalTimeFormat Property Figure 9.30 : Custom DigitalTimeFormat Modal UI Editor Figure 9.31 : Accessing a Modal UITypeEditor Figure 9.32 : Splitter Dashed Border When BorderStyle Is None Figure 9.33 : Splitter with BorderStyle.Fixed3D Figure 9.34 : Border Displayed from ClockControlDesigner Figure 9.35 : ShowBorder Property Value Serialized to the Host Form's Resource File Figure 9.36 : ShowBorder Option in the Property Browser Figure 9.37 : ShowBorder Option in the Property Browser and the Context Menu Figure 10.1 : Setting a File's Build Action to Embedded Resource Figure 10.2 : ildasm Showing an Embedded Manifest Resource Figure 10.3 : A VS.NET Project's Default Namespace Figure 10.4 : The Azul.jpg Resource File in the foo\bar Project Subfolder Figure 10.5 : How VS.NET Composes the Name of a Resource in a Project Subfolder Figure 10.6 : A Summary of Manifest Resource Naming and Name Resolution Figure 10.7 : Adding a .resx File to a Project Figure 10.8 : A Simple .resx File in the Data View of the Designer Figure 10.9 : An Embedded .resources File Figure 10.10 : Logical View of the Way ResourceManager Uses ResourceReader Figure 10.11 : Resource Naming and ResourceManager Figure 10.12 : A Component's .resx File Figure 10.13 : Localized Currencies and Dates Figure 10.14 : Choosing a Culture in the Property Browser Figure 10.15 : One Form with Localization Information for Several Cultures Figure 10.16 : Localizing a Form Using winres .exe Figure 10.17 : ildasm Showing a Culture-Specific Resource Satellite Assembly Figure 10.18 : The Resource Manager's Resource Resolution Algorithm Figure 11.1 : Default .NET Unhandled-Exception Dialog Box Figure 11.2 : Default WinForms Unhandled-Exception Dialog Box Figure 11.3 : Custom Unhandled-Exception Dialog Figure 11.4 : A Sample Multi- SDI Application Figure 11.5 : Assembly Properties Shown in the Shell Figure 11.6 : Dynamic Properties in the Property Browser Figure 11.7 : Dynamic Properties Dialog Figure 11.8 : Opacity Marked as a Dynamic Property Figure 11.9 : The Registry Editor Figure 11.10 : Using the Registry for User Settings Figure 11.11 : Using the Store Admin Tool to List Stores and Streams Figure 12.1 : .NET Data Architecture Figure 12.2 : Showing Retrieved Data Figure 12.3 : A Sample Relation between the Customers Table and the Orders Table Figure 12.4 : Showing the Results of GetChildRows Using a Relation Figure 12.5 : Data Toolbox Figure 12.6 : Data Link Properties Dialog Figure 12.7 : Command Properties Figure 12.8 : Query Builder Figure 12.9 : An Empty Typed Data Set Figure 12.10 : Server Explorer Figure 12.11 : Typed Data Set with New Tables Figure 12.12 : XML Schema Toolbox Figure 12.13 : Edit Key Dialog Figure 12.14 : Edit Relation Dialog Figure 12.15 : Typed Data Set with a New Relation Figure 12.16 : Adding a New Column to Be Used as an Expression Column Figure 12.17 : Adding a Typed Data Set to a Form Figure 13.1 : Complex Data Binding Figure 13.2 : Result of Complex Data Binding Figure 13.3 : Simple Data Binding Figure 13.4 : Simple Data Binding Figure 13.5 : Simple Data Binding to an Item Data Source Figure 13.6 : Simple Binding to a String Object Figure 13.7 : Simple Binding to the Length Property of a String Object Figure 13.8 : Binding the Text and Font Properties of a TextBox Control Figure 13.9 : Simple Data Binding to a List Data Source Figure 13.10 : Simple Data Binding to a Property of a List Data Source Figure 13.11 : Simple Binding to a Data Set Figure 13.12 : Adding a Data Binding in the Property Browser Figure 13.13 : A Currency Manager Maintaining a Position into a List Data Source Figure 13.14 : A Property Manager Manages Only a Single Item Figure 13.15 : Managing Currency Figure 13.16 : Two Controls Bound to the Same Data Source Figure 13.17 : Two Controls Bound to the Same Data Source Sharing the Same Currency Manager Figure 13.18 : Losing Focus Does Not Trigger an End to the Edit Figure 13.19 : Don't Use the dataset.Table + Column Technique to Specify the Data Source! Figure 13.20 : Use the Dataset + Table.column Technique to Specify a Data Source Figure 13.21 : Using Data Binding to Populate a List Control Figure 13.22 : Binding to a Sort View Figure 13.23 : Binding to a Filtered View Figure 13.24 : Master-Detail Relations Figure 13.25 : Composing a Data Member from a Relation in the Property Browser Figure 13.26 : Binding to a DataGrid Figure 13.27 : Showing 3-D Data in a Data Grid Figure 13.28 : Showing Relations Figure 13.29 : Drilling through Relations Figure 13.30 : DataGridTableStyle Collection Editor Figure 13.31 : DataGridColumnStyle Collection Editor with Added Columns Figure 13.32 : A Stylish Data Grid Figure 13.33 : The Data Grid Auto Format Dialog (See Plate 24) Figure 13.34 : An Example of What WinForms Provides for Data Programmers (See Plate 25) Figure 13.35 : Binding to a Custom Item Data Source Figure 13.36 : Binding to a Custom Item Data Source without a Conversion to String Figure 13.37 : Binding to a Custom Item Data Source with a Conversion to String Figure 13.38 : Binding to a Custom List Data Source without a String Conversion Figure 13.39 : Binding to a Custom List Data Source with a String Conversion Figure 13.40 : Binding Properties as Data Members Figure 13.41 : Showing the Top Level of an Object Hierarchy in a Data Grid Figure 13.42 : Showing the Second Level of an Object Hierarchy in a Data Grid Figure 14.1 : Digits of Pi Application Figure 14.2 : Calculating Pi to 1,000 Digits Figure 14.3 : No Paint for You! Figure 14.4 : Na ve Multithreading Figure 14.5 : Safe Multithreading Figure 14.6 : Letting the User Cancel a Long-Running Operation Figure 14.7 : The Result of a Canceled Call to the Pi Web Service Figure 15.1 : A WinForms Control Hosted in IE Figure 15.2 : The Sample Control Shown in the Designer Figure 15.3 : Default Internet Permission Set Figure 15.4 : The Game of Wahoo! Figure 15.5 : Debugging an NTD Application Using ieexec.exe Figure 15.6 : Adjusting .NET Security Figure 15.7 : Using the Internet Control Panel to Add Trusted Sites Figure 15.8 : Trusting All Assemblies Having the Same Public Key Figure 15.9 : How Much an Assembly Is Trusted Figure 15.10 : Setup Project Custom Actions Figure 15.11 : Choosing a Folder for a Custom Action Figure 15.12 : Choosing the Primary Output of Your Class Library Project to Act as a Custom Action Figure 15.13 : NET 1.1 NTD Security Settings Figure D.1 : Components versus Controls Figure D.2 : A Sample Usage of the ColorDialog Component Figure D.3 : A Sample Usage of the FontDialog Component Figure D.4 : A Sample Usage of the OpenFileDialog Component Figure D.5 : A Sample Usage of the SaveFileDialog Component Figure D.6 : A Sample Usage of the FolderBrowserDialog Component Figure D.7 : A Sample Usage of the NotifyIcon Component (See Plate 26) Figure D.8 : Image Collection Editor Figure D.9 : A Sample Usage of the ContextMenu Component Figure D.10 : A Sample Usage of the ErrorProvider Component Figure D.11 : A Sample Usage of the HelpProvider Component Figure D.12 : A Sample Usage of the ToolTip Component Figure D.13 : A Label Control in Action Figure D.14 : A LinkLabel Control in Action Figure D.15 : A TextBox Control in Action Figure D.16 : A Button Control in Action Figure D.17 : A CheckBox Control in Action Figure D.18 : A RadioButton Control in Action Figure D.19 : A PictureBox Control in Action Figure D.20 : A ListBox Control in Action Figure D.21 : A CheckedListBox Control in Action Figure D.22 : A ComboBox Control in Action Figure D.23 : A ListView Control in Action Figure D.24 : A TreeView Control in Action Figure D.25 : A DataGrid Control in Action Figure D.26 : A MonthCalendar Control in Action Figure D.27 : A DateTimePicker Control in Action Figure D.28 : A DateTimePicker with ShowUpDown Enabled Figure D.29 : An HScrollBar Control in Action Figure D.30 : A VScrollBar Control in Action Figure D.31 : A DomainUpDown Control in Action Figure D.32 : A NumericUpDown Control in Action Figure D.33 : A TrackBar Control in Action Figure D.34 : A ProgressBar Control in Action Figure D.35 : A RichTextBox Control in Action Figure D.36 : A PrintPreviewControl Control in Action Figure D.37 : A Splitter Control in Action Figure D.38 : A ToolBar Control in Action Figure D.39 : A StatusBar Control in Action Figure D.40 : A Panel Control in Action Figure D.41 : A GroupBox Control in Action Figure D.42 : A TabControl Control in Action |