ComponentOne. FlexGrid for WinForms

Please download to get full document.

View again

of 205
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Information Report

Court Filings


Views: 226 | Pages: 205

Extension: PDF | Download: 1

ComponentOne FlexGrid for WinForms Copyright GrapeCity, Inc. All rights reserved. ComponentOne, a division of GrapeCity 201 South Highland Avenue, Third Floor Pittsburgh, PA USA Internet:
ComponentOne FlexGrid for WinForms Copyright GrapeCity, Inc. All rights reserved. ComponentOne, a division of GrapeCity 201 South Highland Avenue, Third Floor Pittsburgh, PA USA Internet: Web site: Sales Telephone: or (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 original CD (or diskettes) are 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 CD (or disk) 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 a defective CD (or disk) by sending it and a check for $25 (to cover postage and handling) to ComponentOne. Except for the express warranty of the original CD (or disks) 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. We are 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. This manual was produced using ComponentOne Doc-To-Help. Table of Contents ComponentOne FlexGrid for WinForms Overview... 1 Help with ComponentOne Studio for WinForms... 1 Differences Between and ActiveX Versions of C1FlexGrid... 1 Differences Between and Mobile Versions of ComponentOne FlexGrid for WinForms... 3 Differences Between ComponentOne FlexGrid for WinForms and ComponentOne True DBGrid for WinForms... 5 Migrating a C1FlexGrid Project to Visual Studio Key Features... 7 FlexGrid for WinForms Quick Start... 9 Step 1 of 3: Creating the FlexGrid for WinForms Application... 9 Step 2 of 3: Binding C1FlexGrid to a Data Source... 9 Step 3 of 3: Customizing C1FlexGrid Settings Design-Time Support C1FlexGrid Editors C1FlexGrid Column Editor C1FlexGrid Style Editor Caption Style and Column Style C1FlexGrid Smart Tag C1FlexGrid Tasks Menu Column Tasks Menu Using the C1FlexGrid Control Rows and Columns Column Sizing Cell Selection Cell Ranges Cell Images Formatting Cells Cell Content Cell Appearance Conditional Formatting iii Owner-Drawn Cells Editing Cells Lists and Combos Checkboxes Value-Mapped Lists Cell Buttons Masks Validation Custom Editors Edit Mode Merging Cells Merged Table Headers Merged Data Views Spilling Text Custom Merging Outlining and Summarizing Data Creating Subtotals Creating Custom Trees Creating Outlines and Trees with the C1FlexGrid Control Outline Tree Adding Subtotals Using the Subtotal Method Outline Maintenance Using the Node class Saving, Loading, and Printing Saving and Loading Grids to Text Files Saving and Loading Microsoft Excel Files Loading Grids from Databases Printing Grids C1FlexGrid Filtering AllowFiltering property Managing filters programmatically Applying filters programmatically Customizing filter behavior Customizing the Filtering UI C1FlexGrid Property Groups Data Binding iv Binding to a Data Source Storing and Retrieving Data FlexGrid for WinForms Samples FlexGrid for WinForms Tutorials Edit Tutorial Step 1 of 6: Create the C1FlexGrid Control for the Edit Tutorial Step 2 of 6: Set Column Types and Formats Step 3 of 6: Incorporate Drop-Down Lists Step 4 of 6: Add Data Validation Step 5 of 6: Add Clipboard Support Step 6 of 6: Include Custom Editors Outline Tutorial Step 1 of 5: Create the Controls Step 2 of 5: Read the Data and Build the Outline Step 3 of 5: Add Custom Mouse and Keyboard Handling Step 4 of 5: Allow/Prevent Editing Step 5 of 5: Implement ToolTips Data Analysis Tutorial Step 1 of 4: Create the C1FlexGrid Control for the Data Analysis Tutorial Step 2 of 4: Initialize and Populate the Grid Step 3 of 4: Allow Automatic Sorting Step 4 of 4: Include Subtotals and Outline Tree FlexGrid for WinForms Task-Based Help Accessing the C1FlexGrid Editors Accessing the C1FlexGrid Column Editor Accessing the C1FlexGrid Style Editor Adding Pictures and Text to a Cell Adding Row Numbers in a Fixed Column Adding Three-Dimensional Text to a Header Row Adding Three-Dimensional Text to a Header Row Using Built-In Styles Adding ToolTips That Display UserData UserData ToolTips for a Column UserData ToolTips for a Cell Range UserData ToolTips for a Cell Style UserData ToolTips for a Row UserData ToolTips for a Single Cell v Applying a Gradient Background to a CellRange Changing the Column Order in the Grid Filtering by Value Filtering by Condition Changing the Filter Language Clearing a Tree View Clearing C1FlexGrid Clearing Content Clearing Styles Clearing UserData Clearing Content, Styles, and UserData Converting Column Letters to Uppercase Customizing Appearance Using Visual Styles Entering Only Numbers in a Cell Formatting Cells Formatting a Cell as Read-Only Formatting a Cell with Decimal Content Formatting Cells Based on the Contents Formatting the Border Style Formatting the Border Style of the Control Formatting the Border Style of the Grid Freezing Rows and Columns Getting the Width of a Partially Visible Column Loading and Saving Open XML Files Populating an Unbound Grid with Data Populating a Column with Data Populating a Range of Cells with Data Populating a Row with Data Populating a Single Cell with Data Restricting Grid Editing Disable Editing for the Entire Grid Disable Editing for a Specific Column Disable Editing for a Specific Row Restricting Sorting for a Specific Column Scaling an Image Scaling Images in the Entire Grid Searching for Entries in a Column vi Setting a Cell's Value to Zero When Users Press the Delete Key Setting Rows As Headers Setting the Background Color of Columns and Rows Setting the Background Color of Rows and Columns in a Single Statement Setting the Font of a Single Cell Setting the Text Delimiting Character in C1FlexGrid Sorting Multiple Columns Undoing a Sort Using Password Entries in C1FlexGrid Hiding Characters Already Entered Word Wrapping in a Header or Fixed Row FlexGrid for WinForms Top Tips vii ComponentOne FlexGrid for WinForms Overview ComponentOne FlexGrid for WinForms incorporates the latest in data-binding technology and integrates seamlessly with the Microsoft.NET Framework. As a result, you get an easy-to-use, flexible grid control for creating user-friendly interfaces that display, edit, format, organize, summarize, and print tabular data. The ComponentOne FlexGrid for WinForms package consists of two controls: C1FlexGrid Control The C1FlexGrid control is a powerful, full-featured grid. It will read and write grids from and to compressed binary files or text files (compatible with Microsoft Access and Excel). C1FlexGrid provides all the basics plus advanced features such as outline trees, sorting, cell merging, masked editing, translated combo and image lists, and automatic data aggregation. C1FlexGrid can be used in bound mode, where it displays data from data source, including ADO.NET and ComponentOne DataObjects for WinForms, or in unbound mode, where the grid itself manages the data. C1FlexGridClassic Control Getting Started To get started, review the following topics: - Key Features (page 7) - FlexGrid for WinForms Quick Start (page 9) - FlexGrid for WinForms Samples (page 87) - FlexGrid for WinForms Top Tips (page 191) The C1FlexGridClassic control is a control that derives from C1FlexGrid and provides an object model that is virtually 100% identical to the VSFlexGrid ActiveX control. C1FlexGridClassic was developed to allow easy migration of existing VSFlexGrid projects. The source code for C1FlexGridClassic is provided as a sample. You can use it as a reference that shows how to use the C1FlexGrid control as a base class in the development of custom grid controls. Help with ComponentOne Studio for WinForms Getting Started For information on installing ComponentOne Studio for WinForms, licensing, technical support, namespaces and creating a project with the control, please visit Getting Started with Studio for WinForms. What's New For a list of the latest features added to ComponentOne Studio for WinForms, visit What's New in Studio for WinForms. Differences Between and ActiveX Versions of C1FlexGrid In the ActiveX product, we supplied several versions of the FlexGrid control (ADO, DAO, unbound, Unicode, and so on). In product, there are two versions: C1FlexGrid and C1FlexGridClassic. C1FlexGrid is not a simple port of the ActiveX control. It is a brand new grid control, written from the ground up in C#, with the same design principles but with a new object model that is more modern, clean, and powerful than the one in the ActiveX control. The C1FlexGrid control can be bound to ADO.NET data sources or used in unbound mode. 1 To keep the highest level of source-code compatibility with existing applications, and to make the learning curve as smooth as possible for VSFlexGrid users, we also offer the C1FlexGridClassic control. C1FlexGridClassic is a control that uses C1FlexGrid as a base class and exposes an object model that is virtually identical to the one in VSFlexGrid. We supply the source code to C1FlexGridClassic so you can see exactly how to use the new object model. You can also use it as an example and create your own grid using the C1FlexGrid as a base class. If you are writing new applications, you should use the C1FlexGrid control. If you are porting existing applications that use the VSFlexGrid ActiveX control and want to change as little code as possible, then use the C1FlexGridClassic control. The following table lists the differences between and ActiveX versions of C1FlexGrid: Rows, Cols Collections VSFlexGrid (ActiveX) The ActiveX control has Rows and Cols properties that are used to get or set the number of rows and columns on the grid. In the C1FlexGrid control, these properties return row and column collections. The collections have read/write properties that return the number of elements and fixed elements in each collection. This is probably the most visible change between the controls. Using the ActiveX control, you would write: Dim r%, c% c = 1 For r = _flex.fixedrows To _flex.rows - 1 Debug.Print _flex.textmatrix(r,c ) Next C1FlexGrid (.NET) Using the C1FlexGrid control, this becomes: Dim r%, c% c = 1 For r = _flex.rows.fixed To _flex.rows.count - 1 Debug.Print _flex(r,c) Next Styles Uses the TextMatrix property. In the ActiveX control, you can customize the appearance of individual cells or cell ranges using the Cell property. For example, to give the second row a red background, you would write: _flex.cell(flexcpbac kcolor, 2, 0, 2, _flex.cols-1) = vbred Uses indexers. The C1FlexGrid control uses a CellStyle object to customize cell appearance. To make the second row red, you would write: Dim redstyle As CellStyle = _flex.styles.add( red ) redstyle.backcolor = Color.Red _flex.rows(2).style = redstyle But this requires three lines of code instead of one! What's the advantage? The main advantage of the new approach is that the new style is an object that can be changed or assigned to new ranges. For example, if you decide to give the red cells a white forecolor and a bold font, you can write: _flex.styles( red ).forecolor = Color.White _flex.styles( red ).font = new Font( Arial , 9, FontStyle.Bold) This will change the appearance of all cells that use the Red style. The previous approach would require either (1) clearing all styles and setting everything up again from scratch or (2) scanning all cells in the grid to detect which cells are red, then changing those. 2 CellStyle objects are used consistently throughout the control, so instead of BackColorFixed and ForeColorSel you can now write Styles.Fixed.BackColor and Styles.Highlight.ForeColor. CellRange The Cell property is one of the most powerful elements of the VSFlexGrid object model. It allows you to get or set any property of any cell or cell range with a single command. However, handling colors, text, values, and so on. Using a single property means using Variants, and this prevents the compiler from catching many subtle problems in case you make mistakes. The C1FlexGrid replaces the Cell property with a CellRange object that exposes type-safe properties and methods used to access the properties of a cell range. For example, instead of writing: _flex.cell(flexcppicture, 5, 5, 10, 10) = theimage You would write: Dim rg As CellRange rg = _flex.getcellrange(5,5,10,10) rg.image = theimage The new approach has two significant advantages: It is type-safe, so if the variable theimage contained a string instead of an image, you would get a compiler error instead of a runtime error. You get command-completion when writing the code because the types for each property are known. Typed columns In the ActiveX version, the ColDataType allowed you to set the type of data that each column contained. This information was used mainly for sorting columns that contained dates or numbers. The.NET version has a Cols[i].DataType property that determines the type of data the column holds. By default, the DataType for all columns is object , which means you can store anything in any column. You can set the data type to specific types, however, and the grid will try to coerce any data stored in the grid to the proper type. For example: _flex.cols[2].datatype = typeof(int); // Value will be set to 12. _flex[1, 2] = 12 ; // Bad value. Fire the GridError event and ignore. _flex[2, 2] = hello ; This code would assign the integer 12 to cell (1,2). Cell (2,2) would retain its original value, because the string hello cannot be converted to an integer. If you want to store values of mixed types in a column, you have two options: 1. Set the column's DataType property to object . 2. Use the SetData method with the coerce parameter set to False to store a value or object without checking the data type. Differences Between and Mobile Versions of ComponentOne FlexGrid for WinForms The mobile version of ComponentOne FlexGrid for WinForms allows you to quickly develop Microsoft.NET Compact Framework-based applications for your mobile devices, such as personal digital assistants (PDAs), mobile phones and more. It provides the C1FlexGrid control, a full-featured grid to display, edit, format, organize, 3 summarize, and print tabular data, but with a compacted version of the FlexGrid for WinForms object model and feature set. The following table lists the differences between Compact Framework versions of C1FlexGrid: C1FlexGrid Editors C1FlexGrid Smart Tag Column Sizing Data Binding Image Support C1FlexGrid (.NET) C1FlexGrid Column Editor C1FlexGrid Style Editor Caption Style Column Style C1FlexGrid Tasks Menu Column Tasks Menu At design time, columns can be resized using the Width property which can be set directly in the grid by clicking and dragging the horizontal double arrow that appears at the right edge of a column's header, through the C1FlexGrid Column Editor, or programmatically. You can access the Data Source Configuration Wizard to bind to a data source either through the Properties window or the C1FlexGrid Tasks menu. You can bind to a data source using any data provider supported by Framework. The DataSource property can be set at design time or run time. Use the SetCellImage method to add an image to a cell. For example: C1FlexGrid1.SetCellImage(1,1,Image.From File(c:\myimage.bmp )) C# c1flexgrid1.setcellimage(1,1,image.from C1FlexGrid (Mobile) N/A N/A N/A N/A About C1FlexGrid is the only option available on this menu. N/A At design time, columns can be resized using the Width property in the Properties window or programmatically. You can access the Data Source Configuration Wizard to bind to a data source through the Properties window. When binding to a data source, you must use a data provider that is supported by Compact Framework. For example, you can use Framework Data Provider for SQL Server Mobile Edition. See Binding to a Data Source (page 83) for more information. The DataSource property can be set at run time only. Use the SetCellImage method to add an image to a cell. Image.FromFile is not supported by Compact Framework, but you can load and set the image as in the following example: Dim myimage As New Bitmap( c:\myimage.bmp ) C# C1FlexGrid1.SetCellImage(1, 1, myimage) Bitmap myimage = new Bitmap( c:\\myimage.bmp ); c1flexgrid1.setcellimage(1, 1, myimage); Note: The Image class is unrelated to C1FlexGrid. Please see Microsoft's documentation for more information. 4 Custom Merging You can use the Custom option in the AllowMerging property. More information is available on custom merging in the Custom Merging (page 54) topic. The Custom option is not available in the AllowMerging property, but custom merging can still be performed in the mobile version of C1FlexGrid. You can create a new class that derives from the C1FlexGrid and override the GetMergedRange virtual method, providing your own custom merging logic. See the CustomMerge samples provided with C1FlexGrid and on ComponentOne HelpCentral. Differences Between ComponentOne FlexGrid for WinForms and ComponentOne True DBGrid for WinForms Many customers ask what the difference is between our grid components. While both are robust, easy-to-use grid controls that allow you to browse, edit, add, delete, and manipulate tabular data, there are several reasons why you may want to use one over the other. Both components can be used in bound or unbound mode, but C1FlexGrid allows you to work more easily in unbound mode. With C1FlexGrid you can customize trees and take advantage of its cell merging capabilities. You can also derive from it to create customized grids. ComponentOne True DBGrid for WinForms is better suited for data binding and, therefore, offers more features in that area, including split views and built-in hierarchical binding and grouping. If you plan to use your grids mainly in bound mode and require advanced features such as splits and hierarchical views, True DBGrid for WinForms is the right choice. However, if you plan to work with your grids in unbound mode or need to customize the grid beyond what the object model offers, C1FlexGrid is a better choice. If you have additional questions about ComponentOne FlexGrid for WinForms and ComponentOne True DBGrid for WinForms, please visit our Web site at Migrating a C1FlexGrid Project to Visual Studio 2005 To migrate a project using ComponentOne components to Visual Studio 2005, there are two main steps that must be performed. First, you must convert your project to Visual Studio 2005, which includes removing any references to a previous assembly and adding a reference to the new assembly. Secondly, the.licx file, or licensing file, must be updated in order for the project to run correctly. To convert the project: 1. Open Visual Studio 2005 and select File, Open Project. 2. Locate the.sln file for the project that you wish to convert to Visual Studio Select it and click Open. The Visual Studio Conversion Wizard appears. 3. Click Next. 4. Select Yes, create a backup before converting to create a backup of your current project and click Next. 5. Click Finish to convert your project to Visual Studio The Conversion Complete window appears. 6. Click Show the conversion log when the wizard is cl
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!