Input for Winforms
Total Page:16
File Type:pdf, Size:1020Kb
ComponentOne Input for WinForms ComponentOne, a division of GrapeCity 201 South Highland Avenue, Third Floor Pittsburgh, PA 15206 USA Website: http://www.componentone.com Sales: [email protected] Telephone: 1.800.858.2739 or 1.412.681.4343 (Pittsburgh, PA USA Office) Trademarks The ComponentOne product name is a trademark and ComponentOne is a registered trademark of GrapeCity, Inc. All other trademarks used herein are the properties of their respective owners. Warranty ComponentOne warrants that the media on which the software is delivered is free from defects in material and workmanship, assuming normal use, for a period of 90 days from the date of purchase. If a defect occurs during this time, you may return the defective media to ComponentOne, along with a dated proof of purchase, and ComponentOne will replace it at no charge. After 90 days, you can obtain a replacement for the defective media by sending it and a check for $2 5 (to cover postage and handling) to ComponentOne. Except for the express warranty of the original media on which the software is delivered is set forth here, ComponentOne makes no other warranties, express or implied. Every attempt has been made to ensure that the information contained in this manual is correct as of the time it was written. ComponentOne is not responsible for any errors or omissions. ComponentOne’s liability is limited to the amount you paid for the product. ComponentOne is not liable for any special, consequential, or other damages for any reason. Copying and Distribution While you are welcome to make backup copies of the software for your own use and protection, you are not permitted to make copies for the use of anyone else. We put a lot of time and effort into creating this product, and we appreciate your support in seeing that it is used by licensed users only. Input for WinForms 1 Table of Contents Input for WinForms Overview 5 Differences from the .NET 1.x Version 5 Help with WinForms Edition 5 Key Features 6 Design-Time Support 7 C1Button Tasks Menu 7 C1CheckBox Tasks Menu 7-8 C1ComboBox Context Menu 8 C1ComboBox Tasks Menu 8-9 C1DateEdit Tasks Menu 9 C1DbNavigator Tasks Menu 9-10 C1DropDownControl Tasks Menu 10 C1Label Tasks Menu 10-11 C1NumericEdit Tasks Menu 11 C1RangeSliderTasks Menu 11-12 C1SplitButton Context Menu 12-13 C1SplitButton Tasks Menu 13 C1TextBox Tasks Menu 13-14 C1ColorPicker Tasks Menu 14 C1FontPicker Tasks Menu 14-15 Using the C1Input Controls 16 C1Input Controls 16-17 C1DbNavigator Control Overview 17-18 C1DbNavigator Appearance 18-19 C1DbNavigator Behavior 19-20 C1ComboBox Control Overview 20 C1ComboBox Elements 20-21 ComboBox Item Modes 21-23 C1ComboBox Styling 23 C1ComboBox Button Appearance 23-24 ComboBox DataBinding 24 Adding Images to Items in the ComboBox 24-25 Adding Items to C1ComboBox 25-26 Removing Items from C1ComboBox 26-27 Copyright © 2017 GrapeCity, inc. All rights reserved. Input for WinForms 2 Populating C1ComboBox with Data Using SelectedItemChanged Event 27-29 Populating C1Combbox with Data Using the SelectedIndexChanged Event 29-30 C1RangeSlider Control Overview 30 C1RangeSlider Elements 30-31 C1RangeSlider Features 31 Maximum and Minimum Values 31 Orientation 31-32 Thumb Values and Range 32 C1RangeSlider Appearance 32 Background Image 32-33 Bar Style 33-37 Thumb Style 37-42 C1ColorPicker Control Overview 42 C1ColorPicker Elements 42-44 Working with C1ColorPicker 44-45 Applying Visual Styles to C1ColorPicker 45-46 C1FontPicker Control Overview 46 C1FontPicker Elements 46-47 Working with C1FontPicker 47-48 Applying Visual Styles to C1Font Picker 48-49 Data Binding 49-50 Value and Text: Displaying, Validating, and Updating Values 50-51 Formatting Data 51 Format Types 51-53 Custom Format Specifiers 53 Numeric Custom Format Specifiers 53-56 Date-Time Custom Format Specifiers 56-61 Parsing (Updating) Data 61 Culture (Regional) Settings 61-62 Edit Mask 62-64 Validating Data 64 Input String Validation (PreValidation) 64-65 Typed Value Validation (PostValidation) 65 Editing Date and Time Values 65-66 Editing Numeric Values 66 Drop-Down and Increment Buttons 66 Copyright © 2017 GrapeCity, inc. All rights reserved. Input for WinForms 3 C1DateEdit Control 66-67 C1NumericEdit Control 67 Custom Drop-Down 67 Programmatic Formatting, Parsing, and Validation 67-68 Error Handling 68 Data Errors 68 Incorrect Format in Displaying Data 68 User Input Errors 68-70 Handling NULL and Empty Values 70 Displaying NULL and Empty Values 70 Entering NULL and Empty Values 70 Customizing C1Input's Appearance 71 Visual Styles 71-81 Themes 81-87 C1Themes and the VisualStyle Property 87 Border Styles 87-88 Cursor Styles 88-90 Flat Styles 90-91 Button Color 91 Input for WinForms Task-Based Help 92 Adding a Drop-Down Form 92-94 Changing the Navigation in the Navigator 94-95 Customizing the Drop-Down Editor 95-97 Customizing the C1DropDownControl 97 Binding C1CheckBox 97 Binding C1CheckBox to a Boolean Field 97-98 Binding C1CheckBox to a String Field 98 Binding C1CheckBox to an Integer Field 98-99 Setting the Calendar Drop-down 99-101 Customizing Appearance Using Visual Styles 101-102 Customizing the C1DateEdit Control 102-103 Displaying Clicked C1DropDown Buttons in a Text Box 103-104 Working with a Database 104 Creating a New Connection 104-106 Updating /Refreshing Data from the Database 106-107 Creating a Master-Detail Relation 107-108 Copyright © 2017 GrapeCity, inc. All rights reserved. Input for WinForms 4 Customizing the PictureBox 108-112 Navigating the C1DateEdit Control 112-115 Displaying a Border Color for the C1Input Controls 115-116 Showing a Message Box when the Border Color Changes 116-117 Set IME Mode 117-118 Move Focus 118-119 Select Specific Calendar Type 119 Spin Up/Spin Down Programmatically 119-120 Change Up-Down Button Alignment 120 Input for WinForms Samples 121-122 Input for WinForms Tutorials 123 Binding C1Input Controls to a Data Source 123 Binding to a C1DataExpress Data Source 123-125 Binding to an ADO.NET Data Source 125-130 Masked Input 130-137 Masked Input Using Regular Expressions 137-139 Data Navigation and Actions Using C1DbNavigator 139-142 Using C1TextBox for Date-Time Input 142-146 Data Validation 146-151 Data Formatting and Parsing 151-157 Using C1DateEdit and C1NumericEdit Controls 157-161 Custom Drop-Down Form 161-165 Editing Numbers in NumericInput Mode 166-169 Copyright © 2017 GrapeCity, inc. All rights reserved. Input for WinForms 5 Input for WinForms Overview Enhancing the functionality and appearance of the standard controls, Input for WinForms (.NET Framework 2.0) consists of a suite of twelve controls that support Getting Started visual styles (including Office 2010) and data binding. The powerful masked editing capability, rich formatting model, and localization enables you to use these input C1Input Controls controls in your applications with increased performance. Display dynamic data in a Input for WinForms visual format, manage dataset navigation, display or edit dates, and much more. Tutorials Input for WinForms Task-Based Help Differences from the .NET 1.x Version Please note that some changes in this version are not compatible with the 1.x versions and may require (minimal) changes to the source code. Changes from the .NET 1.x version include the following: C1Input 2.x does not reference or need the C1Common assembly. Flag properties, such as FormatInfo, MaskInfo, PreValidatation, and PostValidation, do not show the Inherit flags at design time since those flags are set automatically. Most complex properties can now be reset to the default value in the designer. The CopyWithLiterals property was removed from C1TextBox as it is duplicated in MaskInfo. The AllowDbNull property was removed from C1TextBox and is only available as a sub-property of the PostValidation property. C1DropDownControl now allows the option to specify custom images for its buttons via the new ButtonImages Properties. Help with WinForms Edition Getting Started For information on installing ComponentOne Studio WinForms Edition, licensing, technical support, namespaces and creating a project with the control, please visit Getting Started with WinForms Edition. Copyright © 2017 GrapeCity, inc. All rights reserved. Input for WinForms 6 Key Features Display dynamic data in a visual format, manage dataset navigation, display or edit dates, and much more Benefit from using Input for WinForms, featuring: Support for Office 2007 and 2010 visual styles All C1Input controls support visual styles, including Office 2007 style. Provide attractive and consistent look and feel to your application, especially when used with other ComponentOne controls supporting visual styles. The ability to display dynamic data C1Input controls function in unbound and bound mode. In bound mode, a control’s value is bound to a data source field. Extensive data-binding support Supports data binding to all .NET data sources, including ADO.NET data source objects and DataObjects components. Powerful and customizable masked editing capabilities C1TextBox and all derived controls support powerful masked editing including date and time formats, numeric range, and custom format support. Support for regular expressions in mask format Regular expressions in mask format make validation of complex input data easy. The regular expressions define the pattern of data by using keywords such as \A, {}, and so on. They also provide keywords to validate Japanese characters. The power to format data in almost any way imaginable A rich formatting model enables developers to customize the appearance of a control’s text, border, color, and so on. Support for data validation Supports data validation both of the raw input string (PreValidation) and of the typed value entered by the user (PostValidation). Support for a wide range of cultures Define the cultural setting used by the control – this applies to string comparison, numeric and date time formats, and special characters. Specialized drop-down editors C1DropDownControl allows you to attach your own logic to the spin buttons and your own drop-down form/editor to the drop-down button.