Вы находитесь на странице: 1из 825

Copyright 1987-2007 ComponentOne LLC. All rights reserved.

. Corporate Headquarters ComponentOne LLC 201 South Highland Avenue 3rd Floor Pittsburgh, PA 15206 USA Internet: info@ComponentOne.com Web site: http://www.componentone.com Sales E-mail: sales@componentone.com Telephone: 1.800.858.2739 or 1.412.681.4343 (Pittsburgh, PA USA Office) Technical Support See Technical Support in this manual for information on obtaining technical support. Trademarks ComponentOne FlexGrid for .NET and the ComponentOne FlexGrid for .NET logo are trademarks, and ComponentOne is a registered trademark of ComponentOne LLC. 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. ComponentOnes 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. Please read License Agreement and Licensing sections in this manual before copying and redistributing any ComponentOne FlexGrid for .NET files.

iii

Table of Contents
Welcome to ComponentOne FlexGrid for .NET (2.0) ................................................................... 1 Overview...............................................................................................................................................1 Differences Between the .NET and ActiveX Versions of FlexGrid ...........................................................2 Differences Between ComponentOne FlexGrid for .NET and ComponentOne True DBGrid for .NET ....4 What's New in ComponentOne FlexGrid for .NET ................................................................................4 Revision History....................................................................................................................................9 Installation ..........................................................................................................................................15 END-USER LICENSE AGREEMENT FOR COMPONENTONE SOFTWARE................................16 Licensing FAQs...................................................................................................................................22 Technical Support................................................................................................................................26 Redistributable Files ............................................................................................................................27 Namespaces ........................................................................................................................................27 Creating a .NET 2.0 Project .................................................................................................................28 Adding the C1FlexGrid Component to a Project...................................................................................29 Migrating a C1FlexGrid Project to Visual Studio 2005 ..........................................................................31 Using the C1FlexGrid Control................................................................................................37 Layout ................................................................................................................................................38 Design Time Interaction ......................................................................................................................39 Selection..............................................................................................................................................58 Data Binding .......................................................................................................................................60 Cell Ranges .........................................................................................................................................65 Cell Images .........................................................................................................................................65 Formatting Cells ..................................................................................................................................66 Editing Cells........................................................................................................................................74 Outlining and Summarizing .................................................................................................................87 Merging Cells ......................................................................................................................................95 Saving, Loading, and Printing ............................................................................................................ 100 FlexGrid Property Groups ................................................................................................................. 105 C1FlexGrid Samples .......................................................................................................... 107 C1FlexGrid Tutorials ......................................................................................................... 115 Edit Tutorial...................................................................................................................................... 115 Outline Tutorial................................................................................................................................. 135 Data Analysis Tutorial....................................................................................................................... 151 C1FlexGrid Task-Based Help ............................................................................................... 167 Accessing the C1FlexGrid Editors ...................................................................................................... 167 Adding Pictures and Text to a Cell ..................................................................................................... 170 Adding Row Numbers in a Fixed Column.......................................................................................... 171 Adding Three-Dimensional Text to a Header Row.............................................................................. 172 Adding ToolTips That Display UserData ........................................................................................... 176 Applying a Gradient Background to a CellRange ................................................................................ 180 Changing the Column Order in the Grid............................................................................................. 183 Clearing a Tree View ......................................................................................................................... 185 Clearing C1FlexGrid ......................................................................................................................... 186 Converting Column Letters to Uppercase ........................................................................................... 189 Entering Only Numbers in a Cell........................................................................................................ 190 Formatting Cells ................................................................................................................................ 191 Formatting the Border Style ............................................................................................................... 199 Freezing Rows and Columns.............................................................................................................. 208

iv

Populating an Unbound Grid with Data ............................................................................................. 210 Restricting Grid Editing ..................................................................................................................... 214 Scaling an Image ............................................................................................................................... 217 Searching for Entries in a Column ...................................................................................................... 219 Setting a Cell's Value to Zero When Users Press the Delete Key .......................................................... 220 Setting Rows As Headers ................................................................................................................... 221 Setting the Background Color of Columns and Rows ..........................................................................224 Setting the Font of a Single Cell.......................................................................................................... 231 Setting the Text Delimiting Character in C1FlexGrid.......................................................................... 235 Sorting Multiple Columns .................................................................................................................. 236 Undoing a Sort .................................................................................................................................. 237 Using Password Entries in C1FlexGrid............................................................................................... 238 Word Wrapping in a Header or Fixed Row ........................................................................................241 C1.Win.C1FlexGrid.2 Assembly........................................................................................... 245 C1.Win.C1FlexGrid.Classic.2 Assembly ................................................................................ 245 C1.Win.C1FlexGrid Namespace ........................................................................................... 247 C1.Win.C1FlexGrid Hierarchy .......................................................................................................... 252 AggregateEnum Enumeration ............................................................................................................ 255 AggregateFlags Enumeration ............................................................................................................. 256 AllowDraggingEnum Enumeration .................................................................................................... 257 AllowFreezingEnum Enumeration..................................................................................................... 257 AllowMergingEnum Enumeration ..................................................................................................... 258 AllowResizingEnum Enumeration ..................................................................................................... 259 AllowSortingEnum Enumeration ....................................................................................................... 260 AutoSearchEnum Enumeration ......................................................................................................... 260 AutoSizeFlags Enumeration .............................................................................................................. 261 BeforeMouseDownEventArgs Class ................................................................................................... 261 BeforeMouseDownEventHandler Delegate ........................................................................................ 266 BorderDirEnum Enumeration............................................................................................................ 267 C1.Win.C1FlexGrid.BorderStyleEnum Enumeration ......................................................................... 268 C1FlexGrid Class .............................................................................................................................. 268 C1FlexGridBase Class ....................................................................................................................... 293 CellBorder Class ................................................................................................................................ 516 CellRange Structure........................................................................................................................... 518 CellRangeCollection Class ................................................................................................................. 531 CellStyle Class................................................................................................................................... 540 CellStyleCollection Class ................................................................................................................... 563 CellStyleEnum Enumeration.............................................................................................................. 579 CheckEnum Enumeration.................................................................................................................. 581 ClearFlags Enumeration .................................................................................................................... 582 Column Class .................................................................................................................................... 582 ColumnCollection Class .................................................................................................................... 593 ComboBoxEditor Class...................................................................................................................... 606 DisplayEnum Enumeration................................................................................................................ 609 DragModeEnum Enumeration........................................................................................................... 609 DragRowColEventArgs Class ............................................................................................................ 610 DragRowColEventHandler Delegate.................................................................................................. 613 DrawCellFlags Enumeration.............................................................................................................. 614 DrawModeEnum Enumeration.......................................................................................................... 615 DropModeEnum Enumeration .......................................................................................................... 615 EditFlags Enumeration ...................................................................................................................... 616 FileFlags Enumeration....................................................................................................................... 617 FileFormatEnum Enumeration .......................................................................................................... 618 FocusRectEnum Enumeration ........................................................................................................... 618

GetErrorInfoEventArgs Class............................................................................................................. 619 GetErrorInfoEventHandler Delegate .................................................................................................. 621 GlyphEnum Enumeration.................................................................................................................. 622 GridChangedEventArgs Class ............................................................................................................ 623 GridChangedEventHandler Delegate ................................................................................................. 625 GridChangedTypeEnum Enumeration ...............................................................................................626 GridErrorEventArgs Class ................................................................................................................. 627 GridErrorEventHandler Delegate....................................................................................................... 631 GridGlyphs Class .............................................................................................................................. 631 GridPrinter Class ............................................................................................................................... 633 GridTree Class .................................................................................................................................. 638 HighLightEnum Enumeration............................................................................................................ 645 HitTestInfo Structure ......................................................................................................................... 645 HitTestTypeEnum Enumeration ........................................................................................................ 648 IC1EmbeddedEditor Interface............................................................................................................ 649 IC1MultiColumnDictionary Interface ................................................................................................ 654 ImageAlignEnum Enumeration ......................................................................................................... 656 KeyActionEnum Enumeration........................................................................................................... 657 KeyEditEventArgs Class .................................................................................................................... 658 KeyEditEventHandler Delegate ......................................................................................................... 663 KeyPressEditEventArgs Class ............................................................................................................ 664 KeyPressEditEventHandler Delegate.................................................................................................. 667 MoveCursorEnum Enumeration ........................................................................................................ 668 MultiColumnDictionary Class ........................................................................................................... 669 Node Class ........................................................................................................................................ 677 NodeMoveEnum Enumeration .......................................................................................................... 689 NodeTypeEnum Enumeration ........................................................................................................... 690 OwnerDrawCellEventArgs Class ....................................................................................................... 691 OwnerDrawCellEventHandler Delegate ............................................................................................. 700 PrintGridFlags Enumeration .............................................................................................................. 700 RangeEventArgs Class....................................................................................................................... 701 RangeEventHandler Delegate ............................................................................................................ 704 Row Class ......................................................................................................................................... 705 RowCol Class.................................................................................................................................... 717 RowColCollection Class .................................................................................................................... 734 RowColEventArgs Class.................................................................................................................... 740 RowColEventHandler Delegate ......................................................................................................... 743 RowCollection Class.......................................................................................................................... 744 RowColToolTipEventHandler Delegate ............................................................................................. 754 ScrollFlags Enumeration.................................................................................................................... 755 SelectionModeEnum Enumeration..................................................................................................... 755 ShowButtonsEnum Enumeration ....................................................................................................... 756 ShowThemedHeadersEnum Enumeration..........................................................................................757 SortColEventArgs Class..................................................................................................................... 757 SortColEventHandler Delegate .......................................................................................................... 761 SortFlags Enumeration ...................................................................................................................... 761 StyleElementFlags Enumeration ........................................................................................................ 762 SubtotalPositionEnum Enumeration .................................................................................................. 764 TextAlignEnum Enumeration ............................................................................................................ 764 TextDirectionEnum Enumeration ...................................................................................................... 765 TextEffectEnum Enumeration............................................................................................................ 766 ToolTipEventArgs Class .................................................................................................................... 766 TreeStyleFlags Enumeration .............................................................................................................. 769 UnboundValueEventArgs Class ......................................................................................................... 769 UnboundValueEventHandler Delegate............................................................................................... 772 ValidateEditEventArgs Class.............................................................................................................. 773

vi

ValidateEditEventHandler Delegate ................................................................................................... 776 C1.Win.C1FlexGrid.Classic Namespace ................................................................................ 777 C1.Win.C1FlexGrid.Classic Hierarchy............................................................................................... 777 C1FlexGridClassic Class.................................................................................................................... 777 C1.Win.C1FlexGrid.Util.BaseControls Namespace .................................................................. 791 C1.Win.C1FlexGrid.Util.BaseControls Hierarchy .............................................................................. 791 C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum Enumeration.............................................. 791 ScrollableControl Class ...................................................................................................................... 792 Index .............................................................................................................................. 805

Overview 1

Welcome to ComponentOne FlexGrid for .NET (2.0)


Welcome to ComponentOne FlexGrid for .NET. ComponentOne FlexGrid for .NET (C1FlexGrid) includes C1FlexGrid, a full-featured grid control that allows you to display, format, and edit data quickly and easily. C1FlexGrid incorporates ADO.NET and ComponentOne DataObjects data-binding technology, and integrats seamlessly with the Microsoft .NET Framework. ComponentOne has a user-friendly distribution policy. You may try C1FlexGrid for as long as you wish. C1FlexGrid is a part of ComponentOne Studio Enterprise, the largest and most complete component toolset for developing all layers of Windows, Web and Mobile applications. The only restriction is that unlicensed copies will display a ComponentOne banner every time they are loaded to remind you to license the product. If you like C1FlexGrid and find it useful, you can purchase ComponentOne Studio Enterprise for a reasonable price. For additional information on ComponentOne Studio Enterprise, please visit our Web site at http://www.componentone.com. We are confident that you will like ComponentOne FlexGrid For .NET. If you have any suggestions or ideas for new features that you'd like to see included in a future version, or ideas for new controls, please call us or write: Corporate Headquarters ComponentOne LLC 201 South Highland Avenue 3rd Floor Pittsburgh, PA 15206 USA 412.681.4343 412.681.4384 (Fax) http://www.componentone.com

Overview
The ComponentOne FlexGrid For .NET package consists of two controls:

C1FlexGrid Control
C1FlexGrid is a powerful, full-featured grid. It provides new ways to display, edit, format, organize, summarize, and print tabular data. 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 any .NET data source, including ADO.NET and ComponentOne DataObjects, or in unbound mode, where the grid itself manages the data.

2 Welcome to ComponentOne FlexGrid for .NET (2.0)

C1FlexGridClassic Control
C1FlexGridClassic 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.

Differences Between the .NET and ActiveX Versions of FlexGrid


C1FlexGrid and C1FlexGridClassic In the ActiveX product, we supplied several versions of the FlexGrid control (ADO, DAO, unbound, Unicode, and so on). In the .NET 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. 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 and want to change as little code as possible, then use the C1FlexGridClassic control. Rows, Cols Collections 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 = fg.FixedRows To fg.Rows - 1 Debug.Print fg.TextMatrix(r,c) Next Using the C1FlexGrid control, this becomes: Dim r%, c% c = 1 For r = fg.Rows.Fixed To fg.Rows.Count - 1 Debug.Print fg(r,c) Next Note also that the TextMatrix property was replaced with indexers. Styles 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: fg.Cell(flexcpBackColor, 2, 0, 2, fg.Cols-1) = vbRed

Differences Between the .NET and ActiveX Versions of FlexGrid 3

The C1FlexGrid control uses a CellStyle object to customize cell appearance. To make the second row red, you would write: Dim redStyle As CellStyle = fg.Styles.Add("Red") redStyle.BackColor = vbRed fg.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: fg.Styles("Red").ForeColor = vbWhite fg.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. 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: fg.Cell(flexcpPicture, 5, 5, 10, 10) = theImage You would write: Dim rg As CellRange rg = fg.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: fg.Cols[2].DataType = typeof(int); // Value will be set to 12. fg[1,2] = "12"; // Bad value. Fire the GridError event and ignore. fg[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.

4 Welcome to ComponentOne FlexGrid for .NET (2.0)

If you want to store values of mixed types in a column, you have two options: 1. 2. Set the column's DataType property to "object". Use the SetData method with the coerce parameter set to False to store a value or object without checking the data type.

Differences Between ComponentOne FlexGrid for .NET and ComponentOne True DBGrid for .NET
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 .NET 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, C1TrueDBGrid 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 .NET and ComponentOne True DBGrid for .NET, please visit our Web site at http://www.componentone.com.

What's New in ComponentOne FlexGrid for .NET


This documentation was last revised for 2006 v3 on August 21, 2006. Overview of What's New in ComponentOne FlexGrid for .NET There have been enhancements to FlexGrid for .NET that allow the user more flexibility, such as new class members, settings, and behaviors.

Feature Overview
The following enhancements have been made to FlexGrid for .NET: Honors Caption property when data binding. Freezes fixed and frozen rows and columns when exporting to and importing from Excel. This behavior can be changed using the FileFlags.NoFreezing property. Ensures strings with embedded line breaks are saved to Excel when the WordWrap property is set to True. C1FlexGrid always honors hard line break, even if the WordWrap property is set to False. With this change, the Excel output is closer to the grid content. Improved subtotals to work with TimeSpan values. Includes the following new properties: MergedRanges, ScrollOptions, ScrollBarsVisible, and ComboBoxEditor. Includes the following new settings: AllowMergingEnum.Custom, FileFlags.LoadMergedRanges, FileFlags.IncludeMergedRanges, FileFlags.NoFreezing, and EditFlags.DelayedCommit. Replaces the BeforeScrollTip event with the ShowScrollTip event.

What's New in ComponentOne FlexGrid for .NET 5

New Properties The following are a few of the new properties added to the C1FlexGrid component. For a full list and descriptions, see Class Members (page 8). C1FlexGrid.MergedRanges Property (page 280) The MergedRanges property enables custom merging without subclassing. In previous versions, custom merging required subclassing the grid and overriding the GetMergedRange method. This property allows you to provide a list of ranges that should be merged. Custom merged ranges are supported when saving and loading the grid to Excel (SaveExcel/LoadExcel) and XML files (WriteXml/ReadXml). C1FlexGridBase.ScrollOptions Property (page 336) The ScrollOptions uses the ScrollFlags enumeration flags to customize the grid's scrolling behavior. The ScrollFlags enumeration contains the following flags: Flag AlwaysVisible ScrollByRowColumn DelayedScroll ShowScrollTips Description Keeps scrollbars visible even when they are not needed. Scrolls by row or column instead of by pixel. Do not scroll while dragging the scrollbar thumb. Show a tooltip next to the vertical scrollbar.

This property provides options that were not available in previous versions, and also specifies options that had their own properties. The following properties are now obsolete: Obsolete Property ScrollTrack ScrollTips ScrollTipText Use Instead ScrollFlags.DelayedScroll flag. ScrollFlags.ShowScrollTips flag. ShowScrollTip event.

ScrollableControl.ScrollBarsVisible Property (page 795) In previous versions, the call had to compare the size of the control and its client area to find out which bars were being displayed. This property makes that unnecessary.

C1FlexGridBase.ComboBoxEditor Property (page 316) This new property provides easy access to the main properties of the active ComboBox editor control. It contains the following subproperties:

Property ComboBoxEditor.Items ComboBoxEditor.SelectedIndex ComboBoxEditor.SelectedItem ComboBoxEditor.SelectedKey

Description Gets the collection of items in the currently active ComboBox editor. Gets or sets the selected index in the currently active ComboBox editor. Gets or sets the selected item in the currently active ComboBox editor. Gets the key that corresponds to the selected item in the currently active ComboBox editor.

6 Welcome to ComponentOne FlexGrid for .NET (2.0)

These properties get or set properties on the currently active ComboBox editor. They all cast the current editor to a ComboBox and then get or set the appropriate properties on the ComboBox object. If no editor is active, or if the editor is not a ComboBox, these properties return null or -1, and cannot be set. For example: Visual Basic ' with the ComboBoxEditor property: Console.WriteLine("The current combo index is {0}", _flex.ComboBoxEditor.SelectedIndex) ' without the ComboBoxEditor property: Dim cb As ComboBox = CType(ConversionHelpers.AsWorkaround(_flex.Editor, GetType(ComboBox)), ComboBox) Dim index As Integer = Microsoft.VisualBasic.IIf((Not (cb Is Nothing)),cb.SelectedIndex,-1) Console.WriteLine("The current combo index is {0}", index) C# // with the ComboBoxEditor property: Console.WriteLine("The current combo index is {0}", _flex.ComboBoxEditor.SelectedIndex); // without the ComboBoxEditor property: ComboBox cb = _flex.Editor as ComboBox; int index = (cb != null) ? cb.SelectedIndex : -1; Console.WriteLine("The current combo index is {0}", index); Delphi -- N/A Note: This property is especially useful in Visual Basic, which doesn't currently have a conditional cast operator like 'as' in C#.

New Settings The following are a few of the new settings added to the C1FlexGrid component. For a full list and descriptions, see Class Members (page 8). AllowMergingEnum.Custom Setting The AllowMergingEnum.Custom setting is a new setting for the AllowMerging property that allows specifying custom cell ranges for merging. This used to require subclassing the control and overriding the GetMergedRange method. The custom ranges are specified with the MergedRanges property. FileFlags.LoadMergedRanges Setting The FileFlags.LoadMergedRanges setting is a new setting for the LoadExcel flags parameter that allows loading merged cells from Excel sheets. If the Excel sheet being loaded contains merged cells, this flag sets the AllowMerging property to AllowMergingEnum.Custom and loads the merged cells into the MergedRanges collection. FileFlags.IncludeMergedRanges Setting The FileFlags.IncludeMergedRanges setting is a new setting that combines FileFlags.SaveMergedRanges and FileFlags.LoadMergedRanges and can be used when saving and loading Excel files with merged ranges.

What's New in ComponentOne FlexGrid for .NET 7

FileFlags.NoFreezing Setting The FileFlags.NoFreezing setting is a new setting that prevents the grid from freezing rows and columns when saving and loading Excel files. By default, fixed and frozen rows and columns are frozen when imported into Excel, and frozen rows and columns in Excel are frozen when imported into the grid.

EditFlags.DelayedCommit Setting The EditFlags.DelayedCommit setting is used with the EditOptions property to determine when changes are applied to the underlying data source. If the EditOptions value includes the EditFlags.DelayedCommit flag (the default setting does), then the grid uses the standard WinForms behavior and commits the changes only when the cursor moves to a new row or when the grid loses focus. If the the EditOptions value does not include the EditFlags.DelayedCommit flag, changes are committed to the data source immediately after each edit.

ShowScrollTip Event Replaces BeforeScrollTip Event The BeforeScrollTip event was replaced with the ShowScrollTip event. The old event had two problems: It used an external property (ToolTipText) to provide the event argument. It was a Before event with no matching After event.

The new ShowScrollTip event allows you to provide the tooltip text using an event parameter, which is much easier to understand and use. For example: Visual Basic ' old code, obsolete Private Sub _flex_BeforeScrollTip(ByVal sender As Object, ByVal e As RowColEventArgs) Handles _flex.BeforeScrollTip _flex.ToolTipText = String.Format("row {0}", e.Row) End Sub ' new code Private Sub _flex_ShowScrollTip(ByVal sender As Object, ByVal e As ToolTipEventArgs) Handles _flex.ShowScrollTip e.ToolTipText = String.Format("row {0}", e.Row) End Sub C# // old code, obsolete private void _flex_BeforeScrollTip(object sender, RowColEventArgs e) { _flex.ToolTipText = string.Format("row {0}", e.Row); } // new code private void _flex_ShowScrollTip(object sender, ToolTipEventArgs e) { e.ToolTipText = string.Format("row {0}", e.Row); } Delphi // old code, obsolete procedure _flex_BeforeScrollTip(sender: System.Object; e: RowColEventArgs); begin _flex.ToolTipText := string.Format("row {0}", e.Row); end;

8 Welcome to ComponentOne FlexGrid for .NET (2.0)

// new code procedure _flex_ShowScrollTip(sender: System.Object; e: ToolTipEventArgs); begin e.ToolTipText := string.Format("row {0}", e.Row); end;

Class Members
Below are the most recent members added to the C1FlexGrid component: Member AllowMergingEnum.Custom Member C1FlexGrid.MergedRanges Property (page 280) Description Use MergedRanges collection to determine which cells are merged. Gets the CellRangeCollection that determines which grid cells are merged when the AllowMerging property is set to AllowMergingEnum.Custom. Gets a ComboBoxEditor object that provides easy access to properties of the currently active ComboBox editor. Loads the grid from the first worksheet in a Microsoft Excel (.xls) file. Saves the grid contents to a Microsoft Excel (.xls) file. Gets or sets a ScrollFlags value that specifies the grid scrolling behavior. Fires before the vertical scrolltip is displayed. Groups rows based on cell contents and calculates aggregate values. Groups rows based on cell contents and calculates aggregate values. Groups rows based on cell contents and calculates aggregate values. Collection of CellRange objects. Gets the number of CellRange objects in the colletion. Gets or sets the CellRange object at a specified index. Adds a new CellRange object to the collection. Adds a new CellRange object to the collection, optionally removing other overlapping ranges from the collection. Removes all objects from the collection. Determines whether a CellRange object is a member of the collection. Gets the index of a CellRange object in the collection.

C1FlexGridBase.ComboBoxEditor Property (page 316) C1FlexGridBase.LoadExcel Method (String, FileFlags) (page 410) C1FlexGridBase.SaveExcel Method (String, FileFlags) (page 439) C1FlexGridBase.ScrollOptions Property (page 336) C1FlexGridBase.ShowScrollTip Event (page 513) C1FlexGridBase.Subtotal Method (AggregateEnum, Int32, String, String) (page 475) C1FlexGridBase.Subtotal Method (AggregateEnum, Int32, String, String, String) (page 476) C1FlexGridBase.Subtotal Method (AggregateEnum, Int32, String, String, String, String) (page 481) CellRangeCollection Class (page 531) CellRangeCollection.Count Property (page 533) CellRangeCollection.Item Property (page 533) CellRangeCollection.Add Method (CellRange) (page 534) CellRangeCollection.Add Method (CellRange, Boolean) (page 535) CellRangeCollection.Clear Method (page 536) CellRangeCollection.Contains Method (page 536) CellRangeCollection.IndexOf Method (CellRange) (page 537)

Revision History 9

Member CellRangeCollection.IndexOf Method (Int32, Int32) (page 537) CellRangeCollection.Insert Method (page 538) CellRangeCollection.Remove Method (page 539) CellRangeCollection.RemoveAt Method (page 539) CellStyle.BuildString Method (StyleElementFlags) (page 555) ColumnCollection.IndexOf Method (String, Boolean) (page 600) ComboBoxEditor Class (page 606) ComboBoxEditor.Items Property (page 607) ComboBoxEditor.SelectedIndex Property (page 608) ComboBoxEditor.SelectedItem Property (page 608) ComboBoxEditor.SelectedKey Property (page 608) EditFlags.DelayedCommit Member FileFlags.IncludeMergedRanges Member

Description Gets the index of the first CellRange object in the collection that contains the specified row and column. Inserts a CellRange object in the collection at a specified index. Removes a CellRange object from the collection. Removed the object at a specified index from the collection. Returns a string representation of this CellStyle. Gets the index of the Column with the specified name, optionally throwing an exception if the column is not found. Helper class that provides information about a currently active ComboBox editor. Gets the collection of items in the currently active ComboBox editor. Gets or sets the selected index in the currently active ComboBox editor. Gets or sets the selected item in the currently active ComboBox editor. Gets the key that corresponds to the selected item in the currently active ComboBox editor. Commit changes to data source only when changing rows or moving focus. Save and load merged ranges when exporting to or importing from Excel with the SaveExcel and LoadExcel methods. Load merged ranges when importing from Excel with the LoadExcel method. This flag has no effect when loading text files, it only affects Excel input. Do not freeze rows and columns when exporting to or importing from Excel with the SaveExcel and LoadExcel methods. Gets a ScrollBars value that indicates which scrollbars are currently visible.

FileFlags.LoadMergedRanges Member

FileFlags.NoFreezing Member

ScrollableControl.ScrollBarsVisible Property (page 795)

Revision History
The revision history provides recent enhancements to C1FlexGrid.

What's New in 2006 v2


The following enhancements were made to C1FlexGrid in the 2006 v2 release of ComponentOne Studio Enterprise.

10 Welcome to ComponentOne FlexGrid for .NET (2.0)

Feature Overview
The following enhancements have been made to FlexGrid for .NET: Improved accessibility (for consistency with ComponentOne True DBGrid and Microsoft DataGridView) Improved licensing now requires fewer permissions in partial-trust scenarios Built-in numeric editor Enhanced Excel exporting Enhanced handling of Data-Mapped columns Exposed the IC1EmbeddedEditor interface Improved rendering of XP-style borders Added new properties Enhanced StartEdit and AfterEdit event behavior

Built-In Numeric Editor When editing numeric values, the grid will by default use its built-in numeric editor. The numeric editor honors the Format property assigned to the cell style (or column) and provides key checking, as-you-type formatting, and range checking (based on the cell type). You can disable the built-in numeric editor by setting the EditOptions.NumericEditor flag to False. Enhanced Excel Exporting The new FileFlags.SaveMergedRanges flag allows saving merged ranges into .xls files. For example: Visual Basic _flex.SaveExcel(fileName, FileFlags.IncludeFixedCells Or FileFlags.SaveMergedRanges) C# _flex.SaveExcel(fileName, FileFlags.IncludeFixedCells | FileFlags.SaveMergedRanges); Delphi _flex.SaveExcel(fileName, (FileFlags.IncludeFixedCells or FileFlags.SaveMergedRanges));

Enhanced Handling of Data-Mapped Columns Setting the DataType property of a column automatically sets it's Alignment property based on the data type. Now, setting the DataMap property has the same effect. This makes the control easier to use because in typical scenarios, DataMaps are used to translate numeric values (IDs, which are right-aligned by default) into strings (which are left aligned by default). For example, if a grid is bound to a Products table, the numeric CategoryID column will be right-aligned by default. Assigning a DataMap containing strings to that column will automatically make the column leftaligned.

Revision History 11

Exposed the IC1EmbeddedEditor Interface In .NET 1.0 builds, this interface was exposed by the C1Common assembly. The 2.0 version of the grid no longer uses that assembly, and therefore exposes the interface definition to make implementation easier. Note that the methods in IC1EmbeddedEditor are called using reflection. Controls do not need to implement the entire interface. Any public methods with matching names, parameters, and return values will be recognized and invoked by the grid.

Improved Rendering of XP-Style Borders When XP styles are enabled and the BorderStyle property is set to XpThemes or FixedSingle, the theme color is used instead of SystemColors.WindowFrame.

Added New Properties The following are a few of the new properties added to the C1FlexGrid component. For a full list and descriptions, see Class Members (2006 v2) (page 12). C1FlexGridBase.UseCompatibleTextRendering Property (page 342) This new property determines whether the control should render text using the Graphics class (GDI+, compatible with previous versions, true by default), or the new TextRenderer class (GDI, available in .NET 2.0 and later). The TextRenderer class uses GDI, which supports complex scripts and the Uniscribe APIs, making it better for some international applications. GDI also supports hardware acceleration, but in my tests the new GDI rendering is about 25% slower than the compatible (GDI+) mode. This property was added so you can select the mode that matches other controls and dialogs in your application. C1FlexGridBase.ShowThemedHeaders Property (page 339) Allows you to control themed headers independently for rows and columns, and also independently of the BorderStyle property. C1FlexGridBase.SortColumn Property (page 340) Gets a reference to the column that defines the current sort applied to the grid. This works regardless of the method used for sorting the grid (Sort method, clicks on header columns, or sorting the data source object). The user can determine the sort order by checking the value of the Sort property. CellStyle.BackgroundImage Property (page 545) and CellStyle.BackgroundImageLayout Property (page 545) Specify images to be used as cell backgrounds. This can be used to provide advanced themes with custom borders, gradients, transparency, and so on. There is also a new setting ImageAlignEnum.TileStretch that was added specifically to support cell backgrounds. This setting stretches the central portion of the image while keeping the original size of the edges. CellStyleCollection.SelectedColumnHeader Property (page 571) and CellStyleCollection.SelectedRowHeader Property (page 571) Styles used to paint row and column headers that correspond to the selected cells, Excel-style.

Enhanced StartEdit and AfterEdit Event Behavior When the user clicks on button cells, the StartEdit and AfterEdit events do not fire. In this case, only the CellButtonClick event is fired.

12 Welcome to ComponentOne FlexGrid for .NET (2.0)

When cutting or pasting with AutoClipboard or dragging-and-dropping, the StartEdit and AfterEdit events do not fire.

Class Members (2006 v2)


Below are the most recent members added to the C1FlexGrid component:

Member C1FlexGridBase.ShowThemedHeaders Property (page 339) C1FlexGridBase.SortColumn Property (page 340) C1FlexGridBase.UseCompatibleTextRendering Property (page 342) C1FlexGridBase.GetDataDisplay Method (Int32, Int32, ByRef Image, ByRef CheckEnum) (page 393) C1FlexGridBase.GetDataDisplay Method (Int32, String, ByRef Image, ByRef CheckEnum) (page 394) C1FlexGridBase.IsCellCheckBox Method (page 403) C1FlexGridBase.IsCellSelected Method (page 406) CellStyle.BackgroundImage Property (page 545) CellStyle.BackgroundImageLayout Property (page 545) CellStyleCollection.SelectedColumnHeader Property (page 571) CellStyleCollection.SelectedRowHeader Property (page 571) SelectedColumnHeader (member of the CellStyleEnum Enumeration (page 579)) SelectedRowHeader (member of the CellStyleEnum Enumeration (page 579)) UseNumericEditor (member of the EditFlags Enumeration (page 616)) SaveMergedRanges (member of the FileFlags Enumeration (page 617)) GridTree.MaximumLevel Property (page 641) IC1EmbeddedEditor Interface (page 649) IC1EmbeddedEditor.C1EditorFormat Method (page 650) IC1EmbeddedEditor.C1EditorGetStyle Method (page 651)

Description Gets or sets whether the control should use XP themes for displaying row or column headers. Gets a reference to the column that defines the current sort applied to the grid. Specifies whether text rendering should be compatible with previous releases of WinForms. Gets the value in a grid cell, formatted as a string, and the image or checkbox in the cell. Gets the value in a grid cell, formatted as a string, and the image or checkbox in the cell. Gets a value that determines whether the cell contents are displayed as a checkbox. Gets a value that determines if a cell is selected. Gets or sets the style's background image. Gets or sets the a value that determines how the style will scale and position background image. Gets the style used to paint selected column headers. Gets the style used to paint selected row headers. Style used to render selected column headers. Style used to render selected row headers. Use built-in numeric editor when editing numeric types. Save merged ranges in xls output files. This flag has no effect when saving text files, it only affects the Excel output. Gets the level of the deepest node in the outline. Interface implemented by editors and used by the grid to host edit controls on cells. Formats a given value using a specified mask. Gets the editor style, which determines the type of button that is displayed in the cell before and during editing (DropDown, Modal, or None).

Revision History 13

Member IC1EmbeddedEditor.C1EditorGetValue Method (page 651) IC1EmbeddedEditor.C1EditorInitialize Method (page 652) IC1EmbeddedEditor.C1EditorKeyDownFinishEdit Method (page 653) IC1EmbeddedEditor.C1EditorUpdateBounds Method (page 653) IC1EmbeddedEditor.C1EditorValueIsValid Method (page 654) TileStretch (member of the ImageAlignEnum Enumeration (page 656)) OwnerDrawCellEventArgs Constructor (page 692) ShowThemedHeadersEnum Enumeration (page 757) BackgroundImage (member of the StyleElementFlags Enumeration (page 762)) BackgroundImageLayout (member of the StyleElementFlags Enumeration (page 762))

Description Gets the current value of the editor. Called to initialize the editor content and styles. Gets a value that determines whether a given key should finalize editing. Called to update the editor's size and position. Gets a value that determines if the editor's current contents are valid. Image is split into a grid, corner parts are copied and center is stretched to cover the cell. Initializes a new instance of the OwnerDrawCellEventArgs class. Specifies whether the control should use themes for displaying row or column headers. The style specifies a background image. The style specifies a background image alignment.

Task-Based Help Overview


The following topics have been recently added to the task-based help for C1FlexGrid: Task-Based Help Topic Accessing the C1FlexGrid Editors (page 167) Description The C1FlexGrid editors can be accessed through the C1FlexGrid Tasks menu, the context menu, or the Properties window. There are two C1FlexGrid editors, the C1FlexGrid Column Editor and the C1FlexGrid Style Editor, which allow you to control the layout and appearance of C1FlexGrid at design time. To reorder columns, adjust column widths, set column properties, and insert or remove columns, use the C1FlexGrid Column Editor. To modify existing styles and add custom styles, which may later be assigned to cells, rows, and columns, use the C1FlexGrid Style Editor. To add pictures and text to a cell, use the SetData and SetCellImage methods. To add row numbers in a fixed column, like in Microsoft Excel, use the OwnerDrawCell event to draw the numbers, aligned left, in a fixed column.

Adding Pictures and Text to a Cell (page 170) Adding Row Numbers in a Fixed Column (page 171)

14 Welcome to ComponentOne FlexGrid for .NET (2.0)

Task-Based Help Topic Adding Three-Dimensional Text to a Header Row (page 172)

Description To add three-dimensional text to the table's header row, set the TextEffect property to Raised for text with a shadow offset by one pixel to the right and below the text or Inset for text with a shadow offset by one pixel to the left and above the text. Setting the TextEffect property to Flat gives text no effect. To add ToolTips that display UserData, use C1FlexGrid's MouseMove event to get the UserData property and display it in a ToolTip control. ToolTips can be set to a column, a row, or a single cell. To apply a gradient background to a CellRange, use the OwnerDrawCell event to create custom cell painting. To change the column order in the grid, drag the column to the new position in the grid or use the C1FlexGrid Column Editor, or set the MoveRange method in code. To clear C1FlexGrid, use the Clear method. The Clear method clears either the content, styles, UserData, or all three. To allow entering only numbers in a cell, use the KeyPressEdit event and set the e.Handled parameter to True for the invalid keys. Formatting the border style allows you to customize the appearance of the grid. The border style can be set for both cells and the control. To allow the user to freeze rows and columns with the mouse, set the AllowFreezing property to Columns to freeze only columns, Rows to freeze only rows, or Both to freeze both columns and rows. Conversely, to disable freezing, set the AllowFreezing property to None, which is the default setting. This property can be set either in the designer or in code. To populate an unbound grid with data, use the grid's indexer to populate a column, row, or a single cell. To populate a cell range, use the Data property. To disable editing of the entire grid, specific column or specific row, set the AllowEditing property to False. Conversely, to allow editing, set the AllowEditing property to True, which is the default value. To search for entries in a column as a user types, set the AutoSearch property to FromCursor to begin the search from the current row or FromTop to begin the search from the first scrollable row. Conversely, to disable the search, set the AutoSearch property to None, which is the default setting. This property can be set either in the designer or in code.

Adding ToolTips That Display UserData (page 176)

Applying a Gradient Background to a CellRange (page 180) Changing the Column Order in the Grid (page 183)

Clearing C1FlexGrid (page 186)

Entering Only Numbers in a Cell (page 190)

Formatting the Border Style (page 199)

Freezing Rows and Columns (page 208)

Populating an Unbound Grid with Data (page 210)

Restricting Grid Editing (page 214)

Searching for Entries in a Column (page 219)

Installation 15

Task-Based Help Topic Setting a Cell's Value to Zero When Users Press the Delete Key (page 220) Setting Rows As Headers (page 221) Setting the Background Color of Columns and Rows (page 224) Setting the Font of a Single Cell (page 231) Setting the Text Delimiting Character in C1FlexGrid (page 235) Sorting Multiple Columns (page 236)

Description To set a cell's value to zero when a user presses the DELETE key, use FlexGrid's KeyDown event to catch when the DELETE key is pressed. To set rows as headers, set the Caption and DataType properties for each row. To set the background color of columns and rows, create a new style and assign it to a column and row. To set the font of a single cell, create a new style and assign it to a cell. To set the text delimiting character in C1FlexGrid, set the Split method. To sort multiple columns, set each column's Sort property and use the Sort method to sort according to the column settings.

Installation
This section describes the setup files and system requirements for FlexGrid for .NET. It also explains how to install demonstration versions of ComponentOne products and uninstall FlexGrid for .NET.

FlexGrid for .NET Setup Files


The ComponentOne Studio for .NET 2.0 installation program will create the following directory: C:\Program Files\ComponentOne Studio.NET 2.0. This directory contains the following subdirectories: bin Common Help C1FlexGrid Contains copies of all ComponentOne binaries (DLLs, EXEs). Contains support and data files that are used by many of the demo programs. Contains online documentation for all Studio components. Contains samples and tutorials for C1FlexGrid.

System Requirements
System requirements include the following: Operating Systems: Windows 2000 Windows 2003 Server Windows NT 4 Windows XP, SP1 or SP2 Environments: .NET Framework 2.0 C# .NET Visual Basic .NET Disc Drive: CD or DVD-ROM drive if installing from CD

16 Welcome to ComponentOne FlexGrid for .NET (2.0)

Installing Demonstration Versions


If you wish to try FlexGrid for .NET and do not have a serial number, install the product as usual but do not provide a serial number. The only difference between unregistered (demonstration) and registered (purchased) versions of our products is that registered versions will stamp every application you compile so a ComponentOne banner will not appear when your users run the applications.

Uninstalling FlexGrid for .NET


To uninstall FlexGrid for .NET: 1. 2. 3. Open the Control Panel application and select Add or Remove Programs. Select ComponentOne Studio for .NET 2.0 and click the Remove button. Click Yes to remove the program.

END-USER LICENSE AGREEMENT FOR COMPONENTONE SOFTWARE


IMPORTANT-READ CAREFULLY: This End User License Agreement (this "EULA") contains the terms and conditions that govern your use of the SOFTWARE (as defined below) and imposes material limitations to your rights. You should read this EULA carefully and treat it as valuable property. I. THIS EULA. 1. Software Covered by this EULA. This EULA governs your use of the ComponentOne, LLC ("C1") software product(s) enclosed or otherwise accompanied herewith (individually and collectively, the "SOFTWARE"). The term "SOFTWARE" includes, to the extent provided by C1: 1) any revisions, updates and/or upgrades thereto; 2) any data, image or executable files, databases, data engines, computer software, or similar items customarily used or distributed with computer software products; 3) anything in any form whatsoever intended to be used with or in conjunction with the SOFTWARE; and 4) any associated media, documentation (including physical, electronic and online) and printed materials (the "Documentation"). When using ComponentOne Ribbon for .NET which is provided as part of the SOFTWARE, note that THIS LICENSE GRANTS YOU NO RIGHTS TO THE MICROSOFT OFFICE 2007 UI. TO OBTAIN A LICENSE TO USE THE MICROSOFT OFFICE 2007 UI, PLEASE VISIT http://msdn.microsoft.com/officeui. 2. This EULA is a Legally Binding Agreement Between You and C1. If you are acting as an agent of a company or another legal person, such as an officer or other employee acting for your employer, then "you" and "your" mean your principal, the entity or other legal person for whom you are acting. However, importantly, even if you are acting as an agent for another, you may still be personally liable for violation of federal and State laws, such as copyright infringement. By signifying your acceptance of the terms of this EULA, you intend to be, and hereby are, legally bound to this EULA to the same extent as if C1 and you physically signed this EULA. By installing, copying, or otherwise using the SOFTWARE, you agree to be bound by all the terms and conditions of this EULA. If you do not agree to all of such terms and conditions, you may not install or use the SOFTWARE. If you do not agree with any of the terms herewith and, for whatever reason, installation has begun or has been completed, you should cancel installation or un-install the SOFTWARE, as the case may be. Furthermore, you should promptly return the SOFTWARE to the place of business from which you obtained it in accordance with any return policies of such place of business. Return policies may vary among resellers; therefore you must comply with the return policies of your supplier as you agreed at the point of purchase. If the place of business from which you purchased the SOFTWARE does not honor a full refund for a period of thirty (30) days from the date of purchase, you may then return the

END-USER LICENSE AGREEMENT FOR COMPONENTONE SOFTWARE 17

SOFTWARE directly to C1 for a refund provided that such returns is authorized within the same thirty (30) days time period. To return the product directly to C1, you must first obtain a Return Authorization Number by contacting C1, and you must forward to C1 all items purchased, including the proof of purchase. The return must be postage-prepaid, and post-marked within thirty (30) days from the proof of purchase, time being of the essence. The return option to C1 is only available to the original purchaser of an unopened factory packaged item. II. YOUR LICENSE TO DEVELOP AND TO DISTRIBUTE. As provided in more detail below, this EULA grants you two licenses: 1) a license to use the SOFTWARE to develop other software products (the "Development License"); and 2) a license to use and/or distribute the Developed Software (the "Distribution License"). These licenses (individually and collectively, the "Licenses") are explained and defined in more detail below. 1. Definitions. The following terms have the respective meanings as used in this EULA: "Network Server" means a computer with one or more computer central processing units (CPU's) that operates for the purpose of serving other computers logically or physically connected to it, including, but not limited to, other computers connected to it on an internal network, intranet or the Internet. "Web Server" means a type of Network Server that serves other computers which, are specifically connected to it through either an intranet or the Internet. "Developed Software" means those computer software products that are developed by or through the use of the SOFTWARE. "Developed Web Server Software" means those Developed Software products that reside logically or physically on at least one Web Server and are operated (meaning the computer software instruction set is carried out) by the Web Server's central processing unit(s) (CPU). "Redistributable Files" means the SOFTWARE files or other portions of the SOFTWARE that are provided by C1 and are identified as such in the Documentation for distribution by you with the Developed Software. "Developer" means a human being or any other automated device using the SOFTWARE in accordance with the terms and conditions of this EULA. "Developer Seat License" means that each Developer using or otherwise accessing the programmatic interface or the SOFTWARE must obtain the right to do so by purchasing a separate End User License. Source Code shall mean computer software code or programs in human readable format, such as a printed listing of such a program written in a high-level computer language. The term "Source Code" includes, but is not limited to, documents and materials in support of the development effort of the SOFTWARE, such as flow charts, pseudo code and program notes. 2. Your Development License. You are hereby granted a limited, royalty-free, non-exclusive right to use the SOFTWARE to design, develop, and test Developed Software, on the express condition that, and only for so long as, you fully comply with all terms and conditions of this EULA. The SOFTWARE is licensed to you on a Developer Seat License basis. Developer Seat License basis means that you may perform an installation of the SOFTWARE for use in designing, testing and creating Developed Software by a single Developer on one or more computers, each with a single set of input devices, so long as 1) such computer/computers is/are used only by one single Developer at any given time and not concurrently and, 2) the user is the primary User to whom the license has been granted. Conversely, you may not install or use the SOFTWARE on a computer that is a network server or a computer at which the SOFTWARE is used by more than one Developer. You may not network the SOFTWARE or any component part of it, where it is or may be used by more than one Developer unless you purchase an additional Development License for each Developer. You must purchase another separate license to the SOFTWARE in order to add additional developer seats, whether the additional developers are accessing the SOFTWARE in a stand-alone environment or on a computer network.

18 Welcome to ComponentOne FlexGrid for .NET (2.0)

The license rights granted under this Agreement may be limited to a specified number of days after you first install the SOFTWARE unless you supply information required to license or activate your licensed copy, as the case may be, within the time and the manner described during the SOFTWARE setup sequence and/or in the dialog boxes appearing during use of the SOFTWARE. You may need to activate the SOFTWARE through the use of the Internet, email or telephone; toll charges may apply. You may need to re-activate the SOFTWARE if you modify your computer hardware or if you have installed it on a different computer; in some cases the number of activations allowed may be limited and you will have to contact C1 for clearance. Product activation is based on the exchange of information between your computer and C1. None of this information contains personally identifiable information nor can they be used to identify any personal information about you or any information you store in your computer. YOU ACKNOWLEDGE AND UNDERSTAND THAT THERE ARE TECHNOLOGICAL MEASURES IN THE SOFTWARE THAT ARE DESIGNED TO PREVENT UNLICENSED OR ILLEGAL USE OF THE SOFTWARE. YOU AGREE THAT C1 MAY USE SUCH MEASURES AND YOU AGREE TO FOLLOW ANY REQUIREMENTS REGARDING SUCH TECHNOLOGICAL MEASURES. YOU ACKNOWLEDGE AND AGREE THAT THE SOFTWARE WILL CEASE TO FUNCTION UNLESS AND UNTIL YOU ACTIVATE THE APPLICABLE SOFTWARE SERIAL NUMBER. You agree that C1 may audit your use of the SOFTWARE for compliance with these terms at any time, upon reasonable notice. In the event that such audit reveals any use of the SOFTWARE other than in full compliance with the terms of this EULA, you shall reimburse C1 for all reasonable expenses related to such audit in addition to any other liabilities you may incur as a result of such non-compliance. In all cases, (a) you may not use C1's name, logo, or trademarks to market your Developed Software without the express written consent of C1; (b) you must include the following C1 copyright notice in your Developed Software documentation and/or in the "About Box" of your Developed Software, and wherever the copyright/rights notice is located in the Developed Software (Portions Copyright ComponentOne, LLC 1991-2006. All Rights Reserved.); (c) you agree to indemnify, hold harmless, and defend C1, its suppliers and resellers, from and against any claims or lawsuits, including attorney's fees that may arise from the use or distribution of your Developed Software; (d) you may use the SOFTWARE only to create Developed Software that is significantly different than the SOFTWARE. 3. Your Distribution License. License to Distribute Developed Software. Subject to the terms and conditions in this EULA, you are granted the license to use and to distribute Developed Software on a royalty-free basis, provided that the Developed Software incorporates the SOFTWARE as an integral part of the Developed Software in machine-language compiled format (customarily an ".exe", or ".dll", etc.). You may not distribute, bundle, wrap or subclass the SOFTWARE as Developed Software which, when used in a "designtime" development environment, exposes the programmatic interface of the SOFTWARE. You may distribute, on a royalty-free basis, Redistributable Files with Developed Software only. You may not add or transfer the SOFTWARE serial number to the computer where the Developed Software is installed. Users of the Developed Software may not use the SOFTWARE or the Redistributable Files, directly or indirectly, for development purposes. In particular, if you create a control (or user control) using the SOFTWARE as a constituent control, you are not licensed to distribute the control you created with the SOFTWARE to users for development purposes. 4. Specific Product Limitations. Notwithstanding anything in this EULA to the contrary, if the license you have purchased is for any of the following products, then the following additional limitations will apply: a. ComponentOne Reports for .NET Designer Edition. ComponentOne Reports for .NET Designer Edition includes at least: 1) one dynamic link library file (c1.win.c1reportdesigner.dll) known as C1ReportDesigner Component, 2) one executable file (ReportDesigner.exe) known as C1ReportDesigner Application and, 3) the Source Code of the C1ReportDesigner Application. The C1ReportDesigner Component is subject to the general terms and restrictions set forth in this EULA. The C1ReportDesigner Application is an executable file used to design and prepare reports; the C1ReportDesigner Application may be distributed, free of royalties, only in conjunction with the Developed Software. C1 hereby also grants you the right to use and to modify the C1ReportDesigner Application Source Code to create derivative works that are based on the licensed Source Code. You may distribute such derivative

END-USER LICENSE AGREEMENT FOR COMPONENTONE SOFTWARE 19

works, solely in object code format and exclusively in conjunction with and/or as a part of the Developed Software. You are expressly not granted the right to distribute, disclose or otherwise make available to any third party the licensed Source Code, any portion, modified version or derivative work thereof, in source code format. C1 shall retain all right, title and interest in and to the licensed Source Code, and all C1 updates, modifications or enhancements thereof. Nothing herein shall be deemed to transfer any ownership or title rights in and to the licensed Source Code from C1 to you. SOURCE CODE IS LICENSED TO YOU AS IS. C1 DOES NOT AND SHALL NOT PROVIDE YOU WITH ANY TECHNICAL SUPPORT FOR YOUR SOURCE CODE LICENSE. b. VSView Reporting Edition (ActiveX). VSView Reporting Edition includes at least one executable file listed as VSRptX.exe (where X indicates the version number i.e.7,8, etc.), known as Designer. The file "VSRptX.exe, or any upgrade or future versions of the Designer, are subject to the restrictions set forth in this EULA and may not be distributed with your Developed Software or in any other way. c. Studio Products. You may not share the component parts of the Studio Products licensed to you with other Developers, nor may you allow the use and/or installation of such components by other Developers. 5. Updates/Upgrades; Studio Subscription. Subject to the terms and conditions of this EULA, the Licenses are perpetual. Updates and upgrades to the SOFTWARE may be provided by C1 from time-to-time, and, if so provided by C1, are provided upon the terms and conditions offered at that time by C1 in its sole discretion. C1 may provide updates and upgrades to the SOFTWARE for free or for any charge, at any time or never, and through its chosen manner of access and distribution, all in C1's sole discretion. C1 licenses certain of its separately-licensed products bundled together in a product suite, called the C1 "Studio" product line (the "Studio Products"). The exact separately-licensed products that are bundled into the Studio Products may change from time-to-time in C1's sole discretion. If the SOFTWARE is identified as a C1 "Studio" product, then the SOFTWARE is one of the Studio Products. The SOFTWARE and the Studio Products are revised from time-to-time (meaning, for example, revised with updates, upgrades and, in the case of Studio products, some times changes to the mix of products included in the bundle). To receive any such revisions to the SOFTWARE or the Studio Products, as the case may be, you must have a valid SOFTWARE license or a valid Studio subscription. Together with the Licenses, the original purchaser is granted a one-year subscription from the date of purchase. Upon expiration, you must renew your license subscription to continue to be entitled to receive SOFTWARE and/or the Studio Products revisions as the case may be. 6. Serial Number. With your license, you will be issued a unique serial number (the "Serial Number") used for the activation of the SOFTWARE. The Serial Number is subject to the restrictions set forth in this EULA and may not be disclosed or distributed either with your Developed Software or in any other way. The disclosure or distribution of the Serial Number constitutes a breach of this EULA, the effect of which shall be the immediate termination and revocation of all the rights granted herein. 7. Evaluation Copy. If you are using an "evaluation copy", specifically designated as such by C1 on its website or elsewhere, then the Licenses are limited as follows: a) you are granted a license to use the SOFTWARE for a period of thirty (30) days counted from the day of installation (the "Evaluation Period"); b) upon completion of the Evaluation Period, you shall either i) delete the SOFTWARE from the computer containing the installation, or you may ii) obtain a paid license of the SOFTWARE from C1 or any of its resellers; and c) any Developed Software developed with the Evaluation Copy may not be distributed or used for any commercial purpose. III. INTELLECTUAL PROPERTY. 1. Copyright. You agree that all right, title, and interest in and to the SOFTWARE (including, but not limited to, any images, photographs, animations, video, audio, music, text, and applets incorporated into the SOFTWARE), and any copies of the SOFTWARE, and any copyrights and other intellectual properties therein or related thereto are owned exclusively by C1, except to the limited extent that C1 may be the rightful license holder of certain third-party technologies incorporated into the SOFTWARE. The SOFTWARE is protected by copyright laws and international treaty provisions. The SOFTWARE is

20 Welcome to ComponentOne FlexGrid for .NET (2.0)

licensed to you, not sold to you. C1 reserves all rights not otherwise expressly and specifically granted to you in this EULA. 2. Backups. You may make a copy of the SOFTWARE solely for backup or archival purposes. Notwithstanding the foregoing, you may not copy the printed Documentation. 3. General Limitations. You may not reverse engineer, decompile, or disassemble the SOFTWARE, except and only to the extent that applicable law expressly permits such activity notwithstanding this limitation. 4. Software Transfers. You may not rent or lease the SOFTWARE. You may permanently transfer all of your rights under the EULA, provided that you retain no copies, that you transfer all the SOFTWARE (including all component parts, the media and printed materials, any updates, upgrades, this EULA and, if applicable, the Certificate of Authenticity), and that the transferee agrees to be bound by the terms of this EULA. If the SOFTWARE is an update or upgrade, any transfer must include all prior versions of the SOFTWARE. 5. Termination. Without prejudice to any other rights it may have, C1 may terminate this EULA and the Licenses if you fail to comply with the terms and conditions contained herein. In such an event, you must destroy all copies of the SOFTWARE and all of its component parts. 6. Export Restrictions. You acknowledge that the SOFTWARE is of U.S. origin. You acknowledge that the license and distribution of the SOFTWARE is subject to the export control laws and regulations of the United States of America, and any amendments thereof, which restrict exports and re-exports of software, technical data, and direct products of technical data, including services and Developed Software. You agree that you will not export or re-export the SOFTWARE or any Developed Software, or any information, documentation and/or printed materials related thereto, directly or indirectly, without first obtaining permission to do so as required from the United States of America Department of Commerce's Bureau of Industry and Security ("BIS"), or other appropriate governmental agencies, to any countries, end-users, or for any end-uses that are restricted by U.S. export laws and regulations, and any amendments thereof, which include, but are not limited to: Restricted Countries, Restricted End-Users, and Restricted End-Uses. These restrictions change from time to time. You represent and warrant that neither the BIS nor any other United States federal agency has suspended, revoked or denied your export privileges. C1 acknowledges that it shall use reasonable efforts to supply you with all reasonably necessary information regarding the SOFTWARE and its business to enable you to fully comply with the provisions of this Section. If you have any questions regarding your obligations under United States of America export regulations, you should contact the Bureau of Industry and Security, United States Department of Commerce, Exporter Counseling Division, Washington DC. U.S.A. (202) 482-4811, http://www.bis.doc.gov. 7. U.S. Government Restricted Rights. The SOFTWARE and documentation are provided with RESTRICTED RIGHTS. You will comply with any requirements of the Government to obtain such RESTRICTED RIGHTS protection, including without limitation, the placement of any restrictive legends on the SOFTWARE, and any license agreement used in connection with the distribution of the SOFTWARE. Manufacturer is ComponentOne, LLC, 201 South Highland Avenue , 3rd Floor, Pittsburgh, Pennsylvania 15206 USA. For solicitations issued by the Government on or after December 1, 1995 and the Department of Defense on or after September 29, 1995, the only rights provided in the software and documentation provided herein shall be those contained in this EULA. Under no circumstances shall C1 be obligated to comply with any Governmental requirements regarding the submission of or the request for exemption from submission of cost or pricing data or cost accounting requirements. For any distribution of the SOFTWARE that would require compliance by C1 with the Government's requirements relating to cost or pricing data or cost accounting requirements, you must obtain an appropriate waiver or exemption from such requirements for the benefit of C1 from the appropriate Government authority before the distribution and/or license of the SOFTWARE to the Government. IV. WARRANTIES AND REMEDIES. 1. Limited Warranty. C1 warrants that the original media, if any, are free from defects for ninety (90) days from the date of delivery of the SOFTWARE. C1 also warrants that: (i) it has the full power to enter into this Agreement and grant the license rights set forth herein; (ii) it has not granted and will not grant any

END-USER LICENSE AGREEMENT FOR COMPONENTONE SOFTWARE 21

rights in the Software to any third party which grant is inconsistent with the rights granted to you in this Agreement; and (iii) the Software does not and will not infringe any trade secret, copyright, trademark or other proprietary right held by any third party and does not infringe any patent held by any third party. EXCEPT AS OTHERWISE PROVIDED IN THE PRECEDING SENTENCE, AND TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, C1 EXPRESSLY DISCLAIMS ANY WARRANTY FOR THE SOFTWARE, DOCUMENTATION AND ANYTHING ELSE PROVIDED BY C1 HEREBY AND C1 PROVIDES THE SAME IN AS IS CONDITION WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE AND DOCUMENTATION REMAINS WITH YOU. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS. YOU MAY HAVE OTHERS WHICH VARY FROM STATE TO STATE. 2. Limited Remedy. C1 PROVIDES NO REMEDIES OR WARRANTIES, WHETHER EXPRESS OR IMPLIED, FOR ANY SAMPLE APPLICATION CODE, REDISTRIBUTABLE FILES, TRIAL VERSION AND THE NOT FOR RESALE VERSION OF THE SOFTWARE. ANY SAMPLE APPLICATION CODE, TRIAL VERSION AND THE NOT FOR RESALE VERSION OF THE SOFTWARE ARE PROVIDED AS IS. C1's entire liability and your exclusive remedy under this EULA shall be, at C1's sole option, either (a) return of the price paid for the SOFTWARE; (b) repair the SOFTWARE through updates distributed online or otherwise in C1's discretion; or (c) replace the SOFTWARE with SOFTWARE that substantially performs as described in the SOFTWARE documentation, provided that you return the SOFTWARE in the same manner as provided in Section I.2 for return of the SOFTWARE for nonacceptance of this EULA. Any media for any repaired or replacement SOFTWARE will be warranted for the remainder of the original warranty period or thirty (30) days, whichever is longer. THESE REMEDIES ARE NOT AVAILABLE OUTSIDE OF THE UNITED STATES OF AMERICA. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL C1 BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFIT, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE, EVEN IF C1 HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME STATES/JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES IN CERTAIN CASES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU. V. MISCELLANEOUS. 1. This is the Entire Agreement. This EULA (including any addendum to this EULA included with the SOFTWARE) is the final, complete and exclusive statement of the entire agreement between you and C1 relating to the SOFTWARE. This EULA supersedes any prior and contemporaneous proposals, purchase orders, advertisements, and all other communications in relation to the subject matter of this EULA, whether oral or written. No terms or conditions, other than those contained herein, and no other understanding or agreement which in any way modifies these terms and conditions, shall be binding upon the parties unless entered into in writing executed between the parties, or by other non-oral manner of agreement whereby the parties objectively and definitively act in a manner to be bound (such as by continuing with an installation of the SOFTWARE, etc.). Employees, agents and other representatives of C1 are not permitted to orally modify this EULA. 2. You Indemnify C1. You agree to indemnify, hold harmless, and defend C1 and its suppliers and resellers from and against any and all claims or lawsuits, including attorney's fees, which arise out of or result from your distribution of your Developed Software, your Developed Web Server Software or from your breach of any of the terms and conditions of this EULA. 3. Interpretation of this EULA. If for any reason a court of competent jurisdiction finds any provision of this EULA, or any portion thereof, to be unenforceable, that provision of this EULA will be enforced to

22 Welcome to ComponentOne FlexGrid for .NET (2.0)

the maximum extent permissible so as to effect the intent of the parties, and the remainder of this EULA will continue in full force and effect. Formatives of defined terms shall have the same meaning of the defined term. Failure by either party to enforce any provision of this EULA will not be deemed a waiver of future enforcement of that or any other provision. Except as otherwise required or superseded by law, this EULA is governed by the laws of the Commonwealth of Pennsylvania, without regard to its conflict of laws principles. The parties consent to the personal jurisdiction and venue of the Commonwealth of Pennsylvania, in the County of Allegheny, and agree that any legal proceedings arising out of this EULA shall be conducted solely in such Commonwealth. If the SOFTWARE was acquired outside the United States, then local law may apply.

Licensing FAQs
This section describes the main technical aspects of licensing. It may help the user to understand and resolve licensing problems he may experience when using ComponentOne .NET and ASP.NET products.

What is Licensing?
Licensing is a mechanism used to protect intellectual property by ensuring that users are authorized to use software products. Licensing is not only used to prevent illegal distribution of software products. Many software vendors, including ComponentOne, use licensing to allow potential users to test products before they decide to purchase them. Without licensing, this type of distribution would not be practical for the vendor or convenient for the user. Vendors would either have to distribute evaluation software with limited functionality, or shift the burden of managing software licenses to customers, who could easily forget that the software being used is an evaluation version and has not been purchased.

How does Licensing Work?


ComponentOne uses a licensing model based on the standard set by Microsoft, which works with all types of components. Note: The Compact Framework components use a slightly different mechanism for run-time licensing than the other ComponentOne components due to platform differences. When a user decides to purchase a product, he receives an installation program and a Serial Number. During the installation process, the user is prompted for the serial number that is saved on the system. (Users can also enter the serial number by clicking the License button on the About Box of any ComponentOne product, if available, or by rerunning the installation and entering the serial number in the licensing dialog.) When a licensed component is added to a form or Web page, Visual Studio obtains version and licensing information from the newly created component. When queried by Visual Studio, the component looks for licensing information stored in the system and generates a run-time license and version information, which Visual Studio saves in the following two files: An assembly resource file which contains the actual run-time license A "licenses.licx" file that contains the licensed component strong name and version information

These files are automatically added to the project. In winforms and ASP.NET 1.x applications, the run-time license is stored as an embedded resource in the assembly hosting the component or control by Visual Studio. In ASP.NET 2.x applications, the run-time license may also be stored as an embedded resource in the App_Licenses.dll assembly, which is used to store all run-time licenses for all components directly hosted by webforms in the application. Thus, the App_licenses.dll must always be deployed with the application.

Licensing FAQs 23

The licenses.licx file is a simple text file that contains strong names and version information for each of the licensed components used in the application. Whenever Visual Studio is called upon to rebuild the application resources, this file is read and used as a list of components to query for run-time licenses to be embedded in the appropriate assembly resource. Note that editing or adding an appropriate line to this file can force Visual Studio to add run-time licenses of other controls as well. Note that the licenses.licx file is usually not shown in the Solution Explorer; it appears if you press the Show All Files button in the Solution Explorer's toolbox, or from Visual Studio's main menu, select Show All Files on the Project menu. Later, when the component is created at run time, it obtains the run-time license from the appropriate assembly resource that was created at design time and can decide whether to simply accept the run-time license, to throw an exception and fail altogether, or to display some information reminding the user that the software has not been licensed. All ComponentOne products are designed to display licensing information if the product is not licensed. None will throw licensing exceptions and prevent applications from running.

Common Scenarios
The following topics describe some of the licensing scenarios you may encounter.

Creating components at design time


This is the most common scenario and also the simplest: the user adds one or more controls to the form, the licensing information is stored in the licenses.licx file, and the component works. Note that the mechanism is exactly the same for Windows Forms and Web Forms (ASP.NET) projects.

Creating components at run time


This is also a fairly common scenario. You do not need an instance of the component on the form, but would like to create one or more instances at run time. In this case, the project will not contain a licenses.licx file (or the file will not contain an appropriate run-time license for the component) and therefore licensing will fail. To fix this problem, add an instance of the component to a form in the project. This will create the licenses.licx file and things will then work as expected. (The component can be removed from the form after the licenses.licx file has been created). Adding an instance of the component to a form, then removing that component, is just a simple way of adding a line with the component strong name to the licenses.licx file. If desired, you can do this manually using notepad or Visual Studio itself by opening the file and adding the text. When Visual Studio recreates the application resources, the component will be queried and its run-time license added to the appropriate assembly resource.

Inheriting from licensed components


If a component that inherits from a licensed component is created, the licensing information to be stored in the form is still needed. This can be done in two ways: Add a LicenseProvider attribute to the component.

24 Welcome to ComponentOne FlexGrid for .NET (2.0)

This will mark the derive component class as licensed. When the component is added to a form, Visual Studio will create and manage the licenses.licx file, and the base class will handle the licensing process as usual. No additional work is needed. For example: [LicenseProvider(typeof(LicenseProvider))] class MyGrid: C1.Win.C1FlexGrid.C1FlexGrid { // ... } Add an instance of the base component to the form. This will embed the licensing information into the licenses.licx file as in the previous scenario, and the base component will find it and use it. As before, the extra instance can be deleted after the licenses.licx file has been created.

Using licensed components in console applications


When building console applications, there are no forms to add components to, and therefore Visual Studio won't create a licenses.licx file. In these cases, create a temporary Windows Forms application and add all the desired licensed components to a form. Then close the Windows Forms application and copy the licenses.licx file into the console application project. Make sure the licenses.licx file is configured as an embedded resource. To do this, right-click the licenses.licx file in the Solution Explorer window and select Properties. In the property window, set the Build Action property to Embedded Resource.

Using licensed components in Visual C++ applications


There is an issue in VC++ 2003 where the licenses.licx is ignored during the build process; therefore, the licensing information is not included in VC++ applications. To fix this problem, extra steps must be taken to compile the licensing resources and link them to the project. Note the following: 1. 2. 3. 4. 5. Build the C++ project as usual. This should create an exe file and also a licenses.licx file with licensing information in it. Copy the licenses.licx file from the app directory to the target folder (Debug or Release). Copy the C1Lc.exe utility and the licensed dlls to the target folder. (Don't use the standard lc.exe, it has bugs.) Use C1Lc.exe to compile the licenses.licx file. The command line should look like this: c1lc /target:MyApp.exe /complist:licenses.licx /i:C1.Win.C1FlexGrid.dll Link the licenses into the project. To do this, go back to Visual Studio, right-click the project, select properties, and go to the Linker/Command Line option. Enter the following: /ASSEMBLYRESOURCE:Debug\MyApp.exe.licenses Rebuild the executable to include the licensing information in the application.

6.

Troubleshooting
We try very hard to make the licensing mechanism as unobtrusive as possible, but problems may occur for a number of reasons. Below is a description of the most common problems and their solutions.

Licensing FAQs 25

I have a licensed version of a ComponentOne product but I still get the splash screen when I run my project.
If this happens, there may be a problem with the licenses.licx file in the project. It either doesn't exist, contains wrong information, or is not configured correctly. First, try a full rebuild (Rebuild All from the Visual Studio Build menu). This will usually rebuild the correct licensing resources. If that fails follow these steps: 1. 2. 3. 4. Open the project and go to the Solution Explorer window. Click the Show All Files button on the top of the window. Find the licenses.licx file and open it. If prompted, continue to open the file. Change the version number of each component to the appropriate value. If the component does not appear in the file, obtain the appropriate data from another licenses.licx file or follow the alternate procedure following. Save the file, then close the licenses.licx tab. Rebuild the project using the Rebuild All option (not just Rebuild). Open the project and go to the Solution Explorer window. Click the Show All Files button on the top of the window. Find the licenses.licx file and delete it. Close the project and reopen it. Open the main form and add an instance of each licensed control. Check the Solution Explorer window, there should be a licenses.licx file there. Rebuild the project using the Rebuild All option (not just Rebuild). Open the project and go to the Solution Explorer window. Find the licenses.licx file and right-click it. Select the Rebuild Licenses option (this will rebuild the App_Licenses.licx file). Rebuild the project using the Rebuild All option (not just Rebuild).

5. 6. 1. 2. 3. 4. 5. 6. 7. 1. 2. 3. 4.

Alternatively, follow these steps:

For ASP.NET 2.x applications, follow these steps:

I have a licensed version of a ComponentOne product on my Web server but the components still behave as unlicensed.
There is no need to install any licenses on machines used as servers and not used for development. The components must be licensed on the development machine, therefore the licensing information will be saved into the executable (exe or dll) when the project is built. After that, the application can be deployed on any machine, including Web servers. For ASP.NET 2.x applications, be sure that the App_Licenses.dll assembly created during development of the application is deployed to the bin application bin directory on the Web server. If your ASP.NET application uses winforms user controls with constituent licensed controls, the run-time license is embedded in the winforms user control assembly. In this case, you must be sure to rebuild and update the user control whenever the licensed embedded controls are updated.

26 Welcome to ComponentOne FlexGrid for .NET (2.0)

I downloaded a new build of a component that I have purchased, and now I'm getting the splash screen when I build my projects.
Make sure that the serial number is still valid. If you licensed the component over a year ago, your subscription may have expired. In this case, you have two options: Option 1 - Renew your subscription to get a new serial number. If you choose this option, you will receive a new serial number that you can use to license the new components (from the installation utility or directly from the About Box). The new subscription will entitle you to a full year of upgrades and to download the latest maintenance builds directly from http://prerelease.componentone.com/. Option 2 Continue to use the components you have. Subscriptions expire, products do not. You can continue to use the components you received or downloaded while your subscription was valid.

Technical Support
ComponentOne Studio Enterprise is developed and supported by ComponentOne LLC, a company formed by the merger of APEX Software Corporation and VideoSoft. ComponentOne offers various support options. For a complete list and a description of each, visit the ComponentOne Web site at http://www.componentone.com/Support. Some methods for obtaining technical support include: Online Support via HelpCentral ComponentOne HelpCentral provides customers with a comprehensive set of technical resources in the form of FAQs, samples, TechTips, Version Release History, Articles, searchable Knowledge Base, searchable Online Help and more. We recommend this as the first place to look for answers to your technical questions. Online Support via our Incident Submission Form This online support service provides you with direct access to our Technical Support staff via an online incident submission form. When you submit an incident, you'll immediately receive a response via e-mail confirming that you've successfully created an incident. This email will provide you with an Issue Reference ID and will provide you with a set of possible answers to your question from our Knowledgebase. You will receive a response from one of the ComponentOne staff members via e-mail in 2 business days or less. Peer-to-Peer Product Forums and Newsgroups ComponentOne peer-to-peer product forums and newsgroups are available to exchange information, tips, and techniques regarding ComponentOne products. ComponentOne sponsors these areas as a forum for users to share information. While ComponentOne does not provide direct support in the forums and newsgroups, we periodically monitor them to ensure accuracy of information and provide comments when appropriate. Please note that a ComponentOne User Account is required to participate in the ComponentOne Product Forums. Installation Issues Registered users can obtain help with problems installing ComponentOne products. Contact technical support by using the online incident submission form or by phone (412.681.4738). Please note that this does not include issues related to distributing a product to end-users in an application. Documentation ComponentOne documentation is available with each of our products in HTML Help, Microsoft Help 2.0 (.NET, ASP.NET and Mobile Device products only), and PDF format. All of the PDFs are also available

Redistributable Files 27

on HelpCentral. If you have suggestions on how we can improve our documentation, please email the Documentation team. Please note that e-mail sent to the Documentation team is for documentation feedback only. Technical Support and Sales issues should be sent directly to their respective departments. Note: You must create a ComponentOne Account and register your product with a valid serial number to obtain support using some of the above methods.

Redistributable Files
ComponentOne FlexGrid for .NET is developed and published by ComponentOne LLC. You may use it to develop applications in conjunction with Microsoft Visual Studio or any other programming environment that enables the user to use and integrate the control(s). You may also distribute, free of royalties, the following Redistributable Files with any such application you develop to the extent that they are used separately on a single CPU on the client/workstation side of the network: C1.Win.C1FlexGrid.Classic.2.dll C1.Win.C1FlexGrid.2.dll

Site licenses are available for groups of multiple developers. Please contact Sales@ComponentOne.com for details.

Namespaces
Namespaces organize the objects defined in an assembly. Assemblies can contain multiple namespaces, which can in turn contain other namespaces. Namespaces prevent ambiguity and simplify references when using large groups of objects such as class libraries. The general namespace for ComponentOne Windows products is C1.Win. The namespace for the FlexGrid control is C1.Win.C1FlexGrid. The following code fragment shows how to declare a C1FlexGrid control using the fully qualified name for this class: Visual Basic Dim flex As C1.Win.C1FlexGrid.C1FlexGrid C# C1.Win.C1FlexGrid.C1FlexGrid flex; Delphi var flex: C1.Win.C1FlexGrid;

Namespaces address a problem sometimes known as namespace pollution, in which the developer of a class library is hampered by the use of similar names in another library. These conflicts with existing components are sometimes called name collisions. For example, if you create a new class named Column, you can use it inside your project without qualification. However, the C1FlexGrid assembly also implements a class called Column. So, if you want to use the C1FlexGrid class in the same project, you must use a fully qualified reference to make the reference unique. If the reference is not unique, Visual Studio .NET produces an error stating that the name is ambiguous. The following code snippet demonstrates how to declare these objects: Visual Basic ' Define a new Column object (custom Column class). Dim MyCol as Column ' Define a new C1FlexGrid.Column object. Dim FlexCol as C1.Win.C1FlexGrid.Column

28 Welcome to ComponentOne FlexGrid for .NET (2.0)

C# // Define a new Column object (custom Column class). Column MyCol; // Define a new C1FlexGrid.Column object. C1.Win.C1FlexGrid.Column FlexCol;

Delphi var // Define a new Column object (custom Column class). MyCol: Column; // Define a new C1FlexGrid.Column object. FlexCol: C1.Win.C1FlexGrid.Column;

Fully qualified names are object references that are prefixed with the name of the namespace where the object is defined. You can use objects defined in other projects if you create a reference to the class (by choosing Add Reference from the Project menu) and then use the fully qualified name for the object in your code. Fully qualified names prevent naming conflicts because the compiler can always determine which object is being used. However, the names themselves can get long and cumbersome. To get around this, you can use the Imports statement (import in C#, uses in Delphi) to define an alias an abbreviated name you can use in place of a fully qualified name. For example, the following code snippet creates aliases for two fully qualified names, and uses these aliases to define two objects: Visual Basic Imports C1Column = C1.Win.C1FlexGrid.Column Imports MyColumn = MyProject.Column Dim c1 As C1Column Dim c2 As MyColumn C# using C1Column = C1.Win.C1FlexGrid.Column; using MyColumn = MyProject.Column; C1Column c1; MyColumn c2; Delphi uses C1.Win.C1FlexGrid.Column, MyProject.Column; var c2: MyColumn; c1: C1Column; If you use the Imports statement without an alias, you can use all the names in that namespace without qualification provided they are unique to the project.

Creating a .NET 2.0 Project


To create a new .NET project, complete the following steps: 1. 2. From the File menu in Microsoft Visual Studio .NET, select New Project. The New Project dialog box opens. Under Project Types, choose either Visual Basic or Visual C#, and select Windows Application from the list of Templates in the right pane.

Adding the C1FlexGrid Component to a Project 29

3.

Enter a name for your application in the Name field and click OK. A new Microsoft Visual Studio .NET project is created and a new Form1 is displayed in the Designer view.

4.

Double-click the C1FlexGrid components from the Toolbox to add them to Form1. For information on adding a component to the toolbox, see Adding the C1FlexGrid Component to a Project (page 29).

Adding the C1FlexGrid Component to a Project


When you install ComponentOne Studio for .NET 2.0, the Create a ComponentOne Visual Studio 2005 Toolbox Tab checkbox is checked, by default, in the installation wizard. When you open Visual Studio 2005, you will notice a ComponentOne Studio for .NET 2.0 tab containing the ComponentOne controls has automatically been added to the Toolbox.

30 Welcome to ComponentOne FlexGrid for .NET (2.0)

If you decide to uncheck the Create a ComponentOne Visual Studio 2005 Toolbox Tab checkbox during installation, you can manually add ComponentOne controls to the Toolbox at a later time. ComponentOne FlexGrid for .NET provides the following controls: C1FlexGrid C1FlexGridClassic

To use C1FlexGrid, add these controls to the form or add a reference to the C1.Win.C1FlexGrid assembly to your project. Manually Adding C1FlexGrid to the Toolbox When you install C1FlexGrid, the following C1FlexGrid components will appear in the Visual Studio Toolbox customization dialog box: 1. 2. C1FlexGrid C1FlexGridClassic Open the Visual Studio IDE (Microsoft Development Environment). Make sure the Toolbox is visible (select Toolbox in the View menu if necessary) and right-click it to open the context menu. To make C1FlexGrid and C1FlexGridClassic component appear on its own tab in the Toolbox, select Add Tab from the context menu and type in the tab name, C1FlexGrid, for example.

To manually add the C1FlexGrid control to the Visual Studio Toolbox:

3. 4.

Right-click the tab where the component is to appear and select Choose Items from the context menu. The Choose Toolbox Items dialog box opens. In the dialog box, select the .NET Framework Components tab. Sort the list by Namespace (click the Namespace column header) and check the check boxes for all components belonging to namespace C1.Win.C1FlexGrid. Note that there may be more than one component for each namespace.

Migrating a C1FlexGrid Project to Visual Studio 2005 31

Adding C1FlexGrid to the Form To add C1FlexGrid to a form: 1. 2. Add it to the Visual Studio toolbox. Double-click the control or drag it onto your form.

Adding a Reference to the Assembly To add a reference to the C1FlexGrid assembly: 1. 2. 3. Select the Add Reference option from the Project menu of your project. Select the ComponentOne C1FlexGrid assembly from the list on the .NET tab or browse to find the C1.Win.C1FlexGrid.2.dll file and click OK. Double-click the form caption area to open the code window. At the top of the file, add the following Imports statements (using in C#; uses in Delphi): Imports C1.Win.C1FlexGrid Note: This makes the objects defined in the C1BarCode assembly visible to the project. See Namespaces (page 27) for more information.

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.

32 Welcome to ComponentOne FlexGrid for .NET (2.0)

2.

Locate the .sln file for the project that you wish to convert to Visual Studio 2005. Select it and click Open. The Visual Studio Conversion Wizard appears.

3.

Click Next.

Migrating a C1FlexGrid Project to Visual Studio 2005 33

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 2005. The Conversion Complete window appears.

34 Welcome to ComponentOne FlexGrid for .NET (2.0)

6.

Click Show the conversion log when the wizard is closed if you want to view the conversion log.

7. 8.

Click Close. The project opens. Now you must remove references to any of the previous ComponentOne .dlls and add references to the new ones. Go to the Solution Explorer (View | Solution Explorer) and click the Show All Files button. Note: The Show All Files button does not appear in the Solution Explorer toolbar if the Solution project node is selected.

9.

Expand the References node, right-click C1.Common and select Remove. Also remove C1.Win.C1FlexGrid the same way.

10. Right-click the References node and select Add Reference. 11. Locate and select C1.Win.C1FlexGrid.2.dll. Click OK to add it to the project.

Migrating a C1FlexGrid Project to Visual Studio 2005 35

To update the .licx file: 1. In the Solution Explorer, right-click the licenses.licx file and select Delete.

2. 3.

Click OK to permanently delete licenses.licx. The project must be rebuilt to create a new, updated version of the .licx file. Click the Start Debugging button to compile and run the project. The new .licx file may not be visible in the Solution Explorer.

36 Welcome to ComponentOne FlexGrid for .NET (2.0)

4.

Select File, Close to close the form and then double-click the Form.vb or Form.cs file in the Solution Explorer to reopen it. The new licenses.licx file appears in the list of files.

The migration process is complete.

Using the C1FlexGrid Control 37

Using the C1FlexGrid Control


The C1FlexGrid control allows you to display, edit, group and summarize data in a grid format. The grid can be bound to a data source or it can manage its own data. The C1FlexGrid control has a rich object model with the following elements:

The following sections walk you through the main features in the C1FlexGrid control: Layout Selection Editing Cells Describes how to set up the grid dimensions and layout. Describes the concepts of "current cell" and "selection". Describes how to implement simple text editing, drop-down lists and combo lists, cell buttons, editing masks, and data validation.

38 Using the C1FlexGrid Control

Formatting Cells

Describes how to customize the appearance of the grid by formatting numbers, dates, and Boolean values, or by changing fonts, colors, alignment, and pictures for individual cells or ranges. Describes how to change the grid display so that cells with similar contents are merged, creating "grouped" views that highlight relationships in the data. Describes how to add subtotals to grids and how to build outline trees. Discusses the basic aspects of ADO/OLEDB and DAO data-binding. Describes how you can save the contents or formatting of a grid and re-load it later, or exchange grid data with other applications such as Microsoft Access and Excel. This section also shows how you can print grids. Presents a map of the main C1FlexGrid properties cross-referenced by function.

Merging Cells Outlining and Summarizing Data Binding Saving, Loading, and Printing Property Groups

Layout
A C1FlexGrid control consists of rows and columns. The collections of rows and columns is exposed by the Rows and Cols properties. When the grid is bound to a data source, the number of rows and columns is determined by how much data is available in the data source. In unbound mode, you can set them to arbitrary values using the Count property in the collections. For example, the code below sets the grid dimensions to 500 rows by 10 columns: Visual Basic fg.Rows.Count = 500 fg.Cols.Count = 10 C# fg.Rows.Count = 500; fg.Cols.Count = 10; Delphi fg.Rows.Count := 500; fg.Cols.Count := 10;

There are two basic types of rows and columns: fixed and scrollable. Fixed rows remain on the top of the grid when the user scrolls the grid vertically, and fixed columns remain on the left of the grid when the user scrolls the grid horizontally. Fixed cells are useful for displaying row and column header information. (The counts returned by the Count property include fixed and scrollable cells) You can set the number of fixed rows and columns using the Fixed property in the Rows and Cols collections. For example, the code below creates a grid with two fixed rows and no fixed columns: Visual Basic fg.Rows.Fixed = 1 fg.Cols.Fixed = 0 C# fg.Rows.Fixed = 1; fg.Cols.Fixed = 0; Delphi fg.Rows.Fixed := 1; fg.Cols.Fixed := 0;

The Rows and Cols collections also contain methods for inserting, deleting, and moving rows and columns on the grid. You can use their Item property (an indexer) to access individual elements (rows and columns) in each collection.

Design Time Interaction 39

If you prefer, you can set up the grid columns at design time instead of writing code to do it using the C1FlexGrid Column Editor. For details on editing columns using the C1FlexGrid Column Editor, see C1FlexGrid Column Editor (page 40).

Design Time Interaction


You can easily configure FlexGrid for .NET at design time using the property grid, menus, and designers in Visual Studio. The following sections describe how to use C1FlexGrid's design-time environment to configure the C1FlexGrid (page 268) control.

Column Sizing
The width of a column is determined by its Width property. At design time, the Width property can be set directly in the grid or through the C1FlexGrid Column Editor. In the grid, clicking and dragging the horizontal double arrow that appears at the right edge of a column's header allows the column to be resized.

The dotted vertical line indicates how the grid will be resized. Dragging the pointer to the left makes the column smaller; dragging it to the right makes the column larger. The column's Column.idth property will be adjusted when the resize operation is complete. In the C1FlexGrid Column Editor or in code, specify the value of the Width property for a column. For details on the C1FlexGrid Column Editor, see C1FlexGrid Column Editor (page 40). The following code sets the Width property of Column1 to 10: Visual Basic Me.C1FlexGrid1.Cols(1).Width = 10 C# this.c1FlexGrid1.Cols[1].Width = 10; Delphi Self.C1FlexGrid1.Cols[1].Width := 10;

40 Using the C1FlexGrid Control

To prevent resizing a specific column, set the AllowResizing property for the column to False either in the Column Tasks menu or C1FlexGrid Column Editor, or in code. For details on the Column Tasks menu, see Column Tasks Menu (page 52). The following code sets the AllowResizing property for Column1 to False: Visual Basic Me.C1FlexGrid1.Cols(1).AllowResizing = False C# this.c1FlexGrid1.Cols[1].AllowResizing = false; Delphi Self.C1FlexGrid1.Cols[1].AllowResizing := False;

C1FlexGrid Editors
There two are design-time editors that allow you to control the layout an appearance of C1FlexGrid, C1FlexGrid Column Editor and C1FlexGrid Style Editor. Additionally, Caption Style and Column Style are two design-time editors that allow you to change the appearance of a specific caption or column.

C1FlexGrid Column Editor


If you prefer, you can set up the grid columns at design time instead of writing code to do it. The designer can be accessed in one of three ways: Select the grid in .NET, go to the Properties window and click the ellipsis button () next to the Cols property. Right-click the control and select Designer from the context menu. Click on the smart tag ( Tasks menu. ) in the upper right corner of the grid and select Designer from the C1FlexGrid

This will bring up the Column Editor shown below:

Design Time Interaction 41

In bound mode, the editor can be used to select which fields in the DataSource should be displayed, their order, column captions, widths, and alignment. In unbound mode, the editor is also used to select column data types. The editor allows you to perform the following actions: Reorder Columns: You can move columns to new positions by dragging them by the header cells with the mouse. Adjust Column Widths: You can adjust column widths with the mouse, by dragging the right edge of the header cells with the mouse. You can also select multiple columns by shift-clicking the header cells, and then set all column widths at once using the property window. Setting the column width to 1 restores the default width. Set Column Properties: Whenever one or more columns are selected, you can see and edit their properties in the property grid on the left of the editor. Insert or Remove Columns: Use the toolbar to insert columns before or after the selection (useful mostly in unbound mode), or to remove columns. Use the Toolbar to Perform Common Tasks: The table below describes the function of the buttons on the toolbar: Font: Sets the selected font in the drop-down list. Font Size: Sets the selected font size in the drop-down list. Font Formatting: Applies bold, italics or underline to the font. Justification: Sets the font alignment to left, center, right or general. Alignment: Aligns column content to the top, center, or bottom. These buttons only affect the scrollable area of the grid. To set the alignment for the header columns, select the columns and set the TextAlignFixed property. BackColor: Sets the backcolor of the selected column. ForeColor: Sets the forecolor of the selected column. Apply to Fixed Rows: Applies the settings to fixed rows. Help: Displays or hides the description for the selected property. Undo: Cancels all changes and reverts the grid columns to their original state. AutoResize: Determines whether the grid should automatically resize all columns to fit their contents when the grid is bound to a data source. Reload from Datasource: Resets all columns with information from the current DataSource. This button is useful when the grid is bound to a data source and you want to start editing from scratch. The button is disabled when the grid is not bound to a data source. Selected Column: Selects the current column from the drop-down list.

42 Using the C1FlexGrid Control

Insert Column: Inserts columns to the left or right of the selection. Delete Column: Removes the selected column. Column Width: Sets the column width of all selected columns to the same width, wider or narrower. Toggle Visibility: Displays or hides a column. Unhide All Columns: Makes all columns visible. Show Hidden Columns: Shows hidden columns. If you change the Visible property of a column to False, it will be hidden, and therefore you won't be able to select it with the mouse. Use this button to show all hidden columns so you can select and edit them. Determine whether the properties for the selected columns should be displayed in categorized or alphabetical order.

C1FlexGrid Style Editor


If you prefer, you can set up styles at design time instead of writing code to do it. The C1FlexGrid Style Editor can be accessed in one of three ways: Select the grid, go to the Properties window and click the ellipsis button next to the Styles property. Right-click the grid and select Styles from the context menu. Click on the smart tag ( Tasks menu. ) in the upper right corner of the grid and select Styles from the C1FlexGrid

Design Time Interaction 43

The grid will display the style editor dialog shown below:

The style editor lets you modify existing styles and add new custom ones, which may later be assigned to cells, rows, and columns. Use the Add button to add a custom style. You can see how your new style appears in the preview area above the style properties.

44 Using the C1FlexGrid Control

The Remove button removes the selected custom style. You can rename custom styles by selecting them on the list and typing the new name. The Clear button removes all custom styles and restores the built-in styles to their default values.

Design Time Interaction 45

The AutoFormat button brings up a secondary dialog that allows you to select a complete set of predefined styles. Here's what the AutoFormat dialog looks like:

Caption Style and Column Style


The Caption Style editor and the Column Style editor for a selected column allow you to specify the properties for the caption text and column text, respectively, as well as alignment, background, and borders. The Caption Style and Column Style editors can only be accessed in the Column Tasks menu. For more information on the Column Tasks menu, see Column Tasks Menu (page 52). The Caption Style and Column Style editors have four tabs: Text, Alignment, Background, and Borders. The Preview area allows you to view your settings before applying them to the grid. Text The Text tab sets the font and formatting of the caption.

46 Using the C1FlexGrid Control

The following options are available in the Font area: Name: Choose a font name. Size: Choose a font size. Color: Choose a font color. Direction: Choose from Normal, Up or Down. Font Effects: Use the buttons to toggle bold, italic, and underline on or off. Format: Click the ellipsis button to open the Format String dialog box. For more details on the Format String dialog box, see Cell Content (page 66). Input Mask: Click the ellipsis button to open the Input Mask dialog box. For more details on the Input Mask dialog box, see Masks (page 81). Effect: Choose from Flat, Raised, or Inset. For more details on the text effect options, see the TextEffectEnum Enumeration (page 766). Trimming: Choose from None, Character, Word, EllipsisCharacter, EllipsisWord, or EllipsisPath to set how long strings are trimmed to fit the cell. Word Wrap: Check the box to enable word wrapping for the caption.

The following options are available in the Formatting area:

Design Time Interaction 47

Alignment The Alignment tab sets the alignment of both text and images in the caption.

The following options are available in the Text Alignment area: Horizontal: Click the buttons to toggle between Align Left, Align Center, Align Right, and Align General. Vertical: Click the buttons to toggle between Align Top, Align Middle, and Align Bottom. Clip: Click the buttons to toggle between image alignment in the cell or Scale, Tile, Stretch, TileStretch, or Hide the image. For more details on the image alignment options, see the ImageAlignEnum Enumeration (page 656). Show Sample Image: Check the Show Sample Image box to display a sample image in the Preview area. Text/Image Spacing: Increase or decrease this value to increase or decrease the amount of space between the text and the image. Display: Choose from TextOnly, ImageOnly, Overlay, Stack, or None. For more details on the display options, see the DisplayEnum Enumeration (page 609).

The following options are available in the Image Alignment area:

The following options are available in the Display area:

48 Using the C1FlexGrid Control

Background The Background tab sets the background color and background image.

The following option is available in the Background Color area: Color: Choose a color for the background of the cell. Image: Click the Select button to select an image or the Clear button to remove an image. Layout: Toggle between Scale, Tile, Stretch, TileStretch, or Hide. The following options are available in the Background Image area:

Borders The Background tab sets the borders and margins.

Design Time Interaction 49

The following options are available in the Borders area: Style: Choose from None, Flat, Double, Raised, Inset, Groove, Fillet, or Dotted. For details on the different border style options, see the C1.Win.C1FlexGrid.BorderStyleEnum Enumeration (page 268). Width: Increase or decrease the value to increase or decrease the width of the border. Color: Choose a color for the border. Direction: Choose from Both, Horizontal, or Vertical. For details on the different border direction options, see the BorderDirEnum Enumeration (page 267). Left: Increase or decrease the value to increase or decrease the left margin. Top: Increase or decrease the value to increase or decrease the top margin. Right: Increase or decrease the value to increase or decrease the right margin. Bottom: Increase or decrease the value to increase or decrease the bottom margin.

The following options are available in the Margins area:

50 Using the C1FlexGrid Control

C1FlexGrid Tasks Menu


In the C1FlexGrid Tasks menu, you can quickly access the C1FlexGrid Column Editor and the C1FlexGrid Style Editor, as well as set the following properties: AllowAddNew, AllowDelete, AllowEditing, and AllowDragging. To access the C1FlexGrid Tasks menu, click on the smart tag ( will open the C1FlexGrid Tasks menu. ) in the upper right corner of the grid. This

The C1FlexGrid Tasks menu operates as follows: Choose Data Source Clicking the drop-down arrow in the Choose Data Source box, opens a list of available data sources and allows you to add a new data source. To add a new data source to the project, click Add Project Data Source to open the Data Source Configuration Wizard.

For more information on how to add a new data source to the project, see Binding to a Data Source (page 60).

Design Time Interaction 51

Enable Adding Rows Selecting the Enable Adding Rows check box sets the AllowAddNew property to True, and allows adding new rows to the grid. The default is unchecked. Enable Deleting Rows Selecting the Enable Deleting Rows check box sets the AllowDelete property to True, and allows deleting rows in the grid. The default is unchecked. Enable Editing Selecting the Enable Editing check box sets the AllowEditing property to True, and allows editing in the grid. The default is checked. Enable Column Reordering Selecting the Enable Column Reordering check box sets the AllowDragging property to Columns, and allows dragging of columns in the grid. The default is checked. Display Hidden Columns Selecting the Display Hidden Columns check box sets the Visible property to True for hidden columns and displays them. The default is unchecked. Designer Clicking Designer opens the C1FlexGrid Column Editor.

For more information on how to edit columns with the C1FlexGrid Column Editor, see C1FlexGrid Column Editor (page 40). Styles Clicking Styles opens the C1FlexGrid Style Editor.

52 Using the C1FlexGrid Control

For more information on how to customize cell appearance with the C1FlexGrid Style Editor, see C1FlexGrid Style Editor (page 42). Column Tasks Clicking Column Tasks opens the Column Tasks menu. For details on the Column Tasks menu, see Column Tasks Menu (page 52). About C1FlexGrid Clicking About C1FlexGrid displays the About ComponentOne C1FlexGrid dialog box, which is helpful in finding the version number of C1FlexGrid. Dock in parent container/Undock in parent container Clicking Dock in parent container sets the Dock property for C1FlexGrid to Fill. If C1FlexGrid is docked in the parent container, the option to undock C1FlexGrid from the parent container will be available. Clicking Undock in parent container sets the Dock property for C1FlexGrid to None.

Column Tasks Menu


The Column Tasks menu allows you to set the column caption, data field, data type, edit mask, format string, and combo list for a column, as well as set the following properties: AllowSorting, AllowEditing, AllowResizing, AllowDragging, AllowMerging, and Visible.

Design Time Interaction 53

To access the Column Tasks menu, either click on a column in the grid or select Column Tasks from the C1FlexGrid Tasks menu.

Column Caption Entering a caption into the Column Caption box set the Caption property for the column. Data Field Clicking the drop-down arrow in the Data Field box opens a list of available fields in the data source. Data Type Clicking the drop-down arrow in the Data Type box opens a list of available data types.

54 Using the C1FlexGrid Control

Edit Mask Clicking the ellipsis button in the Edit Mask box opens the Input Mask dialog box.

Design Time Interaction 55

Format String Clicking the ellipsis button in the Format String box opens the Format String dialog box.

Combo List Clicking the ellipsis button in the Combo List box opens the Combo List dialog box.

56 Using the C1FlexGrid Control

Allow Sorting Selecting the Allow Sorting check box sets the AllowSorting property to True, and allows sorting in the column. The default is checked. Allow Editing Selecting the Allow Editing check box sets the AllowEditing property to True, and allows editing in the column. The default is checked. Allow Resizing Selecting the Allow Resizing check box sets the AllowResizing property to True, and allows resizing the column. The default is checked. Allow Dragging Selecting the Allow Dragging check box sets the AllowDragging property to True, and allows dragging columns in the grid. The default is checked. Allow Merging Selecting the Allow Merging check box sets the AllowMerging property to True, and allows merging in the column. The default is unchecked. Visible Selecting the Visible check box sets the Visible property to True, and allows the column to be visible in the grid. The default is checked. Caption Style Clicking Caption Style opens the Caption Style editor for the selected column, which allows you to specify the properties for the caption text, including alignment, background, and borders.

Design Time Interaction 57

Column Style Clicking Column Style opens the Column Style editor for the selected column, which allows you to specify properties for the column, including text, alignment, background, and borders.

58 Using the C1FlexGrid Control

C1FlexGrid Tasks Clicking C1FlexGrid Tasks returns you to the C1FlexGrid Tasks menu. For details on the C1FlexGrid Tasks menu, see C1FlexGrid Tasks Menu (page 50). Dock in parent container/Undock in parent container Clicking Dock in parent container sets the Dock property for C1FlexGrid to Fill. If C1FlexGrid is docked in the parent container, the option to undock C1FlexGrid from the parent container will be available. Clicking Undock in parent container sets the Dock property for C1FlexGrid to None.

Selection
The grid has a cursor cell, which displays a focus rectangle while the grid is active. The user may move the cursor with the keyboard or the mouse, and edit the contents of the cell if the grid is editable. You can get or set the current cell in code using the Row and Col properties. Setting either of these properties to 1 hides the cursor.

Selection 59

The grid supports extended selections, rectangular ranges of cells defined by two opposing corners: the cursor cell and the cell selection cell. You can get or set the selection cell in code using the RowSel and ColSel properties. You can also set the selection in code using the Select method. Note: When the cursor cell changes, the selection is automatically reset. To create extended selections in code, either set Row and Col before RowSel and ColSel, or use the Select method. The appearance of the selection is controlled by the following properties: FocusRect determines the type of focus rectangle that is drawn to indicate the cursor cell. HighLight determines when the selection should be highlighted (always, when the control has the focus, or never). HighLight and Focus are cell styles that determine the appearance of the selection (font, color, and border).

The type of selection available is determined by the SelectionMode property. By default, the grid supports regular range selections. You can modify this behavior to prevent extended selections, to select by row, by column, or in listbox mode (listbox mode allows you to select individual rows). When using the listbox selection mode, you can get or set the selection status for individual rows using the Selected property. You can also retrieve a collection of selected rows using the Selected property. For example, the code below selects all rows that satisfy a condition: Visual Basic fg.SelectionMode = SelectionModeEnum.ListBox Dim index As Integer For index = fg.Rows.Fixed To fg.Rows.Count 1 If Val(fg(index, "Sales")) > 80000 Then fg.Rows(index).Selected = True End If Next Console.WriteLine("There are now {0} rows selected", fg.Rows.Selected.Count) C# fg.SelectionMode = SelectionModeEnum.ListBox; for (int index = fg.Rows.Fixed ; index < fg.Rows.Count; index++) { if ( Val(fg(index, "Sales")) > 80000 ) { fg.Rows(index).Selected = true; } } Console.WriteLine("There are now {0} rows selected", fg.Rows.Selected.Count); Delphi var index: Integer; begin fg.SelectionMode := SelectionModeEnum.ListBox; while (index <= fg.Rows.Count) do begin if (Val(fg(index, 'Sales')) > 80000) then fg.Rows(index).Selected := True;

60 Using the C1FlexGrid Control

Inc(index); end; Console.WriteLine('There are now {0} rows selected', fg.Rows.Selected.Count); end;

Data Binding
Data binding is a process that allows one or more data consumers to be connected to a data provider in a synchronized manner. If you move the cursor on a data-bound grid, other controls connected to the same data source will change to reflect the new current record. If you edit a value on a data-bound grid, other controls connected to the same data source will change to reflect the new value. C1FlexGrid supports data binding to ADO.NET data source objects such as DataTable, DataView, DataSet, and DataViewManager. C1FlexGrid also supports data binding to ComponentOne DataObjects components such as C1ExpressTable, C1ExpressView, C1ExpressConnection, C1DataView, C1DataTableSource and C1DataSet. To bind the grid to a data source, assign the data source object to the grid's DataSource property. If the data source object contains more than one table, you must also set the DataMember property a string that specifies which table should be used. Alternatively, you can assign both properties simultaneously with a single call to the SetDataBinding method. When you assign a new data source to the grid, it will automatically refresh its columns to bind to the columns available in the data source. You can then customize the columns by moving, hiding, or deleting them. You can also set column properties such as their Width, EditMask and Format. For an example of reordering the grid columns after binding to a data source, see the ColumnOrder sample on ComponentOne HelpCentral. For details about creating ADO.Net data source objects, please refer to the .NET Framework documentation. For details about using ComponentOne DataObjects, see the C1DataObjects documentation included in the ComponentOne Studio Enterprise.

Binding to a Data Source


Without writing a line of code, you can easily bind C1FlexGrid to a data source using the Data Source Configuration Wizard in Visual Studio. There are two ways to access the wizard, either through the DataSource property in the Properties window or the Choose Data Source box in the C1FlexGrid Tasks menu. For more information on the C1FlexGrid Tasks menu, see C1FlexGrid Tasks Menu (page 50). Clicking the drop-down arrow next either the DataSource property in the Properties window or the Choose Data Source box in the C1FlexGrid Tasks menu allows you to select from a list of available data sources or add a data source to your project. To add a data source to your project, click Add Project Data Source to open the Data Source Configuration Wizard.

Data Binding 61

The Data Source Configuration Wizard walks you through adding a data source step by step. The Choose a Data Source Type page allows you to choose which type of application you would like to gather information from. The default selection is Database.

On the Choose Your Data Connection page, you can specify the location of the database. If you have not already connected to the database, you can specify a new connection by clicking the New Connection button.

62 Using the C1FlexGrid Control

Clicking the New Connection button opens the Add Connection dialog box where you can browse to the location of your database and test the connection.

The wizard saves and names your connection on the Save the Connection String to the Application Configuration File page. On this page you can specify a name or use the default provided by the wizard.

Data Binding 63

On the Choose Your Database Objects page you can specify which tables and fields you want to include in your DataSet. You can also provide a name for your DataSet or use the default provided by the wizard.

64 Using the C1FlexGrid Control

The wizard creates the DataSet, BindingSource, and TableAdapter, and adds them to your project. If you double-click the form, you will also noticed that the code to fill the database is automatically generated in the Form_Load event.

Storing and Retrieving Data


The C1FlexGrid can be used in bound or unbound mode. In bound mode, the grid is connected to a data source, and all the data displayed on the grid comes from the data source. In this mode, changing data on the grid changes it in the underlying data source. In unbound mode, the grid manages its own data source. In either bound or unbound modes, the easiest way to access data in the C1FlexGrid is using the Row and Column indexers. The indexers allow you to specify a cell in a row or column from which to get or set the data stored there. For example, the following code selects the data in the second cell of a row: Visual Basic Row(2).Selected = True C# Row[2].Selected = true; Delphi Row[2].Selected := True;

The Item property is another easy way to access data in the C1FlexGrid. The Item property is an indexer that takes row and column indices and gets or sets the data stored in the cell. (You can also use column names as indices). For example, the following code stores row numbers in the first grid column: Visual Basic Dim r As Integer For r = fg.Rows.Fixed To fg.Rows.Count 1 fg(r, 0) = r Next C# int r; for ( r = fg.Rows.Fixed ; r <= fg.Rows.Count 1) { fg[r, 0] = r; } Delphi var r: Integer; begin r := fg.Rows.Fixed; while (r < fg.Rows.Count) do begin fg[r, 0] := r; r := r + 1; end; end;

When you assign a value to a cell, the grid tries to convert that value into the column's specified DataType. If the conversion fails, the grid fires the GridError event and does not change the cell. You can override this behavior using the SetData method and setting the coerce parameter to False. When you retrieve data using the indexers, the grid returns the actual data stored in the cell. To retrieve a string containing the formatted version of the data (what the grid displays to the user), use the GetDataDisplay method.

Cell Ranges 65

You can also set and retrieve the contents of the selection using the Clip property. This property is especially useful in handling the clipboard and drag-drop operations. By default, the Clip property returns a string with tab characters (Chr(9)) between cells and return characters (Chr(13)) between rows. To use different delimiters, change the ClipSeparators property. Finally, you can set and retrieve the contents of arbitrary cell ranges using CellRange objects (page 65).

Cell Ranges
CellRange objects allow you to work on arbitrary groups of cells as a single unit. For example, the code below creates a CellRange object, clears the data in the range, and assigns it a custom style: Visual Basic Dim rg As CellRange = fg.GetCellRange(3, 3, 10, 10) rg.Data = Nothing rg.Style = fg.Styles("MyRangeStyle") C# CellRange rg = fg.GetCellRange(3, 3, 10, 10); rg.Data = null; rg.Style = fg.Styles["MyRangeStyle"]; Delphi var rg: CellRange; begin rg := fg.GetCellRange(3, 3, 10, 10); rg.Data := nil; rg.Style := fg.Styles['MyRangeStyle']; end;

The CellRange object has a StyleNew property that retrieves the range style, if one exists, or creates a new one, assigns it to the range, and returns it. This property is convenient in situations where you don't need fullfledged control over formatting. For example, if all you want to do is give the range a red background, you can write: Visual Basic Dim rg As CellRange = fg.GetCellRange(3, 3, 10, 10) rg.StyleNew.BackColor = Color.Red C# CellRange rg = fg.GetCellRange(3, 3, 10, 10); rg.StyleNew.BackColor = Color.Red; Delphi var rg: CellRange; begin rg := fg.GetCellRange(3, 3, 10, 10); rg.StyleNew.BackColor := Color.Red; end;

Cell Images
Each grid cell can display images in addition to the data stored in the cell. This can be done in two ways: You can assign an Image object to a cell using the SetCellImage method. This method allows you to assign arbitrary images to each cell, and is useful if the images are not related to the data in the cell. For example, you may want to use a picture as an indicator that the data in the cell is invalid.

66 Using the C1FlexGrid Control

You can assign an ImageMap to the column and the grid will automatically map the cell data into a corresponding image. This method is useful in situations where the image contains a representation of the data. For example, the images may contain icons that represent product types.

Formatting Cells
One of the main strengths of the C1FlexGrid control is the ability to customize almost every aspect of the appearance of the entire grid and individual cells.

Cell Content
To control how the content of the cells is formatted, set the Format property to a format string similar to the ones you use with the String.Format method in the .NET framework. For example, the code below shows short dates on column one and currency values on column two: Visual Basic ' Short date. fg.Cols(1).Format = "d" ' Currency. fg.Cols(2).Format = "c" C# // Short date. fg.Cols[1].Format = "d"; // Currency. fg.Cols[2].Format = "c"; Delphi // Short date. fg.Cols[1].Format := 'd'; // Currency. fg.Cols[2].Format := 'c'; The formatting of cell content can also be set at design time using the Format String dialog box.

Formatting Cells 67

The Format String dialog box can be accessed through the Column Tasks menu or through the C1FlexGrid Column Editor. In the Column Tasks menu, click the ellipsis button in the Format String box. In the C1FlexGrid Column Editor, locate the Format property in the left pane, and click the ellipsis button next to it. Note: The Format String dialog box is column specific and will only change the Format property of the selected column. You can also use custom formats like the ones used in the Visual Basic Format function (for example, "#,###", and so on). Retrieving Cell Data You can retrieve the raw grid data using the indexers or the GetData method. To retrieve the formatted data, use the GetDataDisplay method instead. For example: Visual Basic ' Short date. fg.Cols(1).Format = "d" ' Currency. fg.Cols(2).Format = "c" fg(1, 2) = 10000 Console.WriteLine("Raw value: {0}", fg(1, 2)) Console.WriteLine("Display value: {0}", fg.GetDataDisplay(1, 2)) Raw value: 10000 Display value: $10,000.00

68 Using the C1FlexGrid Control

C# // Short date. fg.Cols[1].Format = "d"; // Currency. fg.Cols[2].Format = "c"; fg[1, 2] = 10000; Console.WriteLine("Raw value: {0}", fg[1, 2]); Console.WriteLine("Display value: {0}", fg.GetDataDisplay(1, 2)); Raw value: 10000; Display value: $10,000.00;

Delphi var value: Raw; begin // Short date. fg.Cols[1].Format := "d"; // Currency. fg.Cols[2].Format := "c"; fg[1, 2] := 10000; Console.WriteLine('Raw value: {0}', fg[1, 2]); Console.WriteLine('Display value: {0}', fg.GetDataDisplay(1, 2)); end;

Cell Appearance
The appearance of the cells (alignment, font, colors, borders, and so on) is handled with CellStyle objects. The grid has a Styles property that holds the collection of styles used to format the grid. This collection has some built-in members that define the appearance of grid elements, such as fixed and scrollable cells, selection, focus cell, and so on. You can change these styles to modify the way the grid looks, and you can also create your own custom styles and assign them to cells, rows, or columns. Changing the built-in styles is the simplest way to change the appearance of the grid. For example, the code below displays the selection as bold green characters over a red background: Visual Basic Dim cs As CellStyle = fg.Styles.Highlight cs.Font = New Font(fg.Font, FontStyle.Bold) cs.ForeColor = Color.Green cs.BackColor = Color.Red C# CellStyle cs = fg.Styles.Highlight; cs.Font = new Font(fg.Font, FontStyle.Bold); cs.ForeColor = Color.Green; cs.BackColor = Color.Red; Delphi var cs: CellStyle; begin cs := fg.Styles.Highlight; cs.Font := Font.Create(fg.Font, FontStyle.Bold);

Formatting Cells 69

cs.ForeColor := Color.Green; cs.BackColor := Color.Red; end; You can also create your own styles and assign them to cells, rows and columns. For example, the code below creates a custom cell style and assigns it to every fifth row: Visual Basic Dim cs As CellStyle = fg.Styles.Add("Fifth") cs.BackColor = Color.Gray Dim idex% For idex = fg.Rows.Fixed To fg.Rows.Count - 1 Step 5 fg.Rows(idex).Style = cs Next C# CellStyle cs = fg.Styles.Add("Fifth"); cs.BackColor = Color.Gray; for (int index = fg.Rows.Fixed ; index <= fg.Rows.Count 1; index += 5) { fg.Rows[index].Style = cs; } Delphi var fg: System.Object; cs: CellStyle; begin cs := fg.Styles.Add('Fifth'); cs.BackColor := Color.Gray; index := fg.Rows.Fixed; while (idex < fg.Rows.Count) do begin fg.Rows[index].Style := cs; end; end;

Here's an example that shows how you can create custom styles and assign them to columns, rows, and cell ranges: Visual Basic ' Create a new custom style. Dim s As CellStyle = _flex.Styles.Add("MyStyle") s.BackColor = Color.Red s.ForeColor = Color.White ' Assign the new style to a column. _flex.Cols(3).Style = _flex.Styles("MyStyle") ' Assign the new style to a row. _flex.Rows(3).Style = _flex.Styles("MyStyle") ' Assign the new style to a cell range. Dim rg As CellRange = _flex.GetCellRange(4, 4, 6, 6) rg.Style = _flex.Styles("MyStyle") C# // Create a CellStyle s s.BackColor s.ForeColor new custom style. = _flex.Styles.Add("MyStyle"); = Color.Red; = Color.White;

70 Using the C1FlexGrid Control

// Assign the new style to a column. _flex.Cols[3].Style = _flex.Styles["MyStyle"]; // Assign the new style to a row. _flex.Rows[3].Style = _flex.Styles["MyStyle"]; // Assign the new style to a cell range. CellRange rg = _flex.GetCellRange(4,4,6,6); rg.Style = _flex.Styles["MyStyle"]; Delphi var rg: CellRange; s: CellStyle; begin // Create a new custom style. s := _flex.Styles.Add('MyStyle'); s.BackColor := Color.Red; s.ForeColor := Color.White; // Assign the new style to a column. _flex.Cols[3].Style := _flex.Styles['MyStyle']; // Assign the new style to a row. _flex.Rows[3].Style := _flex.Styles['MyStyle']; // Assign the new style to a cell range. rg := _flex.GetCellRange(4, 4, 6, 6); rg.Style := _flex.Styles['MyStyle']; end; If you prefer, you can set up styles at design time using the C1FlexGrid Style Editor instead of writing code to do it. For details on customizing cell appearance with the C1FlexGrid Style Editor, see C1FlexGrid Style Editor (page 42).

Conditional Formatting
To format cells based on their contents, you can use the CellChanged event to select a style for the cell based on its contents. For example, the code below creates a new style for large currency values and applies it to cells based on their contents: Visual Basic ' Create a custom style for large values. cs = fg.Styles.Add("LargeValue") cs.Font = New Font(Font, FontStyle.Italic) cs.BackColor = Color.Gold ' Format cells based on their content. Private Sub fg_CellChanged(ByVal sender As Object, ByVal e As RowColEventArgs) Handles fg.CellChanged ' Mark currency values > 50,000 as LargeValues (reset others by setting their Style to Nothing). Dim cs As CellStyle If Val(fg(e.Row, e.Col)) >= 50000 Then cs = fg.Styles("LargeValue") End If

Formatting Cells 71

fg.SetCellStyle(e.Row, e.Col, cs) End Sub C# // Create a custom style for large values. cs = fg.Styles.Add("LargeValue"); cs.Font = new Font(Font, FontStyle.Italic); cs.BackColor = Color.Gold; // Format cells based on their content. private void fg_CellChanged( object sender, RowColEventArgs e) { // Mark currency values > 50,000 as LargeValues reset others by setting their Style to null). CellStyle cs; if ( Val(fg(e.Row, e.Col)) >= 50000 ) { cs = fg.Styles["LargeValue"]; } fg.SetCellStyle(e.Row, e.Col, cs); } Delphi // Create a custom style for large values. cs := fg.Styles.Add('LargeValue'); cs.Font := Font.Create(Font, FontStyle.Italic); cs.BackColor := Color.Gold; // Format cells based on their content. procedure fg_CellChanged(sender: System.Object; e: RowColEventArgs) begin // Mark currency values > 50,000 as LargeValues (reset others by setting their Style to null). if val(fg[e.Row, e.Col] >= 50000 then begin cs := fg.Styles['LargeValue']; end; fg.SetCellStyle(e.Row, e.Col, cs); end;

Owner-Drawn Cells
Even though the CellStyle objects offer a lot of control over the cell appearance (back and foreground colors, alignment, font, margins, borders, and so on), sometimes that is not enough. You may want to use a gradient background, or draw some custom graphics directly into a cell. In these cases, you can use the DrawMode property and the OwnerDrawCell event to gain total control over how each cell is drawn. The DrawMode property determines whether or not the OwnerDrawCell event is fired. The event allows you to override every visual aspect of the cell. The parameters in the OwnerDrawCell event allow you to change the data that is displayed, the style used to display the data, or to take over completely and draw whatever you want into the cell. You can change the text and image that will be shown in the cell by setting the e.Text and e.Image parameters in the event handler. You can also change the style that will be used to display the cell by setting the e.Style property. Note that you should not modify the properties of the Style parameter because that might affect other cells. Instead, assign a new CellStyle object to the Style parameter. For example, instead of setting

72 Using the C1FlexGrid Control

e.Style.ForeColor = Color.Red, assign a whole new style to the parameter using e.Style = _flex.Styles["RedStyle"]. You can also use your own drawing code to draw into the cell, and even combine your custom code with calls to the e.DrawCell method. For example, you could paint the cell background using GDI calls and then call e.DrawCell to display the cell borders and content. For an example of advanced OwnerDraw code, see the RtfGrid sample on ComponentOne HelpCentral. The code below shows an example. It uses a gradient brush to pain the background of the selected cells. First, the code sets the DrawMode property, declares a LinearGradientBrush object and updates the brush whenever the grid is resized: Visual Basic ' Use owner-draw to add gradients. fg.DrawMode = DrawModeEnum.OwnerDraw ' Brush to use with owner-draw cells. Dim m_GradientBrush As LinearGradientBrush Private Sub fg_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles fg.Resize ' Update gradient brush when the control is resized. m_GradientBrush = New LinearGradientBrush(ClientRectangle, Color.SteelBlue, Color.White, 45) End Sub C# // Use owner-draw to add gradients. fg.DrawMode = DrawModeEnum.OwnerDraw; // Brush to use with owner-draw cells. LinearGradientBrush m_GradientBrush; private void fg_Resize( object sender, System.EventArgs e) { // Update gradient brush when the control is resized. m_GradientBrush = new LinearGradientBrush(ClientRectangle, Color.SteelBlue, Color.White, 45); } Delphi // Brush to use with owner-draw cells. m_GradientBrush: LinearGradientBrush; // Use owner-draw to add gradients. fg.DrawMode := DrawModeEnum.OwnerDraw; procedure fg_Resize(sender: System.Object; e: System.EventArgs); begin // Update gradient brush when the control is resized. m_GradientBrush := new LinearGradientBrush(ClientRectangle, Color.SteelBlue, Color.White, 45); end;

Formatting Cells 73

The second step is handling the OwnerDrawCell event and using the custom brush for painting the cell background. In this example, the foreground is handled by the grid itself, using the DrawCell method in the event argument: Visual Basic Private Sub fg_OwnerDrawCell(ByVal sender As Object, ByVal e As OwnerDrawCellEventArgs) Handles fg.OwnerDrawCell ' Draw the selected cell background using gradient brush. If fg.Selection.Contains(e.Row, e.Col) Then ' Draw the background. e.Graphics.FillRectangle(m_GradientBrush, e.Bounds) ' Let the grid draw the content. e.DrawCell(DrawCellFlags.Content) ' We're done drawing this cell. e.Handled = True End If End Sub C# private void fg_OwnerDrawCell( object sender, OwnerDrawCellEventArgs e) { // Draw the selected cell background using gradient brush. if (fg.Selection.Contains(e.Row, e.Col)) { // Draw the background. e.Graphics.FillRectangle(m_GradientBrush, e.Bounds); // Let the grid draw the content. e.DrawCell(DrawCellFlags.Content); // We're done drawing this cell. e.Handled = true; } } Delphi procedure fg_OwnerDrawCell(sender: System.Object; e: OwnerDrawCellEventArgs); begin // Draw the selected cell background using gradient brush. If fg.Selection.Contains(e.Row, e.Col) Then begin // Draw the background. e.Graphics.FillRectangle(m_GradientBrush, e.Bounds); // Let the grid draw the content. e.DrawCell(DrawCellFlags.Content); // We're done drawing this cell. e.Handled := True end; end;

74 Using the C1FlexGrid Control

Editing Cells
By default, the C1FlexGrid control allows users to edit cells by typing into them. You can prevent users from editing the grid by setting the AllowEditing property to False. You can also prevent users from editing specific columns by settings the AllowEditing property to False. (When the grid is bound to a data source, it detects which columns are editable and automatically sets the AllowEditing property.) To start editing a cell, the user can: Start typing into the cell. This replaces the contents of the cell. Press F2 or ENTER. This puts the grid in edit mode and puts the current cell contents in the editor. Double-click a cell. This has the same effect as pressing F2, but selected the character near the click.

The basic editing mode allows users to type values into the cells. If the column being edited has a specific data type, values entered by the user are converted into the proper data type automatically. If the user types a value that cannot be converted into the proper data type, the grid fires a GridError event and ignores the edits. The basic editing is sufficient for many applications, but the C1FlexGrid has properties and events that allow you to control the editing process and provide selection lists, editing buttons, and advanced validation control. Starting with version 2.5, the C1FlexGrid also has built-in support for external editors. This allows you to use any control as a grid editor (for example, you can now use the C1Input controls as grid editors). These features are described below.

Editing with Lists and Combos


In many applications, cells have a well-defined list of possible values. In these cases, you can let users select the value from a drop-down list. To do this, build a string containing all the choices separated by pipe characters (for example, "True|False|Don't know") and assign it to the ComboList property. Each column may have a different list. Setting the ComboList property causes the grid to display a drop-down box next to the cell. The user can click the box (or press F2) to display the list of choices available for that cell. Another common situation is where cells have a list of common values, but users should be allowed to type something else as well. This can be accomplished with drop-down combos, a combination of text box and drop-down list. To create combos, just start the choice list with a pipe character (for example "|True|False|Don't know"), then assign it to the ComboList property as before. For example, the code below would cause the grid to display a drop-down combolist containing color names on column one, and a drop-down combo on column two. When editing column one, the user must pick a value from the list. When editing column two, the user can pick a value or type in something else: Visual Basic ' Drop-down list. fg.Cols(1).ComboList = "Red|Green|Blue|Red|White" ' Drop-down combo. fg.Cols(2).ComboList = "|Red|Green|Blue|Red|White" C# // Drop-down list. fg.Cols[1].ComboList = "Red|Green|Blue|Red|White"; // Drop-down combo. fg.Cols[2].ComboList = "|Red|Green|Blue|Red|White"; Delphi // Drop-down list. fg.Cols[1].ComboList := 'Red|Green|Blue|Red|White';

Editing Cells 75

// Drop-down combo. fg.Cols[2].ComboList := '|Red|Green|Blue|Red|White'; The ComboList property can also be set at design time using the Combo List dialog box. The Combo List dialog box allows you to choose if you want the list to appear as a Dropdown List, Dropdown Combo, Ellipsis Button, or TextBox and Ellipsis Button.

The Combo List dialog box can be accessed through the Column Tasks menu or through the C1FlexGrid Column Editor. In the Column Tasks menu, click the ellipsis button in the Combo List box. In the C1FlexGrid Column Editor, locate the ComboList property in the left pane, and click the ellipsis button next to it. Note: The Combo List dialog box is column specific and will only change the ComboList property of the selected column. In some cases, cells in the same column may need different lists. For example, a property list may show properties on the first column and their values on the second. The values depend on the property, so valid choices change from one row to the next. In these cases, you should trap the BeforeEdit event and set the ComboList property to the appropriate list for the current cell. The ComboList property applies to the whole grid. The built-in ComboBox provides an auto-search feature by default. As the user types a value, the selection will move to the next match. You can disable this feature using the EditOptions property and control the time before the grid resets the auto-search buffer using the AutoSearchDelay property. The built-in ComboBox also has an auto-cycle feature like the editors in the Visual Studio Properties window. When you double-click a cell that has a list associated with it, the grid will automatically select the next value. You can also disable this feature using the EditOptions property.

76 Using the C1FlexGrid Control

Checkboxes
By default, the grid displays values in Boolean columns as checkboxes (the type of the column is determined by the DataType property of the Column object). If you don't want Boolean values displayed as checkboxes, set the column's Format property to a string containing the values that should be displayed for True and False values. For example: Visual Basic fg.Cols("bools").Format = "Yes;No" C# fg.Cols["bools"].Format = "Yes;No"; Delphi fg.Cols['bools'].Format := 'Yes;No';

In unbound mode, you can use the GetCellCheck and SetCellCheck properties to add checkboxes to any cells. The checkboxes will be displayed along with any text in the cell, and you can set their position using the column's ImageAlign property. There are two types of check boxes: Boolean and tri-state. Boolean check boxes toggle between the CheckEnum.Checked and CheckEnum.Unchecked states. Tri-state check boxes cycle through the settings CheckEnum.TSChecked and CheckEnum.TSUnchecked and CheckEnum.TSGrayed. If the cell has a check box and the AllowEditing property is set to True, the user can change the state of the check boxes by clicking them with the mouse or by pressing the SPACE or ENTER keys. By default, toggling the value of checkbox with the mouse or keyboard will toggle all selected checkboxes. You can disable this feature using the EditOptions property.

Value-Mapped Lists
The ComboList property described above ensures that cell values are selected from a list. The value selected by the user is converted into the appropriate type for the column and stored in the grid, exactly as if the user had typed the value. In many cases, cells can assume values from well-defined lists, but you want to display a user-friendly version of the actual value. For example, if a column contains product codes, you may want to store the code but display the product name instead. This is accomplished with the DataMap property. This property contains a reference to an IDictionary object that establishes the mapping between what is stored in the grid and what is visible to the user (the IDictionary interface is defined in the System.Collections namespace, and is implemented by the Hashtable class among others). For example, the code below creates a data map that contains color values and their names. The colors are stored in the grid, and their names are displayed to the user: Visual Basic Dim dtMap As Hashtable = New Hashtable() dtMap.Add(Color.Red, "Apple") dtMap.Add(Color.Green, "Forest") dtMap.Add(Color.Blue, "Sky") dtMap.Add(Color.Black, "Coal") dtMap.Add(Color.White, "Snow") fg.Cols(1).DataType = GetType(Color) fg.Cols(1).DataMap = dtMap C# Hashtable dtMap = new Hashtable(); dtMap.Add(Color.Red, "Apple"); dtMap.Add(Color.Green, "Forest");

Editing Cells 77

dtMap.Add(Color.Blue, "Sky"); dtMap.Add(Color.Black, "Coal"); dtMap.Add(Color.White, "Snow"); fg.Cols[1].DataType = typeof(Color); fg.Cols[1].DataMap = dtMap; Delphi var dtMap : Hashtable; begin dtMap := Hashtable.Create; dtMap.Add(Color.Red, 'Apple'); dtMap.Add(Color.Green, 'Forest'); dtMap.Add(Color.Blue, 'Sky'); dtMap.Add(Color.Black, 'Coal'); dtMap.Add(Color.White, 'Snow'); fg.Cols[1].DataType := TypeOf(Color); fg.Cols[1].DataMap := dtMap; end;

Any class that implements IDictionary can be used as a DataMap. For example, Hashtable, ListDictionary, and SortedList all provide valid data maps. The difference is that when they are used in editable columns, the order of the items in the drop down list will depend on the class. The SortedList class sorts items by key, Hashtable uses an arbitrary order, and ListDictionary keeps the order in which items were added to the list. Because of this, ListDictionary is usually the best choice for DataMaps. Note that the keys in the data map must be of the same type as the cells being edited. For example, if a column contains short integers (Int16), then any data maps associated with the column should have short integer keys. Using regular integers (Int32) as keys would not work. The example below shows the difference: Visual Basic Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Sorts by key. Dim sl As New SortedList() sl.Add("0", "Zero") sl.Add("1", "One") sl.Add("2", "Two") sl.Add("3", "Three") ' Keeps Add order. Dim ld As New ListDictionary() ld.Add(0, "Zero") ld.Add(1, "One") ld.Add(2, "Two") ld.Add(3, "Three") ' Arbitrary order. Dim ht As New Hashtable() ht.Add(0, "Zero") ht.Add(1, "One") ht.Add(2, "Two") ht.Add(3, "Three") flex.Cols(1).DataMap = sl

78 Using the C1FlexGrid Control

flex.Cols(1).Caption flex.Cols(2).DataMap flex.Cols(2).Caption flex.Cols(3).DataMap flex.Cols(3).Caption End Sub

= = = = =

"SortedList" ld "ListDictionary" ht "HashTable"

C# private void Form1_Load(object sender, System.EventArgs e); { // Sorts by key. SortedList sl = new SortedList(); sl.Add("0", "Zero"); sl.Add("1", "One"); sl.Add("2", "Two"); sl.Add("3", "Three"); // Keeps Add order. ListDictionary ld = new ListDictionary(); ld.Add(0, "Zero"); ld.Add(1, "One"); ld.Add(2, "Two"); ld.Add(3, "Three"); // Arbitrary order. Hashtable ht = new Hashtable(); ht.Add(0, "Zero"); ht.Add(1, "One"); ht.Add(2, "Two"); ht.Add(3, "Three"); flex.Cols[1].DataMap = sl; flex.Cols[1].Caption = "SortedList"; flex.Cols[2].DataMap = ld; flex.Cols[2].Caption = "ListDictionary"; flex.Cols[3].DataMap = ht; flex.Cols[3].Caption = "HashTable"; }

Delphi procedure Form1_Load(sender: System.Object; e: System.EventArgs); var sl: SortedList; ld: ListDictionary; ht: Hashtable; begin // Sorts by key. sl := SortedList.Create; sl.Add('0', 'Zero'); sl.Add('1', 'One'); sl.Add('2', 'Two'); sl.Add('3', 'Three'); // Keeps Add order. ld := ListDictionary.Create; ld.Add(System.Object(0), 'Zero'); ld.Add(System.Object(1), 'One'); ld.Add(System.Object(2), 'Two'); ld.Add(System.Object(3), 'Three');

Editing Cells 79

// Arbitrary order. ht := Hashtable.Create; ht.Add(System.Object(0), ht.Add(System.Object(1), ht.Add(System.Object(2), ht.Add(System.Object(3), flex.Cols[1].DataMap flex.Cols[1].Caption flex.Cols[2].DataMap flex.Cols[2].Caption flex.Cols[3].DataMap flex.Cols[3].Caption end; := := := := := :=

'Zero'); 'One'); 'Two'); 'Three');

sl; 'SortedList'; ld; 'ListDictionary'; ht; 'HashTable';

Also, if the column's DataType property is set to an enumeration, the grid will automatically build and use a data map with the names of each value in the enumeration. For example, the following code creates an enumeration containing countries. The country values are stored in the grid, and their names are displayed to the user: Visual Basic Private Enum Countries NewYork Chicago NewOrleans London Paris End Enum fg.Cols(1).DataType = GetType(Countries) C# private enum Countries { NewYork; Chicago; NewOrleans; London; Paris; } fg.Cols[1].DataType = typeof(Countries); Delphi type Countries = (NewYork, Chicago, NewOrleans, London, Paris); fg.Cols[1].DataType := TypeOf(Countries);

Cell Buttons
Certain types of cells may require sophisticated editors other than text boxes or drop-down lists. For example, if a column contains file names or a color, it should be edited with a dialog box. In these cases, you should set the ComboList property to an ellipsis (""). The control will display a button next to the cell and will fire the CellButtonClick event when the user clicks on it. You can trap the event, show the dialog, and update the cell's contents with the user's selection.

80 Using the C1FlexGrid Control

If you add a pipe character before the ellipsis, then the user will also be allowed to edit the cell contents by typing into the cell. By default, the cell buttons display the ellipsis. You can assign pictures to the cell buttons using the CellButtonImage property. The example below shows how you can use cell buttons to display a calendar for editing date columns. The example assumes that you have a MonthCalendar control named "cal" on the form: Visual Basic ' Set up date column. Dim c As Col = fg.Cols(1) c.DataType = GetType(Color) ' Show cell button. c.ComboList = "..." C# // Set up date column. Col c = fg.Cols[1]; c.DataType = typeof(Color); // Show cell button. c.ComboList = "..."; Delphi var c: Col; begin // Set up date column. c := fg.Cols[1]; c.DataType := TypeOf(Color); // Show cell button. c.ComboList := '...'; end; This code sets up the column so the user can click a button or edit the date by typing. The next step is the code that handles clicks on the cell button: Visual Basic Private Sub fg_CellButtonClick(ByVal sender As Object, ByVal e As RowColEventArgs) Handles fg.CellButtonClick ' Create color picker dialog. Dim clrDlg As New ColorDialog() ' Initialize the dialog. If fg(e.Row, e.Col) Is GetType(Color) Then clrDlg.Color = fg(e.Row, e.Col) End If ' Get new color from dialog and assign it to the cell. If clrDlg.ShowDialog() = DialogResult.OK Then fg(e.Row, e.Col) = clrDlg.Color End If End Sub

Editing Cells 81

C# private void fg_CellButtonClick( object sender, RowColEventArgs e) { // Create color picker dialog. ColorDialog clrDlg = new ColorDialog(); // Initialize the dialog. if ( fg(e.Row, e.Col) Is typeof(Color) ) { clrDlg.Color = fg(e.Row, e.Col); } // Get new color from dialog and assign it to the cell. if ( clrDlg.ShowDialog() = DialogResult.OK ) { fg(e.Row, e.Col) = clrDlg.Color; } }

Delphi procedure fg_CellButtonClick(sender: System.Object; e: RowColEventArgs); var clrDlg: ColorDialog; begin // Create color picker dialog. clrDlg := ColorDialog.Create; // Initialize the dialog. If fg[e.Row, e.Col] Is Color Then clrDlg.Color := fg[e.Row, e.Col]; // Get new color from dialog and assign it to the cell. If clrDlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then fg[e.Row, e.Col] := clrDlg.Color end;

Masks
The C1FlexGrid control also supports masked editing. This type of editing uses an input mask to provide a template and automatically validate the input as the user types. The mask is specified by the EditMask property, which can be used with regular text fields and with drop-down combo fields. Mask strings have two types of characters: literal characters, which become part of the input, and template characters, which serve as placeholders for characters belonging to specific categories (for example, digits or alphabetic). For example, the code below assigns a "(999) 999-9999" editing mask to column one, which holds phone numbers (the digit "9" is a placeholder that stands for any digit): Visual Basic ' Set up a phone number edit mask. fg.Cols(1).EditMask = "(999) 999-9999" C# // Set up a phone number edit mask. fg.Cols[1].EditMask = "(999) 999-9999"; Delphi // Set up a phone number edit mask. fg.Cols[1].EditMask := '(999) 999-9999';

82 Using the C1FlexGrid Control

Setting the EditMask property to a non-empty string causes it to use the built-in masked editor, even if the column contains date/time values (usually, a DateTimePicker control is used to edit these columns). This is especially convenient if you have DateTime columns that hold times only (not dates). In these cases, you can set the following properties to use a masked editor instead of the DateTimePicker control: Visual Basic fg.Cols(1).DataType = GetType(DateTime) fg.Cols(1).Format = "hh:mm tt" fg.Cols(1).EditMask = "99:99 LL" C# fg.Cols[1].DataType = typeof(DateTime); fg.Cols[1].Format = "hh:mm tt"; fg.Cols[1].EditMask = "99:99 LL"; Delphi fg.Cols[1].DataType := TypeOf(DateTime); fg.Cols[1].Format := 'hh:mm tt'; fg.Cols[1].EditMask := '99:99 LL';

The EditMask property can also be set at design time using the Input Mask dialog box.

The Input Mask dialog box can be accessed through the Column Tasks menu or through the C1FlexGrid Column Editor. In the Column Tasks menu, click the ellipsis button in the Edit Mask box. In the C1FlexGrid Column Editor, locate the EditMask property in the left pane, and click the ellipsis button next to it. Note: The Input Mask dialog box is column specific and will only change the EditMask property of the selected column. For details on the syntax used to build the mask strings, see the EditMask property in the control reference section.

Editing Cells 83

If different cells in the same column need different masks, trap the BeforeEdit event and set the EditMask property to an appropriate value for the current cell.

Validation
In many cases, edit masks alone are not enough to ensure that the data enters by the user was valid. For example, a mask won't let you specify a range of possible values, or validate the current cell based on the contents of another cell. In these cases, trap the ValidateEdit event and see if the value contained in the Editor.Text property is a valid entry for the current cell (at this point, the cell still has the original value in it). If the input is invalid, set the Cancel parameter to True and the grid will remain in edit mode until the user types a valid entry. For example, the code below validates input into a currency column to ensure that values entered are between 1,000 and 10,000: Visual Basic Private Sub fg_ValidateEdit(ByVal sender As Object, ByVal e As ValidateEditEventArgs) Handles fg.ValidateEdit ' Validate amounts. If fg.Cols(e.Col).DataType Is GetType(Decimal) Then Try Dim dec As Decimal = Decimal.Parse(fg.Editor.Text()) If dec < 1000 Or dec > 10000 Then MessageBox.Show("Value must be between 1,000 and 10,000") e.Cancel = True End If Catch MessageBox.Show("Value not recognized as a Currency") e.Cancel = True End Try End If End Sub C# private void fg_ValidateEdit( object sender, ValidateEditEventArgs e) { // Validate amounts. if (fg.Cols[e.Col].DataType is (Decimal)) { try { Decimal dec = Decimal.Parse(fg.Editor.Text); if ( dec < 1000 || dec > 10000 ) { MessageBox.Show("Value must be between 1,000 and 10,000"); e.Cancel = true; } } catch { MessageBox.Show("Value not recognized as a Currency"); e.Cancel = true; } } }

84 Using the C1FlexGrid Control

Delphi Private Sub fg_ValidateEdit(sender: System.Object; e: ValidateEditEventArgs); var dec: Decimal; begin // Validate amounts. If fg.Cols(e.Col).DataType Is Decimal Then Try dec := Decimal.Parse(fg.Editor.Text()) If (dec < 1000) Or (dec > 10000) Then begin MessageBox.Show('Value must be between 1,000 and 10,000'); e.Cancel := True; end; except MessageBox.Show('Value not recognized as a Currency'); e.Cancel := True end; end;

Using Custom Editors


The built-in editors provide a lot of flexibility and power, but in some cases you may want to use external controls as specialized editors. For example, you may want to use the C1NumericInput control that provides a drop-down calculator for entering numbers, or an editor for selecting from multi-column lists, or a specialized control that you wrote to edit your business objects. Any control that derives from the base Control class can be used as a basic grid editor. Controls that implement the IC1EmbeddedEditor interface (defined in C1.Common.dll) can provide better integration with the grid and more advanced features. For details on the IC1EmbeddedEditor interface, see the Editor property. To use a control as a custom editor, all you have to do is associate an instance of the control with a grid column or a style using its Editor property. You can do this in the designer (using the Column Editor) or in code. After that, the control will be automatically used by the grid. To define custom editors at design time, add an instance of the editor control to the form, then select Designer from the C1FlexGrid Tasks menu to open the C1FlexGrid Column Editor. Select the columns that should use the custom editor and set their Editor properties to the name of the new editor control. For example, to use a NumericUpDown control as a grid editor, follow these steps: 1. 2. 3. 4. Add a C1FlexGrid control to the form. Add a NumericUpDown control to the form and set its BorderStyle property to None. Select Designer from the C1FlexGrid Tasks menu. For more information on accessing the C1FlexGrid Column Editor, see Accessing the C1FlexGrid Column Editor (page 167). In the C1FlexGrid Column Editor, select the first scrollable grid column and set its Editor property to NumericUpDown1.

Editing Cells 85

Run the project and edit some values in the first column. Notice how the grid positions and initializes the NumericUpDown control so you can edit cell values. When you are done editing a cell, click a different cell or press the TAB key to move to the next one. Notice how the new value is applied to the cell. You can also assign custom editors to the grid using code: Visual Basic Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Create the custom editor. Dim editor as New NumericUpDown() editor.BorderStyle = BorderStyle.None ' Assign the custom editor to the grid. fg.Cols(1).Editor = editor End Sub C# private void Form1_Load(object sender, System.EventArgs e) { // Create the custom editor. NumericUpDown editor = new NumericUpDown(); editor.BorderStyle = BorderStyle.None; // Assign the custom editor to the grid. fg.Cols[1].Editor = editor; }

86 Using the C1FlexGrid Control

Delphi procedure TWinForm.Form_Load(object sender; e: System.EventArgs); var editor: NumericUpDown; begin // Create the custom editor. editor := NumericUpDown.Create; editor.BorderStyle := BorderStyle.None; // Assign the custom editor to the grid. fg.Cols[1].Editor := editor; end;

Creating Custom Editors


Any control that derives from the Control base class can be used as a grid editor. This is possible because the grid knows enough about the base class to access properties such as Text and Bounds, and events such as Leave and TextChanged. In many cases this level of support is adequate. In some cases, however, you may want to use controls that do not follow the base class that closely. For example, a DateTimePicker control has a Value property that should be used to retrieve the edited value instead of Text. In these cases, you can implement one or more methods in the IC1EmbeddedEditor interface to override the default behavior. For example, all controls in the C1Input library support IC1EmbeddedEditor and therefore integrate closely with C1FlexGrid (and also C1TrueDBGrid). The IC1EmbeddedEditor interface is fairly simple, and because the grid binds to it using late binding, you don't even have to implement all its members. Only implement the ones that make sense to your editor control. The interface does provide enough flexibility to allow virtually any control to be used as a grid editor. You can even use UITypeEditor classes as grid editors. To do this, you need a wrapper class that: 1. 2. 3. Derives from Control (UITypeEditor doesn't). Implements the IC1EmbeddedEditor interface. Encapsulates the appropriate UITypeEditor.

We provide source code for this wrapper class in the CustomEditors sample. Using the UITypeEditor wrapper class, you can use any UITypeEditors with the C1FlexGrid. .NET provides several UITypeEditors for editing colors, fonts, file names, and so on. You can also write your own UITypeEditors, in some cases that is easier than writing a control. For an example of using built-in, custom, and UITypeEditor editors with the C1FlexGrid, see the CustomEditors sample on ComponentOne HelpCentral.

Controlling Edit Mode


You can determine whether the grid is in edit mode by reading the value of the Editor property. If this property returns null, the grid is not in edit mode. Otherwise, the grid is in edit mode and the property returns a reference to the control that is being used to edit the cell (the control may be a TextBox, a ComboBox, or other type of control). You can put the grid in edit mode programmatically using the StartEditing method, and finish editing using the FinishEditing method.

Outlining and Summarizing 87

You can control the editing process further by handling the editing events fired by the grid. In the process of editing a cell, the grid fires the following sequence of events:

Event BeforeEdit

Description This event fires whenever an editable cell is selected. It allows you to prevent the cell from being edited by setting the event's Cancel parameter to True. You can also modify the ComboList property so the appropriate drop-down button gets painted in the cell. Note that the user might not actually start editing after this, he could simply move the selection to a different cell or control.

StartEdit

This event is similar to BeforeEdit, except the user has actually typed a key or clicked the dropdown button in the cell and really is about to start editing. You can still cancel the editing at this point. Note that the Editor property is still null at this point, because the control hasn't yet determined the type of editor that should be used. You can assign custom editors to the Editor property at this point.

SetupEditor

This event fires after the editor control has been created and configured to edit the cell, but before it is displayed. You can change the editor properties at this point (for example, set the maximum length or password character to be used in a TextBox editor). You can also attach your own event handlers to the editor. This event fires when the user is done editing, before the editor value gets copied back into the grid. You can examine the original value by retrieving it from the grid (the event provides the coordinates of the cell). You can examine the new value about to be assigned to the grid through the Editor properties (for example, Editor.Text). If the new value is not valid for the cell, set the Cancel parameter to True and the grid will remain in edit mode. If instead of keeping the cell in edit mode you would rather restore the original value and leave edit mode, set Cancel to True and then call the FinishEditing method.

ValidateEdit

AfterEdit

This event fires after the new value has been applied to the cell and the editor has been deactivated. You can use this event to update anything that depends on the cell value (for example, subtotals or sorting).

Outlining and Summarizing


The FlexGrid control has methods and properties that allow you to summarize data and display it in a hierarchical manner. To summarize data and add aggregate values, use the Subtotal method. To display hierarchical views of the data, use the Tree property.

Creating Subtotals
The Subtotal method adds subtotal rows that contain aggregate data for the regular (non-subtotal) rows.

88 Using the C1FlexGrid Control

Subtotal supports hierarchical aggregates. For example, if your grid contains sales data, you may Subtotal to get aggregate sales figures by Product, Region, and Salesperson. The code below illustrates this: Visual Basic Private Sub ShowTotals() ' Show OutlineBar on column 0. fg.Tree.Column = 0 fg.Tree.Style = TreeStyleFlags.Simple ' Clear existing subtotals. fg.Subtotal(AggregateEnum.Clear) ' Get a Grand total (use -1 instead of column index). fg.Subtotal(AggregateEnum.Sum, -1, -1, 3, "Grand Total") ' Total per Product (column 0). fg.Subtotal(AggregateEnum.Sum, 0, 0, 3, "Total {0}") ' Total per Region (column 1). fg.Subtotal(AggregateEnum.Sum, 1, 1, 3, "Total {0}") ' Size column widths based on content. fg.AutoSizeCols() End Sub C# private void ShowTotals() { // Show OutlineBar on column 0. fg.Tree.Column = 0; fg.Tree.Style = TreeStyleFlags.Simple; // Clear existing subtotals. fg.Subtotal(AggregateEnum.Clear); // Get a Grand total (use -1 instead of column index). fg.Subtotal(AggregateEnum.Sum, -1, -1, 3, "Grand Total"); // Total per Product (column 0). fg.Subtotal(AggregateEnum.Sum, 0, 0, 3, "Total {0}"); // Total per Region (column 1). fg.Subtotal(AggregateEnum.Sum, 1, 1, 3, "Total {0}"); // Size column widths based on content. fg.AutoSizeCols(); } Delphi procedure ShowTotals() begin // Show OutlineBar on column 0. fg.Tree.Column := 0; fg.Tree.Style := TreeStyleFlags.Simple;

Outlining and Summarizing 89

// Clear existing subtotals. fg.Subtotal(AggregateEnum.Clear); // Get a Grand total (use -1 instead of column index). fg.Subtotal(AggregateEnum.Sum, -1, -1, 3, 'Grand Total'); // Total per Product (column 0). fg.Subtotal(AggregateEnum.Sum, 0, 0, 3, 'Total {0}'); // Total per Region (column 1). fg.Subtotal(AggregateEnum.Sum, 1, 1, 3, 'Total {0}'); // Size column widths based on content. fg.AutoSizeCols; end; When the Subtotal method adds rows with the aggregate information, it automatically assigns subtotal styles to the new rows (there are built-in styles for 5 levels of subtotals). You can customize the appearance of the subtotal rows by changing the properties of the outline styles in the designer with the Style Editor or with code. For example: Visual Basic ' Set styles for subtotals. Dim cs As CellStyle cs = fg.Styles(CellStyleEnum.GrandTotal) cs.BackColor = Color.Black cs.ForeColor = Color.White cs.Font = New Font(Font, FontStyle.Bold) cs = fg.Styles(CellStyleEnum.Subtotal0) cs.BackColor = Color.DarkRed cs.ForeColor = Color.White cs.Font = New Font(Font, FontStyle.Bold) cs = fg.Styles(CellStyleEnum.Subtotal1) cs.BackColor = Color.DarkBlue cs.ForeColor = Color.White C# // Set styles for subtotals. CellStyle cs; cs = fg.Styles[CellStyleEnum.GrandTotal]; cs.BackColor = Color.Black; cs.ForeColor = Color.White; cs.Font = new Font(Font, FontStyle.Bold); cs = fg.Styles[CellStyleEnum.Subtotal0]; cs.BackColor = Color.DarkRed; cs.ForeColor = Color.White; cs.Font = new Font(Font, FontStyle.Bold); cs = fg.Styles[CellStyleEnum.Subtotal1]; cs.BackColor = Color.DarkBlue; cs.ForeColor = Color.White; Delphi // Set styles for subtotals. cs := fg.Styles[CellStyleEnum.GrandTotal];

90 Using the C1FlexGrid Control

cs.BackColor := Color.Black; cs.ForeColor := Color.White; cs.Font := Font.Create(Font, FontStyle.Bold); cs := fg.Styles[CellStyleEnum.Subtotal0]; cs.BackColor := Color.DarkRed; cs.ForeColor := Color.White; cs.Font := Font.Create(Font, FontStyle.Bold); cs := fg.Styles[CellStyleEnum.Subtotal1]; cs.BackColor := Color.DarkBlue; cs.ForeColor := Color.White; After executing this code, the grid would look like this:

The Grand Total row contains the total sales for all products, regions, and sales personnel. It was created using a 1 for the groupOn parameter in the call to the Subtotal method. The other subtotals show total sales by product and region. They were created using a values 0 and 1 for the groupOn parameter. You may also calculate aggregates other than sums (for example, averages or percentages), and calculate several aggregates for each row (for example, gross and net sales). Subtotal rows created by the Subtotal method differ from regular rows in three aspects: 1. Subtotal rows can be automatically removed by invoking the Subtotal method with the flexSTClear parameter. This is useful to provide dynamic views of the data, where the user may move columns and resort the data, making it necessary to recalculate the subtotals. Subtotal rows can be used as nodes in an outline, allowing you to collapse and expand groups of rows to present an overview of the data or to reveal its details. To see the outline tree, you need to set the Column and Tree.Style properties to define the position and appearance of the outline tree. Subtotal rows can be treated as nodes in a tree. You can get a Node object for any subtotal row through the Node property. When the grid is bound to a data source, the subtotal rows do not correspond to actual data. If you move the cursor in the data source, subtotal rows will be skipped in the grid.

2.

3. 4.

Outlining and Summarizing 91

The outline tree allows users to collapse and expand sections of the grid by clicking on the nodes. You can use outline trees to display many types of information, not only aggregates. The next topic shows how you can create a custom outline tree to display directory information.

Creating Custom Trees


To create outline trees without using the Subtotal method, you need to follow these steps: 1. 2. 3. Add rows to the grid. Turn some rows into outline nodes by setting their IsNode property to True. Get the Node object for each node row and set its Level property to define the node's position in the tree hierarchy. Higher values mean the node is deeper (more indented) into the outline tree. Visual Basic Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Initialize grid layout. fg.Cols.Fixed = 0 fg.Cols.Count = 1 fg.Rows.Count = 1 fg.ExtendLastCol = True fg.Styles.Normal.TextAlign = TextAlignEnum.LeftCenter fg.Styles.Normal.Border.Style = BorderStyleEnum.None ' Initialize outline tree. fg.Tree.Column = 0 fg.Tree.Style = TreeStyleFlags.SimpleLeaf ' Populate the grid. AddDirectory("c:\", 0) End Sub C# private void Form1_Load( System.object sender, System.EventArgs e) { // Initialize grid layout. fg.Cols.Fixed = 0; fg.Cols.Count = 1; fg.Rows.Count = 1; fg.ExtendLastCol = true; fg.Styles.Normal.TextAlign = TextAlignEnum.LeftCenter; fg.Styles.Normal.Border.Style = BorderStyleEnum.None; // Initialize outline tree. fg.Tree.Column = 0; fg.Tree.Style = TreeStyleFlags.SimpleLeaf; // Populate the grid. AddDirectory("c:\", 0); } Delphi procedure Form1_Load(sender: System.Object; e: System.EventArgs); begin

For example, the code below creates a directory tree:

92 Using the C1FlexGrid Control

// Initialize grid layout. fg.Cols.Fixed := 0; fg.Cols.Count := 1; fg.Rows.Count := 1; fg.ExtendLastCol := True; fg.Styles.Normal.TextAlign := TextAlignEnum.LeftCenter; fg.Styles.Normal.Border.Style := BorderStyleEnum.None; // Initialize outline tree. fg.Tree.Column := 0; fg.Tree.Style := TreeStyleFlags.SimpleLeaf; // Populate the grid. AddDirectory("c:\", 0) end; The code above initializes the grid layout and calls the AddDirectory routine that does the job of populating the grid and setting up the tree structure: Visual Basic Private Sub AddDirectory(ByVal dir As String, ByVal level As Integer) ' Add this directory. Dim thisDir As String thisDir = Path.GetFileName(dir) If thisDir.Length = 0 Then thisDir = dir fg.AddItem(thisDir.ToUpper()) ' Make this new row a node. Dim row As Row = fg.Rows(fg.Rows.Count - 1) row.IsNode = True ' Set the node level. Dim nd As Node = row.Node nd.Level = level ' Add files in this directory. Dim file As String, cnt As Integer cnt = 0 For Each file In Directory.GetFiles(dir) fg.AddItem(Path.GetFileName(file).ToLower()) cnt = cnt + 1 If cnt > 10 Then Exit For Next ' Add subdirectories (up to level 4). If level <= 4 Then Dim subdir As String cnt = 0 For Each subdir In Directory.GetDirectories(dir) AddDirectory(subdir, level + 1) cnt = cnt + 1 If cnt > 10 Then Exit For Next End If End Sub

Outlining and Summarizing 93

C# private void AddDirectory( string dir, int level) { // Add this directory. string thisDir = Path.GetFileName(dir); if ( thisDir.Length == 0 ) { thisDir = dir; } fg.AddItem(thisDir.ToUpper()); // Make this new row a node. Row row = fg.Rows[fg.Rows.Count 1]; row.IsNode = true; // Set the node level. Node nd = row.Node; nd.Level = level; // Add files in this directory. int cnt = 0; foreach (string file In Directory.GetFiles(dir)) { fg.AddItem(Path.GetFileName(file).ToLower()); cnt = cnt + 1; if ( cnt > 10 ) { break; } } // Add subdirectories (up to level 4). if (level <= 4) { string subdir; cnt = 0; for each (int subdir in Directory.GetDirectories(dir)) { AddDirectory(subdir, level +1); cnt = cnt + 1; if (cnt > 10) { break; } } } }

Delphi procedure AddDirectory(dir: String; level: Integer); var thisDir: string; r: Row; nd: Node; file: string; cnt: Integer; files: array of string;

94 Using the C1FlexGrid Control

subdir: string; begin // Add this directory. thisDir := Path.GetFileName(dir); If thisDir.Length = 0 Then thisDir := dir; fg.AddItem(thisDir.ToUpper()); // Make this new row a node. r := fg.Rows(fg.Rows.Count - 1); r.IsNode := True; // Set node level. nd := r.Node; nd.Level := level; // Add files in this directory. cnt := 0; files := Directory.GetFiles(dir); for I := 0 to High(Files) do begin fg.AddItem(Path.GetFileName(files[I].ToLower()); cnt := cnt + 1; if cnt > 10 then break; end; // Add subdirectories (up to level 4). If level <= 4 Then begin cnt := 0; files := Directory.GetDirectories(dir); for I := 0 to High(files) do begin AddDirectory(subdir, level + 1); cnt := cnt + 1; if cnt > 10 then break; end; end; end; AddDirectory is a recursive routine that traverses the current directory and all its subdirectories. In this sample, the tree size is limited to four directory levels in order to save time. In a real application, the routine should be changed to populate tree branches only when they are expanded (see the C1FlexGrid Tutorials (page 115)).

Merging Cells 95

This code creates a grid that looks like this:

Merging Cells
The C1FlexGrid control allows you to merge cells, making them span multiple rows or columns. This capability can be used to enhance the appearance and clarity of the data displayed on the grid. The effect of these settings is similar to the HTML <ROWSPAN> and <COLSPAN> tags. To enable cell merging, you must do two things: 1. 2. Set the grid's AllowMerging property to a value other than None. (The effect of each setting is explained in the reference section.) If you want to merge columns, set the AllowMerging property to True for each column that you would like to merge. If you want to merge rows, set the AllowMerging property to True for each row that you would like to merge

Merging will occur if adjacent cells contain the same non-empty string. There is no method to force a pair of cells to merge. The merging is done automatically based on the cell contents. This makes it easy to provide merged views of sorted data, where values in adjacent rows present repeated data. Cell merging has several possible uses. For example, you can use it to create merged table headers, merged data views, or grids where the text spills into adjacent columns.

Merged Table Headers


To create merged table headers, you must start by setting the grid's AllowMerging property to FixedOnly. Then, designate the rows and columns that you want to merge by setting the row and column's AllowMerging properties. Finally, assign the text to the header cells so that the cells you want to merge have the same contents.

96 Using the C1FlexGrid Control

The code below shows an example: Visual Basic Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim i% ' Initialize the control. fg.Styles.Normal.WordWrap = True fg.Cols.Count = 9 fg.Rows.Fixed = 2 fg.AllowMerging = AllowMergingEnum.FixedOnly ' Create row headers. fg.Rows(0).AllowMerging = True ' Merge the four cells with same contents. Dim rng As CellRange = fg.GetCellRange(0, 1, 0, 4) rng.Data = "North" ' Merge the four cells with same contents. rng = fg.GetCellRange(0, 5, 0, 8) rng.Data = "South" For i = 1 To 4 fg(1, i) = "Qtr " & i fg(1, i + 4) = "Qtr " & i Next ' Create the column header. fg.Cols(0).AllowMerging = True ' Merge the two cells with same contents. rng = fg.GetCellRange(0, 0, 1, 0) rng.Data = "Sales by Product" ' Align and autosize the cells. fg.Styles.Fixed.TextAlign = TextAlignEnum.CenterCenter fg.AutoSizeCols(1, fg.Cols.Count - 1, 10) End Sub C# private void Form1_Load(System.object sender, System.EventArgs e) { i%; // Initialize the control. fg.Styles.Normal.WordWrap = true; fg.Cols.Count = 9; fg.Rows.Fixed = 2; fg.AllowMerging = AllowMergingEnum.FixedOnly; // Create row headers. fg.Rows[0].AllowMerging = true; // Merge the four cells with same contents. CellRange rng = fg.GetCellRange(0, 1, 0, 4); rng.Data = "North";

Merging Cells 97

// Merge the four cells with same contents. rng = fg.GetCellRange(0, 5, 0, 8); rng.Data = "South"; for ( i = 1 ; i <= 4; i++) { fg[1, i] = "Qtr " + i; fg[1, i + 4] = "Qtr " + i; } // Create the column header. fg.Cols[0].AllowMerging = true; // Merge the two cells with same contents. rng = fg.GetCellRange(0, 0, 1, 0); rng.Data = "Sales by Product"; // Align and autosize the cells. fg.Styles.Fixed.TextAlign = TextAlignEnum.CenterCenter; fg.AutoSizeCols(1, fg.Cols.Count - 1, 10); } Delphi procedure Form1_Load(sender: System.Object; e: System.EventArgs); var I: Integer; rng: CellRange; begin // Initialize the control. fg.Styles.Normal.WordWrap := True; fg.Cols.Count := 9; fg.Rows.Fixed := 2; fg.AllowMerging := AllowMergingEnum.FixedOnly; // Create row headers. fg.Rows[0].AllowMerging := True; // Merge the four cells with same contents. rng := fg.GetCellRange(0, 1, 0, 4); rng.Data := 'North'; // Merge the four cells with same contents. rng := fg.GetCellRange(0, 5, 0, 8); rng.Data := 'South'; For i := 1 To 4 do begin fg[1, i] := 'Qtr ' + I; fg[1, i + 4] = 'Qtr ' + I; end; // Create the column header. fg.Cols[0].AllowMerging := True; // Merge the two cells with same contents. rng := fg.GetCellRange(0, 0, 1, 0); rng.Data := 'Sales by Product';

98 Using the C1FlexGrid Control

// Align and autosize the cells. fg.Styles.Fixed.TextAlign := TextAlignEnum.CenterCenter; fg.AutoSizeCols(1, fg.Cols.Count - 1, 10); end; This is the result:

Merged Data Views


Cell merging works the same way when the grid is bound to a data source. The code below shows an example (the code uses a DataAdapter object that was created at design time): Visual Basic Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim i% ' Bind the grid to a data source. Dim ds As New DataSet() SqlDataAdapter1.Fill(ds) fg.DataSource = ds.Tables(0) ' Set up cell merging. fg.AllowMerging = AllowMergingEnum.RestrictCols For i = fg.Cols.Fixed To fg.Cols.Count 1 fg.Cols(i).AllowMerging = True Next End Sub C# private void Form1_Load( System.object sender, { // Bind the grid to a data source. DataSet ds = new DataSet(); SqlDataAdapter1.Fill(ds); fg.DataSource = ds.Tables[0]; System.EventArgs e)

// Set up cell merging. fg.AllowMerging = AllowMergingEnum.RestrictCols; for (int i = fg.Cols.Fixed; i <= fg.Cols.Count 1; i++) { fg.Cols(i).AllowMerging = true; } }

Merging Cells 99

Delphi procedure Form1_Load(sender: System.Object; e: System.EventArgs); var I: Integer; ds: DataSet; begin // Bind the grid to a data source. ds := DataSet.Create; SqlDataAdapter1.Fill(ds); fg.DataSource := ds.Tables[0]; // Set up cell merging. fg.AllowMerging := AllowMergingEnum.RestrictCols; For i := fg.Cols.Fixed To fg.Cols.Count 1 do fg.Cols[i].AllowMerging := True; end;

This is the result:

Notice how merging the cells has the effect of visually grouping the data and making the information on the table easier to understand.

Spilling Text
The AllowMerging property has two settings that operate differently from the others that don't require you to set the AllowMerging property on specific rows and columns. 1. The Spill setting causes text that is too long to fit in a cell to spill into empty adjacent cells. The resulting behavior is similar to the one in Microsoft Excel. If you type a long entry into a cell and the adjacent cell is empty, the entry will spill to occupy as much room as needed.

100 Using the C1FlexGrid Control

For example, the picture below shows what a grid might look like when AllowMerging is set to Spill and the user types entries of varying lengths:

2.

The Nodes setting is similar to Spill but only applies to outline nodes. This setting is useful when data is organized into groups, and the node rows contain information in a format different from the data rows. For example, the picture below shows what a grid might look like when the data is grouped and summarized using the Subtotal method, and then AllowMerging is set to Nodes:

This image is similar to the one in the previous topic that described subtotals. The difference is that the subtotal rows (nodes) now spill onto empty adjacent cells, improving the appearance of the grid.

Custom Merging
You can customize the default merging behavior in two ways: Assign a custom IComparer class to the CustomComparer property. By default, the grid will merge adjacent cells that contain the same non-null value. String comparisons are case-sensitive and blanks are included. If you wanted the grid to merge cells using a case-insensitive comparison and trimming blanks, you could write a custom class that implements IComparer and assign it to the CustomComparer property. Write a new class that derives from the C1FlexGrid and override the GetMergedRange virtual method, providing your own custom merging logic. For examples that show how to implement custom merging logic, see the CustomMerge samples on ComponentOne HelpCentral.

Saving, Loading, and Printing


The C1FlexGrid control has methods that allow you to save, load, and print grids.

Saving, Loading, and Printing 101

Saving and Loading Grids to Text Files


The SaveGrid method saves the grid contents to a text file. The method has parameters that control the type of delimiter to use (for example, commas, tabs, custom delimiters), whether to save the fixed cells or only the scrollable cells, and the type of encoding to used (for example, ASCII or Unicode). The resulting text files can later be loaded back into the control, or into other applications that support comma or tab-delimited files (for example, Microsoft Excel). The LoadGrid method loads data from text files. You can load text files created with the SaveGrid method or with other applications. The format of the text files is fairly simple. Cell contents are saved as formatted strings (exactly as they are displayed on the screen). If the cell text contains quote characters or cell separator characters, the cell is enclosed in quotes. Any quote characters contained in the cell text are doubled. This is the also the convention used in Microsoft Excel text files. Text files do not contain pictures or formatting information. The SaveGrid method has a flags parameter that allows you to specify whether you want to save the entire grid or only certain parts (scrollable, visible, or selected).

Saving and Loading Microsoft Excel Files


Starting with version 2.5, you can use the SaveGrid and LoadGrid methods to save and load Microsoft Excel files (.xls) as well as text files. This allows you to save formatting information in addition to the data. To save and load Excel files using the SaveGrid and LoadGrid methods, simply set the format parameter to FileFormatEnum.Excel and call the methods as usual. You don't need to have Microsoft Excel installed on your computer. Excel files contain "workbooks", which are made up of "worksheets". The SaveGrid and LoadGrid methods always save books with a single sheet, and load the first sheet from existing books. If you want additional control over which sheets to load or save, use the SaveExcel, LoadExcel, and LoadExcelSheetNames methods instead. The process of saving and loading Excel files will convert most data types and formatting information, including row and column dimensions, fonts, colors, formats, and cell alignment. However, not all formatting elements can be converted. For example, the grid will load the values in Excel cells, but it will not load the underlying formulas. Other features such as frozen and merged cells, images, data maps, and cell borders are not translated either.

Loading Grids from Databases


You can also load grid data from a database. This is different from data binding, which keeps a live connection between one or more controls and the underlying data source. To load data from a database, you can use DataReader objects, as shown below: Visual Basic Private Sub _btnData_Click(ByVal sender As Object, ByVal e As System.EventArgs) ' Prepare DataReader. Dim strConn As String = "data source=MYMACHINE;initial catalog=Northwind;" Dim myConn As New SqlConnection(strConn) Dim myCMD As New SqlCommand("SELECT * FROM Employees", myConn) myConn.Open() Dim myReader As SqlDataReader = myCMD.ExecuteReader() ' Build the grid structure from the DB schema. Dim dt As DataTable = myReader.GetSchemaTable() _flex.Cols.Count = 1

102 Using the C1FlexGrid Control

Dim dr As DataRow For Each dr In dt.Rows Dim c As Column = _flex.Cols.Add() c.Caption =(c.Name <<= CStr(dr("ColumnName"))) c.DataType = CType(dr("DataType"), Type) Next dr ' Populate the grid. _flex.Rows.Count = 1 Dim row As Integer = 1 Dim cols As Integer = dt.Columns.Count Dim v As Object() = CType(Array.CreateInstance(GetType(Object), cols), Object()) While myReader.Read() myReader.GetValues(v) _flex.AddItem(v, row ++, 1) End While ' Cleanup. _flex.AutoSizeCols() myReader.Close() myConn.Close() End Sub C# private void _btnData_Click(object sender, System.EventArgs e) { // Prepare DataReader. string strConn = "data source=MYMACHINE;initial catalog=Northwind;"; SqlConnection myConn = new SqlConnection(strConn); SqlCommand myCMD = new SqlCommand("SELECT * FROM Employees", myConn); myConn.Open(); SqlDataReader myReader = myCMD.ExecuteReader(); // Build the grid structure from the DB schema. DataTable dt = myReader.GetSchemaTable(); _flex.Cols.Count = 1; foreach (DataRow dr in dt.Rows) { Column c = _flex.Cols.Add(); c.Caption = c.Name = (string)dr["ColumnName"]; c.DataType = (Type)dr["DataType"]; } // Populate the grid. _flex.Rows.Count = 1; int row = 1; int cols = dt.Columns.Count; object[] v = (object[])Array.CreateInstance(typeof(object), cols); while (myReader.Read()) { myReader.GetValues(v); _flex.AddItem(v, row++, 1); } // Cleanup. _flex.AutoSizeCols();

Saving, Loading, and Printing 103

myReader.Close(); myConn.Close(); } Delphi var v: System.Array; cols: Integer; row: Integer; dt: DataTable; dr: DataRow; myReader: SqlDataReader; myCMD: SqlCommand; myConn: SqlConnection; strConn: string; c: Column; begin // Prepare DataReader. strConn := 'data source=MYMACHINE;initial catalog=Northwind;'; myConn := SqlConnection.Create(strConn); myCMD := SqlCommand.Create('SELECT * FROM Employees', myConn); myConn.Open; myReader := myCMD.ExecuteReader; // Build the grid structure from the DB schema. dt := myReader.GetSchemaTable; _flex.Cols.Count = 1 for I := 0 to dt.Rows.Count 1 do begin dr := dt.Rows[I]; c := flex.Cols.Add; c.Caption := string(dr['ColumnName']); c.Name := string(dr['ColumnName']); c.DataType := System.Type(dr['DataType']); end; // Populate the grid. flex.Rows.Count := 1; row := 1; cols := dt.Columns.Count; v := _ System.Array.CreateInstance(typeof(System.Object), cols), cols); While myReader.Read() do begin myReader.GetValues(v); _flex.AddItem(v, row, 1); row := row + 1; end; // Cleanup. _flex.AutoSizeCols; myReader.Close; myConn.Close; end;

104 Using the C1FlexGrid Control

Printing Grids
Use the PrintGrid method to print the contents of the grid. The method has parameters that allow you to select the scaling mode, whether to display print/preview dialogs, set headers and footers, and so on. The PrintParameters property exposes additional printing properties such as the font to use for headers and footers, and a .NET Framework PrintDocument object that can be used to select the printer, paper size and orientation, margins, and so on. The code below uses the PrintParameters property to set up the page orientation, margins, header and footer fonts. Then it calls the PrintGrid method to display a print preview dialog: Visual Basic ' Get the grid's PrintDocument object. Dim pd As PrintDocument pd = fg.PrintParameters.PrintDocument() ' Set up the page (landscape, 1.5" left margin). With pd.DefaultPageSettings .Landscape = True .Margins.Left = 150 End With ' Set up the header and footer fonts. fg.PrintParameters.HeaderFont = New Font("Arial Black", 14, FontStyle.Bold) fg.PrintParameters.FooterFont = New Font("Arial Narrow", 8, FontStyle.Italic) ' Preview the grid. fg.PrintGrid("VB Tutorial", PrintGridFlags.FitToPageWidth + PrintGridFlags.ShowPreviewDialog, "VB Tutorial" + Chr(9) + Chr(9) + Format(DateTime.Now, "d"), Chr(9) + Chr(9) + "Page {0} of {1}") C# // Get the grid's PrintDocument object. PrintDocument pd = fg.PrintParameters.PrintDocument(); // Set up the page (landscape, 1.5" left margin). pd.DefaultPageSettings.Landscape = true; pd.DefaultPageSettings.Margins.Left = 150; // Set up the header and footer fonts. fg.PrintParameters.HeaderFont = new Font("Arial Black", 14, FontStyle.Bold); fg.PrintParameters.FooterFont = new Font("Arial Narrow", 8, FontStyle.Italic); // Preview the grid. fg.PrintGrid("VB Tutorial", PrintGridFlags.FitToPageWidth | PrintGridFlags.ShowPreviewDialog, "VB Tutorial\t\t" + Format(DateTime.Now, "d"), "\t\tPage {0} of {1}"); Delphi var pd: PrintDocument; begin // Get the grid's PrintDocument object. pd := flex.PrintParameters.PrintDocument;

FlexGrid Property Groups 105

// Set up the page (landscape, 1.5" left margin). With pd.DefaultPageSettings do begin Landscape := True; Margins.Left := 150; end; // Set up the header and footer fonts. flex.PrintParameters.HeaderFont := System.Drawing.Font.Create('Arial Black', 14, FontStyle.Bold); flex.PrintParameters.FooterFont := System.Drawing.Font.Create('Arial Narrow', 8, FontStyle.Italic); // Preview the grid. flex.PrintGrid('VB Tutorial', PrintGridFlags.FitToPageWidth or PrintGridFlags.ShowPreviewDialog, 'VB Tutorial'#9#9 + Format(DateTime.Now, 'd'), #9#9 + 'Page {0} of {1}'); end;

FlexGrid Property Groups


The C1FlexGrid control has a rich set of properties, methods, and events. You do not have to know all of them in order to use the control effectively. The reference below shows the most important properties, methods, and events grouped by usage type. Some elements appear in more than one group. For details on specific elements, please refer to the reference part of this document. 1) Grid Layout Rows, Cols, AutoSizeCols, ScrollBars 2) Cursor and Selection SelectionMode, Select, ShowCell, Row, Col, RowSel, ColSel, , MouseRow, MouseCol, BeforeRowColChange, AfterRowColChange, BeforeSelChange, AfterSelChange, KeyActionTab, KeyActionEnter 3) Editing AllowEditing, ComboList, EditMask, BeforeEdit, StartEdit, ValidateEdit, AfterEdit, StartEditing, FinishEditing, Editor, CellButtonClick, KeyDownEdit, KeyPressEdit, KeyUpEdit, ChangeEdit 4) Getting and Setting Values Item (indexer), GetData, GetDataDisplay, SetData, GetCellRange, GetCellImage, SetCellImage, Clip, FindRow, Aggregate, CellChanged 5) User Interface AllowEditing, AllowMerging, AllowResizing, AllowDragging, AllowSorting, BeforeSort, AfterSort, AutoSearch, AutoSearchDelay BeforeDragColumn, AfterDragColumn, BeforeDragRow, AfterDragRow, BeforeResizeColumn, AfterResizeColumn, BeforeResizeRow, AfterResizeRow, ShowScrollTip 6) Outlining and Summarizing Subtotal, Tree, IsNode, Level, Collapsed, BeforeCollapse, AfterCollapse 7) Merging Cells AllowMerging, GetMergedRange

106 Using the C1FlexGrid Control

8) Data Binding DataSource, DataMember, AfterDataRefresh, AutoResize, GridError 9) Saving, Loading, and Printing Grids LoadGrid, SaveGrid, LoadExcel, SaveExcel, ClipSeparators, PrintGrid 10) OLE Drag Drop DragMode, DropMode, BeforeMouseDown

C1FlexGrid Samples 107

C1FlexGrid Samples
Please be advised that this ComponentOne software tool is accompanied by various sample projects and/or demos which may make use of other development tools included with ComponentOne Studio Enterprise. C1FlexGrid samples are installed with ComponentOne Studio Enterprise to the following directories: ComponentOne FlexGrid for .NET Samples Visual Basic and C# Samples C:\Program Files\ComponentOne Studio.NET 2.0\C1FlexGrid

ComponentOne FlexGrid for Mobile Devices Samples Visual Basic and C# Samples C:\Program Files\ComponentOne Studio.NET 2.0\C1FlexGridCF

Note: The ComponentOne Samples are also available at http://helpcentral.componentone.com/ProductResources.aspx.

Visual Basic Samples

AutoSizeEdit BarChart Blinker BoundDelete BoundFinishEdit BoundImage CellBorders CellDataType CellMerging ColumnEditor CustomDataMap

Resize the editor while the user types. This sample uses the C1FlexGrid control. Draw bar charts using the grid cells. This sample uses the C1FlexGrid control. Use CellStyles to make cells blink. This sample uses the C1FlexGrid control. Deletes rows from a bound FlexGrid. This sample uses the C1FlexGrid control. Commit changed to DataRow after editing. This sample uses the C1FlexGrid control. Bind the grid to image fields stored as OLE objects. This sample uses the C1FlexGrid control. Use OwnerDraw to provide custom cell borders. This sample uses the C1FlexGrid control. Assign cell types (and editors) on a per-cell basis. This sample uses the C1FlexGrid control. Shows various types of cell-merging in a FlexGrid control. This sample uses the C1FlexGrid control. Expose the FlexGrid design-time column editor in your controls. This sample uses the C1FlexGrid control. Customize the options in drop-down lists when using DataMaps. This sample uses the C1FlexGrid control.

108 C1FlexGrid Samples

CustomEditor CustomMerge CustomMerge2 CustomMerge3 CustomMerge4 CustomPrint CustomTree DataIndex DataMap DataReader DataTable DBDynamicStyles DBImageField DBSchemaChange DBTree DragDrop DragDropManual DragRow DynamicStyles Editing

Implement your own cell editor. This sample uses the C1FlexGrid control. Implement your own merging logic to create a TV-guide display. This sample calls the C1.Win.C1FlexGrid namespace. Implement your own merging logic to mix merging modes. This sample calls the C1.Win.C1FlexGrid namespace. Shows how to customize grouping by overriding the GetData method. This sample calls the C1.Win.C1FlexGrid namespace. Shows how to customize grouping by overriding the GetData method. This sample calls the C1.Win.C1FlexGrid namespace. Use the CreateImage method to print grids with arbitrary row and column breaks. This sample uses the C1FlexGrid control. Use the C1FlexGrid control to build a tree. This sample uses the C1FlexGrid control. Use the Row.DataIndex property to get the underlying data row. This sample uses the C1FlexGrid control. Use data-mapped columns when bound to a data source. This sample uses the C1FlexGrid control. Populate a grid from a DataReader. This sample uses the C1FlexGrid control. Bind to a DataTable, add and remove rows. This sample uses the C1FlexGrid control. Assign styles to grid cells based on their contents. This sample uses the C1FlexGrid control. Show images stored in a DataTable. This sample uses the C1FlexGrid control. Test grid response to changes in the data source object. This sample uses the C1FlexGrid control. Display bound data in a hierarchical tree view. This sample uses the C1FlexGrid control. Customize automatic Drag & Drop. This sample uses the C1FlexGrid control. Implement manual OleDragDrop between controls and within the grid. Drag rows between grids. This sample uses the C1FlexGrid control. Assign styles to a cell based on the contents of another cell. This sample uses the C1FlexGrid control. Edit cells using textboxes, lists, masks, and checkboxes. This sample uses the C1FlexGrid control.

C1FlexGrid Samples 109

FlexByRow FlexGroup FreezeBottom GridChart HierData Hyperlink LoadSpeed MapAndGroup MergeStyles MultiColumnDictionary Outline PdfExportVB ProductTree RTFGrid ScrollPosition SelectionMode Sorting Splits StartEditing Styles

Set up a grid in 'transposed' format. This sample uses the C1FlexGrid control. Implement Outlook-style grouping and filtering using the FlexGrid. This sample uses the C1FlexGrid control. Show frozen rows at the bottom of a grid. This sample uses the C1FlexGrid control. Attach a FlexGrid to a C1Chart control. This sample uses the C1FlexGrid and C1Chart controls. Bind to hierarchical data sources (master-detail style). This sample uses the C1FlexGrid control. Add hyperlinks to cells in the FlexGrid. This sample uses the C1FlexGrid control. Shows three techinques for loading data into a FlexGrid. Shows grouping and sorting behavior when using data-mapped columns. This sample uses the C1FlexGrid control. Merge CellStyles assigned to rows, columns, and cells. This sample uses the C1FlexGrid control. Use the MultiColumnDictionary class to implement multi-column dropdowns. Hide repeated data in an outline. This sample uses the C1FlexGrid control. Use C1Pdf method to export C1FlexGrids to PDF files. Build a custom tree with product information. This sample uses the C1FlexGrid control. Display RTF text in grid cells. This sample uses the C1FlexGrid control. Shows how the ScrollPosition property works. This sample uses the C1FlexGrid control. Shows the effect of the SelectionMode property. This sample uses the C1FlexGrid control. Shows several sorting techniques. This sample uses the C1FlexGrid control. Split a C1FlexGrid into multiple views. This sample uses the C1FlexGrid control. Implement a grid that stays in cell-editing mode. This sample uses the C1FlexGrid control. Shows how you can use Styles to customize the appearance of the C1FlexGrid. This sample uses the C1FlexGrid control.

110 C1FlexGrid Samples

Subtotals Transpose TreeCheck TreeNode Validate ZoomCell

Create subtotals for multiple columns. This sample uses the C1FlexGrid control. Transpose data in a grid. This sample uses the C1FlexGrid control. Add checkboxes to a grid tree. This sample uses the C1FlexGrid control. Manage an outline tree using the FlexGrid Node objects. This sample uses the C1FlexGrid control. Use the ErrorProvider control with the FlexGrid. This sample uses the C1FlexGrid control. Zoom in on the selected cell.

C# Samples

AcceleratorCaption Analyze AutoComplete AutoSizeEdit BarChart Blinker BoundDelete BoundFinishEdit BoundImage BoundImageMap CellBorders CellDataType CellLabelDelay

Add accelerator keys to grid captions. Provide dynamic data sorting and grouping. This sample uses the C1FlexGrid control. Complete entries while the user types. Resize the editor while the user types. This sample uses the C1FlexGrid control. Draw bar charts using the grid cells. This sample uses the C1FlexGrid control. Use CellStyles to make cells blink. Deletes rows from a bound FlexGrid. This sample uses the C1FlexGrid control. Commit changed to DataRow after editing. This sample uses the C1FlexGrid control. Bind the grid to image fields stored as OLE objects. This sample uses the C1FlexGrid control. Use the ImageMap property with a data-bound grid. This sample uses the C1FlexGrid control. Use OwnerDraw to provide custom cell borders. This sample uses the C1FlexGrid control. Assign cell types (and editors) on a per-cell basis. This sample uses the C1FlexGrid control. Show cell labels after a specified interval.

C1FlexGrid Samples 111

ColumnEditor ColumnOrder ColumnWidthTip CrossTabs CustomData CustomDataMap CustomDataSource CustomEditor CustomEditors CustomMerge CustomMerge2 CustomMerge3 CustomMerge4 CustomPrint CustomSelection CustomSort DataIndex DataTable DataTree DBDynamicStyles

Expose the FlexGrid design-time column editor in your controls. This sample uses the C1FlexGrid control. Position columns dynamically. This sample uses the C1FlexGrid control. Show a tooltip while the user resizes columns. Summarize and cross-reference data using PivotTables. Implement a custom data source object. This sample uses the C1FlexGrid control. Customize the options in drop-down lists when using DataMaps. This sample uses the C1FlexGrid control. Implements a custom data source object and binds it to a grid. This sample uses the C1FlexGrid control. Implement your own cell editor. This sample uses the C1FlexGrid control. Use built-in, .NET, and custom edit controls with the FlexGrid. Implement your own merging logic to create a TV-guide display. This sample calls the C1.Win.C1FlexGrid namespace. Implement your own merging logic to mix merging modes. This sample calls the C1.Win.C1FlexGrid namespace. Shows how to customize grouping by overriding the GetData method. This sample calls the C1.Win.C1FlexGrid namespace. Shows how to customize grouping by overriding the GetData method. This sample calls the C1.Win.C1FlexGrid namespace. Use the CreateImage method to print grids with arbitrary row and column breaks. This sample uses the C1FlexGrid control. Uses OwnerDraw to implement custom (non-rectangular) selection. This sample calls the C1.Win.C1FlexGrid namespace. Implement your own sorting logic with a custom IComparer object. This sample uses the C1FlexGrid control. Use the Row.DataIndex property to get the underlying data row. This sample uses the C1FlexGrid control. Bind to a DataTable, add and remove rows. This sample uses the C1FlexGrid control. Bind the grid to a hierarchical data source and show details in child grids. This sample calls the C1.Win.C1FlexGrid namespace. Assign styles to grid cells based on their contents. This sample uses the C1FlexGrid control.

112 C1FlexGrid Samples

DBImageField DBImages DBSchemaChange DBTree DBUpdate DragDrop DragImages DragMerged DragRow DynamicStyles ErrorInfo Excel FilterRow FindRow FlexByRow FlexGroup FlexHierarchical FreezeBottom GridChart HierData HierData2

Show images stored in a DataTable. This sample uses the C1FlexGrid control. Bind the grid to a data base with image fields stored as OLE objects. This sample uses the C1FlexGrid control. Test grid response to changes in the data source object. This sample uses the C1FlexGrid control. Display bound data in a hierarchical tree view. This sample uses the C1FlexGrid control. Save changes to the underlying database. This sample uses the C1FlexGrid control. Customize automatic Drag & Drop This sample uses the C1FlexGrid control. Shows how to customize Ole Drag and Drop to use cell images. Drag groups of merged columns. This sample uses the C1FlexGrid control. Drag rows between grids. This sample uses the C1FlexGrid control. Assign styles to a cell based on the contents of another cell. This sample uses the C1FlexGrid control. Show error information on the grid. Load and save Microsoft Excel files (.xls). Implement a FilterRow on a FlexGrid control. This sample uses the C1FlexGrid control. How to find a row in the underlying datasource. This sample uses the C1FlexGrid control. Set up a grid in 'transposed' format. This sample uses the C1FlexGrid control. Implement Outlook-style grouping using the FlexGrid. This sample uses the C1FlexGrid control. Implement hierarchical data binding using the FlexGrid. This sample calls the C1.Win.C1FlexGrid namespace. Show frozen rows at the bottom of a grid. This sample uses the C1FlexGrid control. Attach a FlexGrid to a C1Chart control. This sample uses the C1FlexGrid and C1Chart controls. Bind to hierarchical data sources (master-detail style). This sample uses the C1FlexGrid control. Bind to hierarchical data sources (master-detail style).

C1FlexGrid Samples 113

HostControls Hyperlink LegacyDates LockedColumns MasterDetail MergeStyles MultiColumnDictionary MultiParent MultiSelection NewRowTemplate Outline OwnerDraw OwnerDrawAlpha PasswordChar PdfExport RowStateDisplay RTFGrid ScrollPosition SelectionMode SetupEditor Sorting SortNulls Splits

Host controls in grid cells. This sample uses the C1FlexGrid control. Add hyperlinks to cells in the FlexGrid. This sample uses the C1FlexGrid control. Use an unbound column to convert dates stored as strings into real dates. Prevent the user from selecting certain columns. Shows how to create and bind master-detail DataSets in code. This sample calls the C1.Win.C1FlexGrid namespace. Merge CellStyles assigned to rows, columns, and cells. This sample uses the C1FlexGrid control. Use the MultiColumnDictionary class to implement multi-column dropdowns. Shows how to create a complex master-detail display. Shows how to implement multi-range selection. Place a new row template above the grid. Hide repeated data in an outline. This sample uses the C1FlexGrid control. Autosize Owner-Drawn cells. Use OwnerDraw with transparency to get MediaPlayer-like effects. Use the C1FlexGrid to enter and edit passwords. This sample uses the C1FlexGrid control. Use the C1Pdf method to export C1FlexGrids to PDF files. Use different styles to display DataRows in different states. This sample uses the C1FlexGrid control. Display RTF text in grid cells. This sample uses the C1FlexGrid control. Shows how the ScrollPosition property works. This sample uses the C1FlexGrid control. Shows the effect of the SelectionMode property. This sample uses the C1FlexGrid control. Use the SetupEditor event to customize the grid editors. This sample uses the C1FlexGrid control. Shows several sorting techniques. This sample uses the C1FlexGrid control. Use a custom sort to place null values at the bottom of the grid. Split a C1FlexGrid into multiple views. This sample uses the C1FlexGrid control.

114 C1FlexGrid Samples

SqlBuilder StartEditing Subtotals ThreadedUpdate TreeCheck TreeNode TriStateBound UnboundColumns ZoomCell

A grid-based graphical interface for creating SQL statements. Implement a grid that stays in cell-editing mode. This sample uses the C1FlexGrid control. Create subtotals for multiple columns. This sample uses the C1FlexGrid control. Update the grid from a different thread. Add checkboxes to a grid tree. This sample uses the C1FlexGrid control. Manage an outline tree using the FlexGrid Node objects. This sample uses the C1FlexGrid control. Provide three-state (grayable) values in Boolean columns. This sample calls the C1.Win.C1FlexGrid namespace. Additional support for unbound columns. Zoom in on the selected cell.

ComponentOne FlexGrid for Mobile Devices Visual Basic Samples

Analyze BarChart EditData ThreadedUpdate

Provide dynamic data sorting and grouping. This sample uses the C1FlexGrid control. Draw bar charts using the grid cells. This sample uses the C1FlexGrid control. Shows different types of built-in editors and dynamic formatting. This sample uses the C1FlexGrid control. Update the grid from a different thread.

ComponentOne FlexGrid for Mobile Devices C# Samples

Analyze BarChart ContextMenu DataTree

Provide dynamic data sorting and grouping. This sample uses the C1FlexGrid control. Draw bar charts using the grid cells. This sample uses the C1FlexGrid control. Show a ContextMenu after selecting an item on the grid. Shows hierarchical data in a drill-down grid.

Edit Tutorial 115

C1FlexGrid Tutorials
The following sections contain tutorials that illustrate some of the main features in the C1FlexGrid control. The tutorials walk you through the creation of several simple projects, describing each step in detail. The distribution CD contains more sophisticated samples that can be used as a reference. The tutorials are: Starting with a basic data-entry grid, this tutorial shows how to implement data formatting, check boxes, drop-down lists, input masks, data validation, and clipboard support. Shows how you can use the C1FlexGrid as an outliner to display structured (or hierarchical) data. Starting with a grid containing sales data for different products, regions, and salespeople, this tutorial show how to implement dynamic layout (column order), automatic sorting, cell merging, automatic subtotals, and outlining.

Edit

Outline Data Analysis

Edit Tutorial
This tutorial starts with a basic data-entry grid, then adds the following features: 1. 2. 3. 4. 5. 6. Formatting Check boxes Drop-down lists Complex data validation Clipboard support Custom editors

116 C1FlexGrid Tutorials

Here is what the final application will look like:

A video is available for this tutorial on the ComponentOne Videos Web page.

Step 1: Create the C1FlexGrid Control


Start a new project and add a C1FlexGrid control to the form by clicking the C1FlexGrid icon on the toolbox, then clicking on the form and dragging until the object has the proper size. If you can't find the C1FlexGrid control in the toolbox, right-click on the toolbox and select Choose Items. Then, look for the C1FlexGrid control on the list of .NET components and make sure it is checked. If you can't find the grid in the component list, you may need to re-install the product. 1. Set the following properties in the .NET Properties window for the C1FlexGrid control: Property Dock Cols.Count Cols.Fixed 2. Setting Fill 5 0

Double-click the form caption area to open the code window. At the top of the file, add the following statement: Visual Basic Imports C1.Win.C1FlexGrid C# using C1.Win.C1FlexGrid; Delphi uses C1.Win.C1FlexGrid;

This makes the objects defined in the C1FlexGrid assembly visible to the project and saves a lot of typing. 3. Set up the columns by either in the designer through the Column Tasks menu or the C1FlexGrid Column Editor, or in code by typing (or copying) the following code.

Edit Tutorial 117

In the Designer Select the first column in the grid. This will open the Column Tasks menu for the column. Enter Product in the Column Caption and Data Field boxes.

Set the Column Caption and Data Field boxes for the remainder of the columns as follows: Column 1 Column Caption Data Field Column 2 Column Caption Data Field Column 3 Column Caption Data Field Column 4 Column Caption Data Field Bonus Bonus Sales Sales Salesperson Salesperson Region Region

118 C1FlexGrid Tutorials

Alternatively, the columns can also be set up through the C1FlexGrid Column Editor: Open the C1FlexGrid Column Editor by clicking Designer in the C1FlexGrid Tasks menu. For details on how to access the C1FlexGrid Column Editor, see Accessing the C1FlexGrid Column Editor (page 167). Select the Column 0 in the right pane. In the left pane, set the Name and Caption properties to Product.

Set the Name and Caption properties for the remainder of the columns as follows: Column 1 Name Caption Column 2 Name Caption Column 3 Name Caption Column 4 Name Caption Bonus Bonus Sales Sales Salesperson Salesperson Region Region

Click OK when finished to close the editor.

Edit Tutorial 119

In Code Add the following code to the Form_Load event: Visual Basic ' Set up the columns. Dim cols As String = "Product|Region|Salesperson|Sales|Bonus" Dim colNames As String() = cols.Split("|") Dim i% For i = 0 To C1FlexGrid1.Cols.Count - 1 C1FlexGrid1(0, i) = colNames(i) C1FlexGrid1.Cols(i).Name = colNames(i) Next C# // Set up the columns. string cols = "Product|Region|Salesperson|Sales|Bonus"; string[]colNames = cols.Split("|"); for (int i = 0; i < c1FlexGrid1.Cols.Count; i++) { c1FlexGrid1[0, i] = colNames[i]; c1FlexGrid1.Cols[i].Name = colNames[i]; } Delphi var cols: string; colNames: array of string; I: Integer; begin // Set up the columns. cols := 'Product|Region|Salesperson|Sales|Bonus'; colNames := cols.Split('|'); For i := 0 To C1FlexGrid1.Cols.Count 1 do begin C1FlexGrid1[0, i] := colNames[i]; C1FlexGrid1.Cols[i].Name := colNames[i]; end; end;

Run the program and observe the following: That's it. Press F5 to run the project, and you can start typing data into the control. Press F2 or the SPACEBAR to edit existing entries, or just type new entries over existing ones.

120 C1FlexGrid Tutorials

Step 2: Set Column Types and Formats


When displaying numeric or date values, you will typically want to adopt a consistent format for the values. The C1FlexGrid control allows you to specify the DataType and Format for each column. These properties can be set either in the designer or in code. In the Designer 1. 2. 3. 4. Select the Sales column in the grid. This will open the Column Tasks menu for the Sales column. Set the Data Type box to Decimal. Click the ellipsis button in the Format String box to open the Format String dialog box. Under Format type select Currency.

Edit Tutorial 121

5. 6. 7.

Click OK to close the Format String dialog box. Select the Bonus column in the grid. This will open the Column Tasks menu for the Bonus column. Set the Data Type box to Boolean.

Alternatively, the DataType and Format properties can also be set up through the C1FlexGrid Column Editor: 1. Open the C1FlexGrid Column Editor by selecting Designer in the C1FlexGrid Tasks menu. For details on how to access the C1FlexGrid Column Editor, see Accessing the C1FlexGrid Column Editor (page 167). Select the Sales column in the right pane. Set the DataType property to Decimal. Click the ellipsis button next to the Format property. This will open the Format String dialog box.

2. 3. 4.

122 C1FlexGrid Tutorials

5. 6. 7. 8.

Under Format type select Currency. Click OK to close the Format String dialog box. Select the Bonus column in the right pane. Set the DataType property to Boolean.

Edit Tutorial 123

9.

Click OK to close the editor.

In Code To specify the DataType and Format for the columns, add the following code after the code added in Step 1: Create the C1FlexGrid Control (page 116): Visual Basic ' Set the column DataType and Format. Dim c As Column = C1FlexGrid1.Cols("Sales") c.DataType = GetType(Decimal) ' Currency. c.Format = "c" c = C1FlexGrid1.Cols("Bonus") c.DataType = GetType(Boolean) c.ImageAlign = ImageAlignEnum.CenterCenter C# // Set the column DataType and Format. Column c = c1FlexGrid1.Cols["Sales"]; c.DataType = typeof(Decimal); // Currency. c.Format = "c"; c = c1FlexGrid1.Cols["Bonus"]; c.DataType = typeof(bool); c.ImageAlign = ImageAlignEnum.CenterCenter;

124 C1FlexGrid Tutorials

Delphi // Set the column DataType and Format. Dim c As Column := C1FlexGrid1.Cols['Sales']; c.DataType := typeof(Decimal); // Currency. c.Format := 'c'; c := C1FlexGrid1.Cols['Bonus']; c.DataType := typeof(Boolean); c.ImageAlign := ImageAlignEnum.CenterCenter;

Run the program and observe the following: The new code formats the Sales column to store and display currency values, and the Bonus column to deal with Boolean values. If you enter some numeric and non-numeric values in the Sales column, you will notice that the grid won't accept non-numeric entries. The Bonus column displays values as checkboxes, which can be toggled with the mouse or with the keyboard. This is the default behavior for Boolean columns.

Note that the Format property does not affect the data in any way, only how it is displayed.

Step 3: Incorporate Drop-Down Lists


Entering data is a tedious and error-prone process. Drop-down lists are great because they minimize the amount of typing you must do, reduce the chance of errors, and increase the consistency of the data. Let's assume that our tutorial project only involves sales of three products (Applets, Wahoos, and Gadgets), in four regions (North, South, East, and West), and that there are three full-time sales people (Mary, Sarah, and Paula). To use these lists as drop-downs in the C1FlexGrid control, all you have to do is build strings containing the items in each list (separated by pipe characters) and assign them to the ComboList property of each column. This property can be set either in the designer or in code. In the Designer 1. Select the Product column. This will open the Column Tasks menu for the Product column.

Edit Tutorial 125

2. 3.

Click the ellipsis button in the Combo List box to open the Combo List dialog box. Enter Applets, Wahoos, and Gadgets as shown below:

4. 5. 6. 7.

Click OK to close the Combo List dialog box. Select the Region column. Click the ellipsis button in the Combo List box. Enter North, South, East, and West as shown below:

8. 9.

Click OK. Select the Salesperson column.

10. Click the ellipsis button in the Combo List box. 11. Enter Mary, Paula, and Sarah as shown below:

126 C1FlexGrid Tutorials

12. Select the Dropdown Combo option. 13. Click OK. Alternatively, the ComboList property can be set using the C1FlexGrid Column Editor: 1. Open the C1FlexGrid Column Editor by selecting Designer in the C1FlexGrid Tasks menu. For details on how to access the C1FlexGrid Column Editor, see Accessing the C1FlexGrid Column Editor (page 167). Select the Product column in the right pane. In the left pane, set the ComboList property to Applets|Wahoos|Gadgets.

2. 3.

Edit Tutorial 127

4. 5. 6. 7. 8.

Select the Region column in the right pane. In the left pane, set the ComboList property to North|South|East|West. Select the Salesperson column in the right pane. In the left pane set the ComboList property to |Mary|Paula|Sarah. Click OK to close the editor.

In Code To add the combolists, add the following code after the code added in Step 2: Set Column Types and Formats (page 120): Visual Basic ' Set up the drop-down lists. C1FlexGrid1.Cols("Product").ComboList = "Applets|Wahoos|Gadgets" C1FlexGrid1.Cols("Region").ComboList = "North|South|East|West" C1FlexGrid1.Cols("Salesperson").ComboList = "|Mary|Paula|Sarah" C# // Set up the drop-down lists. c1FlexGrid1.Cols["Product"].ComboList = "Applets|Wahoos|Gadgets"; c1FlexGrid1.Cols["Region"].ComboList = "North|South|East|West"; c1FlexGrid1.Cols["Salesperson"].ComboList = "|Mary|Paula|Sarah"; Delphi // Set up the drop-down lists. C1FlexGrid1.Cols['Product'].ComboList := 'Applets|Wahoos|Gadgets'; C1FlexGrid1.Cols['Region'].ComboList := 'North|South|East|West'; C1FlexGrid1.Cols['Salesperson'].ComboList := '|Mary|Paula|Sarah';

128 C1FlexGrid Tutorials

Run the program and observe the following: Notice how the last ComboList string starts with a pipe. This allows users to type additional names that are not on the list. In other words, these values will be edited using a drop-down combo, as opposed to a simple drop-down list. Press F5 to run the project again, then move the cursor around. When you move the cursor to one of the columns that have combo lists, a drop-down button becomes visible. You may click on it to show the list, or simply type the first letter of an entry to highlight it on the list.

Step 4: Add Data Validation


If you assign a data type to a grid column, the grid will ensure that only data of the proper type is stored in that column. This helps prevent errors, but you will often need stricter validation to ensure that the data entered is correct. For that, you should use the ValidateEdit event. For example, imagine that anti-trust regulations prevent us from selling our Applets in the North region. To prevent data-entry mistakes and costly lawsuits, we want to prevent users from entering this combination into the control. The following event checks the data after each edit and prevents invalid entries. Add the following code to the form: Visual Basic Private Sub C1FlexGrid1_ValidateEdit(ByVal sender As Object, ByVal e As ValidateEditEventArgs) Handles C1FlexGrid1.ValidateEdit Dim rgn As String, prd As String ' Collect the data we need. Select Case e.Col Case 0 prd = C1FlexGrid1.Editor.Text rgn = C1FlexGrid1(e.Row, "Region") Case 1 prd = C1FlexGrid1(e.Row, "Product") rgn = C1FlexGrid1.Editor.Text End Select

Edit Tutorial 129

' We can't sell Applets in the North Region. If prd = "Applets" And rgn = "North" Then MsgBox("Warning: Regulation #12333AS/SDA-23 forbids " & _ "the sale of " & prd & " in region " & rgn & ". " & _ "Please verify input.") e.Cancel = True End If End Sub C# private void c1FlexGrid1_ValidateEdit( object sender, ValidateEditEventArgs e) { string rgn = string.Empty; string prd = string.Empty; // Collect the data we need. switch (e.Col) { case 0: prd = c1FlexGrid1.Editor.Text; rgn = (string)c1FlexGrid1[e.Row, "Region"]; break; case 1: prd = (string)c1FlexGrid1[e.Row, "Product"]; rgn = c1FlexGrid1.Editor.Text; break; } // We can't sell Applets in the North Region. if ( prd == "Applets" && rgn == "North" ) { MessageBox.Show("Warning: Regulation #12333AS/SDA-23 forbids " + "the sale of " + prd + " in region " + rgn + ". " + "Please verify input."); e.Cancel = true; } } Delphi procedure C1FlexGrid1_ValidateEdit(sender: System.Object; e: ValidateEditEventArgs); var rgn: string; prd: string; begin // Collect the data we need. case e.Col of 0: begin prd := C1FlexGrid1.Editor.Text; rgn := C1FlexGrid1[e.Row, 'Region']; end; 1: begin prd := C1FlexGrid1[e.Row, 'Product']; rgn := C1FlexGrid1.Editor.Text; end; end;

130 C1FlexGrid Tutorials

// We can't sell Applets in the North Region. If (prd = 'Applets') And (rgn = 'North') Then begin MsgBox('Warning: Regulation #12333AS/SDA-23 forbids ' + _ 'the sale of ' + prd + ' in region ' + rgn + ". " + _ 'Please verify input.'); e.Cancel := True; end; end; Run the program and observe the following: The function starts by gathering the input that needs to be validated. Note that the values being checked are retrieved using the Editor.Text property. This is necessary because the edits have not yet been applied to the control. If the test fails, the function displays a warning and then sets the Cancel parameter to True, which cancels the edits and puts the cell back in edit mode so the user can try again. Press F5 to run the project again, then try inputting some bad values. You will see that the control will reject them.

Step 5: Add Clipboard Support


The Windows clipboard is a very useful device for transferring information between applications. Adding clipboard support to FlexGrid projects is fairly easy. Simply set the AutoClipboard property to True either in the designer or in code, and the grid will automatically handle all standard keyboard commands related to the clipboard: CTRL+X or SHIFT+DELETE to cut, CTRL+C or CTRL+INSERT to copy, and CTRL+V or SHIFT+INSERT to paste. In the Designer Locate the AutoClipboard property in the Properties window and set it to True.

In Code Add the following code after the code added in Step 3: Incorporate Drop-Down Lists (page 124): Visual Basic C1FlexGrid1.AutoClipboard = True C# c1FlexGrid1.AutoClipboard = true; Delphi C1FlexGrid1.AutoClipboard := True;

Another great Windows feature that is closely related to clipboard operations is OLE Drag and Drop. C1FlexGrid has two properties, DragMode and DropMode, which help implement this feature. Just set both properties to their automatic settings either in the designer or in code, and you will be able to drag selections

Edit Tutorial 131

by their edges and drop them into other applications such as Microsoft Excel, or drag ranges from an Excel spreadsheet and drop them into the C1FlexGrid control. In the Designer Locate the DragMode and DropMode properties and set them both to Automatic.

In Code Add the following code after the code to set the AutoClipboard property: Visual Basic C1FlexGrid1.DragMode = DragModeEnum.Automatic C1FlexGrid1.DropMode = DropModeEnum.Automatic C# c1FlexGrid1.DragMode = DragModeEnum.Automatic; c1FlexGrid1.DropMode = DropModeEnum.Automatic; Delphi C1FlexGrid1.DragMode := DragModeEnum.Automatic; C1FlexGrid1.DropMode := DropModeEnum.Automatic;

Run the program and observe the following: Press F5 to run the project again, then try copying and pasting some data. Note that you can paste invalid data, because our paste code does not perform any data validation. This is left as an exercise for the reader.

Step 6: Include Custom Editors


The C1FlexGrid has powerful built-in editors for entering text, masked text, selecting from lists, checkboxes, and more. But in some cases you may want to use a custom editor instead, perhaps one of the input controls in the C1Input library or a control that you wrote. Starting in version 2.5, the FlexGrid allows you to easily plugin custom editors. To attach a custom editor to the Sales column on our tutorial, start by adding a NumericUpDown control to the form. 1. Set the following properties the .NET Properties window to for the NumericUpDown control: Property BorderStyle DecimalPlaces Maximum ThousandsSeparator Visible 2. Setting None 2 5000000 True False

Select Designer from the C1FlexGrid Tasks menu to bring up the grid's column editor.

132 C1FlexGrid Tutorials

3.

Select the Sales column (or Column 3 where the Sales figures will be), and set the Editor property to NumericUpDown1, as shown below:

Run the program and observe the following: Now run the project and try editing some values in the Sales column. Notice that the grid uses the NumericUpDown control instead of the built-in editors. The control is properly positioned, initialized, and managed. When you move the focus to a different cell, the value is stored in the grid.

Edit Tutorial 133

But the custom editor doesn't behave exactly like the built-in ones. For example: 1. 2. 3. When you start editing by typing a number, the old value isn't cleared. The size of the editor isn't exactly right (it looks a bit too small). There's a beep when you press ENTER to finish editing.

You can overcome these problems in a couple of ways. One way would be to use the editor's events, but that would make it difficult to reuse the control in other projects. Another way would be to create a derived class and implement some methods in the IC1EmbeddedEditor interface, as in the following code. Visual Basic Public Class MyUpDown Inherits NumericUpDown ' Set the initial value. Public Sub C1EditorInitialize(ByVal value As Object, ByVal editorAttributes As IDictionary) ' Apply the initial value. value = Convert.ChangeType(value, GetType(Decimal)) ' Select the whole entry. MyBase.Select(0, Int32.MaxValue) End Sub ' Set the FontHeight so the control honors the rectangle height. Public Sub C1EditorUpdateBounds(ByVal rc As Rectangle) MyBase.FontHeight = rc.Height Bounds = rc End Sub ' Suppress the beeps when a user presses ENTER. Protected Overrides Function ProcessDialogKey(ByVal keyData As Keys) As Boolean If (keyData = Keys.Enter) Then Parent.Focus() If (Parent.Focused) Then SendKeys.Send("{Down}") Return True End If Return MyBase.ProcessDialogKey(keyData) End Function End Class C# internal class MyUpDown : NumericUpDown { // Set the initial value. public void C1EditorInitialize(object value, IDictionary editorAttributes) { // Apply the initial value. Value = (decimal)Convert.ChangeType(value, typeof(decimal)); // Select the whole entry. Select(0, int.MaxValue);

134 C1FlexGrid Tutorials

// Set the FontHeight so the control honors the rectangle height. public void C1EditorUpdateBounds(Rectangle rc) { base.FontHeight = rc.Height; Bounds = rc; } // Suppress the beeps when a user presses ENTER. override protected bool ProcessDialogKey(Keys keyData) { if (keyData == Keys.Enter) { Parent.Focus(); if (Parent.Focused) SendKeys.Send("{Down}"); return true; } return base.ProcessDialogKey(keyData); } } Delphi type TMyUpDown = class(NumericUpDown) public procedure C1EditorInitialize(value: System.Object; editorAttributes: IDictionary); procedure C1EditorUpdateBounds(rc: Rectangle); function ProcessDialogKey(keyData: Keys): boolean; end; // Set the initial value. procedure TMyUpDown.C1EditorInitialize(value: System.Object; editorAttributes: IDictionary); begin // Apply the initial value. value := Currency(Convert.ChangeType(value, TypeOf(Currency))); // Select the whole entry. Select(0, System.Int32.MaxValue); end; // Set the FontHeight so the control honors the rectangle height. procedure TMyUpDown.C1EditorUpdateBounds(rc: Rectangle); begin inherited FontHeight := rc.Height; Bounds := rc; end; // Suppress the beeps when a user presses ENTER. function TMyUpDown.ProcessDialogKey(keyData: Keys): boolean; begin if (keyData = Keys.Enter) then begin Parent.Focus;

Outline Tutorial 135

if (Parent.Focused) then SendKeys.Send({Down}); Result := true; Exit; end; Result := inherited ProcessDialogKey(keyData); end; The previous code implements three methods: C1EditorInitialize is called to initialize the editor. It sets the initial value and then selects the whole entry. This will take care of the first problem. Because the whole entry is selected, typing the first character will now replace the current contents as we want. C1EditorUpdateBounds is called to position the editor over the cell being edited. The height of the NumericUpDown control is set automatically based on the font size, though (that is why it looks too short for the cell). The code sets the editor's FontHeight property so it will be positioned exactly over the cell. ProcessDialogKey method is overridden to suppress the beeps when the user presses the ENTER key.

Outline Tutorial
This tutorial shows how you can use the C1FlexGrid as an outliner to display structured (or hierarchical) data. When used as an outliner, the C1FlexGrid control behaves like a Tree control, displaying nodes that can be collapsed or expanded to show branches containing subordinate data. The tutorial allows you to load an XML document into the grid, where it is displayed as a tree. Here is what the final application will look like:

Step 1: Create the Controls


Start a new project and add two controls: A command button near the top of the form. A C1FlexGrid control in the area below the button.

136 C1FlexGrid Tutorials

If you can't find the C1FlexGrid control in the toolbox, right-click on the toolbox and select Choose Items. Then, look for the C1FlexGrid control on the list of .NET components and make sure it is checked. If you can't find the grid in the component list, you may need to re-install the product. 1. Set the following properties in the .NET Properties window: Command button Property Dock Text C1FlexGrid Property Dock 2. Setting Fill Setting Top "Open XML File"

Double-click the form caption area to open the code window. At the top of the file, add the following statement: Visual Basic Imports C1.Win.C1FlexGrid C# using C1.Win.C1FlexGrid; Delphi uses C1.Win.C1FlexGrid;

This makes the objects defined in the C1FlexGrid assembly visible to the project and saves a lot of typing. 3. Set up the grid either in the designer using the Properties window and editors, or in code by typing (or copying) the following code. In the Designer Set the following properties for the C1FlexGrid control in the Properties window: Property Cols.Count Cols.Fixed ExtendLastCol Rows.Count Tree.Column Tree.Style Set up the styles for the grid: Open the C1FlexGrid Style Editor by selecting Styles from the C1FlexGrid Tasks menu. For more information on accessing the C1FlexGrid Style Editor, see Accessing the C1FlexGrid Style Editor (page 168). Select Normal in the list of Built-In Styles. Set the Border.Style property to None, the TextAlign property to LeftCenter, and the WordWrap property to False. Setting 2 0 True 1 0 SimpleLeaf

Outline Tutorial 137

Click the Add button. Rename CustomStyle1 to Data. Set the BackColor property to Control.

138 C1FlexGrid Tutorials

Click OK to close the editor. Select Column 0 in the grid. This will open the Column Tasks menu for Column 0. Set the Column Caption to Element. Uncheck the Allow Editing check box.

Set up the columns for the grid:

Outline Tutorial 139

Select Column 1. Set the Column Caption to Text. Open the C1FlexGrid Column Editor by selecting Designer in the C1FlexGrid Tasks menu. For details on how to access the C1FlexGrid Column Editor, see Accessing the C1FlexGrid Column Editor (page 167). Select Column 0 in the right pane. In the left pane, set the AllowEditing property to False and the Caption property to Element.

Alternatively, the columns can also be set up through the C1FlexGrid Column Editor:

140 C1FlexGrid Tutorials

Select Column 1 in the right pane. In the left pane, set the Caption property to Text. Click OK to close the editor. Visual Basic Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Initialize the grid. C1FlexGrid1.Rows.Count = 1 C1FlexGrid1.Cols.Count = 2 C1FlexGrid1.Cols.Fixed = 0 C1FlexGrid1.ExtendLastCol = True C1FlexGrid1(0, 0) = "Element" C1FlexGrid1(0, 1) = "Text" ' Initialize the outline tree. C1FlexGrid1.Tree.Column = 0 C1FlexGrid1.Tree.Style = TreeStyleFlags.SimpleLeaf C1FlexGrid1.Cols(0).AllowEditing = False ' Initialize styles. C1FlexGrid1.Styles.Normal.Border.Style = BorderStyleEnum.None C1FlexGrid1.Styles.Normal.TextAlign = TextAlignEnum.LeftCenter C1FlexGrid1.Styles.Normal.WordWrap = False Dim cs As CellStyle = C1FlexGrid1.Styles.Add("Data") cs.BackColor = SystemColors.Control End Sub

In Code

Outline Tutorial 141

C# private void Form1_Load( System.object sender, System.EventArgs e) { // Initialize the grid. c1FlexGrid1.Rows.Count = 1; c1FlexGrid1.Cols.Count = 2; c1FlexGrid1.Cols.Fixed = 0; c1FlexGrid1.ExtendLastCol = true; c1FlexGrid1[0, 0] = "Element"; c1FlexGrid1[0, 1] = "Text"; // Initialize the outline tree. c1FlexGrid1.Tree.Column = 0; c1FlexGrid1.Tree.Style = TreeStyleFlags.SimpleLeaf; c1FlexGrid1.Cols[0].AllowEditing = false; // Initialize styles. c1FlexGrid1.Styles.Normal.Border.Style = BorderStyleEnum.None; c1FlexGrid1.Styles.Normal.TextAlign = TextAlignEnum.LeftCenter; c1FlexGrid1.Styles.Normal.WordWrap = false; CellStyle cs = c1FlexGrid1.Styles.Add("Data"); cs.BackColor = SystemColors.Control; }

Delphi procedure Form1_Load(sender: System.Object; e: System.EventArgs); var cs: CellStyle; begin // Initialize the grid. C1FlexGrid1.Rows.Count := 1; C1FlexGrid1.Cols.Count := 2; C1FlexGrid1.Cols.Fixed := 0; C1FlexGrid1.ExtendLastCol := True; C1FlexGrid1[0, 0] := 'Element'; C1FlexGrid1[0, 1] := 'Text'; // Initialize the outline tree. C1FlexGrid1.Tree.Column := 0; C1FlexGrid1.Tree.Style := TreeStyleFlags.SimpleLeaf; C1FlexGrid1.Cols[0].AllowEditing := False; // Initialize styles. C1FlexGrid1.Styles.Normal.Border.Style := BorderStyleEnum.None; C1FlexGrid1.Styles.Normal.TextAlign := TextAlignEnum.LeftCenter; C1FlexGrid1.Styles.Normal.WordWrap := False; cs := C1FlexGrid1.Styles.Add('Data'); cs.BackColor := SystemColors.Control; end;

142 C1FlexGrid Tutorials

Run the program and observe the following: The code starts by setting up the grid layout and column heading text.

Next, it initializes the outline tree using the Tree property and prevents editing of the XML nodes by setting the AllowEditing property of the first column to False. Note that the user can still edit data in the second column, which contains the data in each XML node. Now the control is ready. We can start adding some code to it.

Step 2: Read the Data and Build the Outline


To read the data and build the outline, add code to the Button1_Click event and add the GetXMLData routine. 1. Double-click the command button and add the following code to the Button1_Click event: Visual Basic Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' Get the file name. Dim fo As OpenFileDialog = New OpenFileDialog() fo.DefaultExt = "xml" fo.Filter = "XML Files (*.xml)|*.xml" If fo.ShowDialog() <> DialogResult.OK Then Exit Sub ' Load the XML file. Dim xdoc As Xml.XmlDocument = New Xml.XmlDocument() xdoc.Load(fo.FileName) ' Stop redrawing to improve speed. C1FlexGrid1.Redraw = False ' Populate the grid. C1FlexGrid1.Rows.Count = 1 GetXMLData(xdoc.ChildNodes(1), 0)

Outline Tutorial 143

' Autosize the tree column. C1FlexGrid1.AutoSizeCol(0) ' Show levels 0, 1, and 2. C1FlexGrid1.Tree.Show(2) ' Start redrawing. C1FlexGrid1.Redraw = True End Sub C# private void Button1_Click( System.object sender, System.EventArgs e) { // Get the file name. OpenFileDialog fo = new OpenFileDialog(); fo.DefaultExt = "xml"; fo.Filter = "XML Files (*.xml)|*.xml"; if ( fo.ShowDialog() != DialogResult.OK ) return // Load the XML file. Xml.XmlDocument xdoc = new Xml.XmlDocument(); xdoc.Load(fo.FileName); // Stop redrawing to improve speed. c1FlexGrid1.Redraw = false; // Populate the grid. c1FlexGrid1.Rows.Count = 1; GetXMLData(xdoc.ChildNodes[1], 0) // Autosize the tree column. c1FlexGrid1.AutoSizeCol(0); // Show levels 0, 1, and 2. c1FlexGrid1.Tree.Show(2); // Start redrawing. c1FlexGrid1.Redraw = true; } Delphi procedure Button1_Click(sender: System.Object; e: System.EventArgs); var fo: OpenFileDialog; xdoc: Xml.XmlDocument; begin // Get the file name. fo := OpenFileDialog.Create; fo.DefaultExt := 'xml'; fo.Filter := 'XML Files (*.xml)|*.xml'; If fo.ShowDialog <> System.Windows.Forms.DialogResult.OK Then exit; // Load the XML file. xdoc := Xml.XmlDocument.Create; xdoc.Load(fo.FileName);

144 C1FlexGrid Tutorials

// Stop redrawing to improve speed. C1FlexGrid1.Redraw := False; // Populate the grid. C1FlexGrid1.Rows.Count := 1; GetXMLData(xdoc.ChildNodes[1], 0); // Autosize the tree column. C1FlexGrid1.AutoSizeCol(0); // Show levels 0, 1, and 2. C1FlexGrid1.Tree.Show(2); // Start redrawing. C1FlexGrid1.Redraw := True; end; Observe the following: The routine starts by showing an OpenFileDialog that allows the user to select an XML file to load into the grid. When the file is selected, the routine loads it into an XmlDocument object, which parses the contents of the file into memory. The routine then sets the grid's Redraw property to False to suspend repainting while the control is populated. This technique improves performance significantly, and you should always use it when adding substantial amounts of data to the C1FlexGrid. Next, the routine clears any data by setting Count to 1, and calls the GetXMLData routine to populate the control with the contents of the XmlDocument. The GetXMLData routine is the main one in this tutorial, and is listed below. After the grid has been populated, the routine uses the AutoSizeCol method to adjust the width of the first column based on its contents, and the Show method to expand the outline and show levels 0, 1, and 2. The routine then sets the Redraw property back to True so the grid starts repainting normally. 2. The GetXMLData routine is the most interesting one in this tutorial. It traverses the XMLDocument object and builds the outline tree. Add the following code to the form: Visual Basic Private Sub GetXMLData(ByVal node As Xml.XmlNode, ByVal level As Integer) ' Skip the comment nodes. If node.NodeType = Xml.XmlNodeType.Comment Then Exit Sub End If ' Add a new row for this node. Dim row As Integer = C1FlexGrid1.Rows.Count C1FlexGrid1.Rows.Add() ' Add data to the new row. C1FlexGrid1(row, 0) = node.Name If node.ChildNodes.Count = 1 Then C1FlexGrid1(row, 1) = node.InnerText C1FlexGrid1.SetCellStyle(row, 1, C1FlexGrid1.Styles("Data")) End If

' If the node has a "Name" subnode, save it to use as a tooltip. If node.ChildNodes.Count > 0 Then

Outline Tutorial 145

Dim ndName As Xml.XmlNode = node.SelectSingleNode("Name") If Not (ndName Is Nothing) Then C1FlexGrid1.Rows(row).UserData = ndName.InnerText End If End If ' If this node has children, get them as well. If node.ChildNodes.Count > 1 Then ' Make this row a node. C1FlexGrid1.Rows(row).IsNode = True C1FlexGrid1.Rows(row).Node.Level = level ' Recurse to get children. Dim child As Xml.XmlNode For Each child In node.ChildNodes GetXMLData(child, level + 1) Next End If End Sub C# private void GetXMLData( Xml.XmlNode node, int level) { // Skip the comment nodes. if ( node.NodeType == Xml.XmlNodeType.Comment ) return; } // Add a new row for this node. int row = c1FlexGrid1.Rows.Count; c1FlexGrid1.Rows.Add(); // Add data to the new row. c1FlexGrid1(row, 0) = node.Name; if ( node.ChildNodes.Count = 1 ) { c1FlexGrid1(row, 1) = node.InnerText; c1FlexGrid1.SetCellStyle(row, 1, c1FlexGrid1.Styles["Data"]); } // If the node has a "Name" subnode, save it to use as a tooltip. if (node.ChildNodes.Count > 0) { Xml.XmlNode ndName = node.SelectSingleNode("Name"); if (ndName != null) { c1FlexGrid1.Rows[row].UserData = ndName.InnerText; } } // If this node has children, get them as well. if ( node.ChildNodes.Count > 1 ) {

// Make this row a node. c1FlexGrid1.Rows[row].IsNode = true;

146 C1FlexGrid Tutorials

c1FlexGrid1.Rows[row].Node.Level = level; // Recurse to get children. Xml.XmlNode child; foreach ( child In node.ChildNodes ) GetXMLData(child, level + 1) } } Delphi procedure GetXMLData(node: Xml.XmlNode; level: Integer); var r: Integer; ndName: Xml.XmlNode; child: Xml.XmlNode; begin // Skip the comment nodes. if node.NodeType = Xml.XmlNodeType.Comment then exit; // Add a new row for this node. r := C1FlexGrid1.Rows.Count; C1FlexGrid1.Rows.Add; // Add data to the new row. C1FlexGrid1[row, 0] := node.Name; if node.ChildNodes.Count = 1 then begin C1FlexGrid1[row, 1] := node.InnerText; C1FlexGrid1.SetCellStyle(row, 1, C1FlexGrid1.Styles['Data']); end; // If the node has a "Name" subnode, save it to use as a tooltip. if node.ChildNodes.Count > 0 then begin ndName := node.SelectSingleNode('Name'); if ndName <> nil then begin C1FlexGrid1.Rows[row].UserData := ndName.InnerText; end; end; // If this node has children, get them as well. if node.ChildNodes.Count > 1 then begin // Make this row a node. C1FlexGrid1.Rows[row].IsNode := True; C1FlexGrid1.Rows[row].Node.Level := level; // Recurse to get children. for I := 0 to node.ChildNodes.Count 1 do GetXMLData(node.ChildNodes[I], level + 1); end; end;

Outline Tutorial 147

Observe the following: The routine starts by skipping XML comment nodes. Then it uses the Rows.Add method to add a new row to the grid. Next, the routine sets the node name and checks whether the node has exactly one child. In this case, the node is interpreted as a data node, and the node's InnerText property is copied to the second column on the new row. The code also sets the style of cells containing data to the custom style "Data" created when the form was loaded. The next block of code checks to see whether this node has a subnode called "Name". If it does, then the contents of the "Name" node are assigned to the new row's UserData property. This value will be used later to implement tooltips, so users can see the node name even when it is collapsed. Finally, if the node has children, the GetXMLData routine calls itself to add the child nodes to the grid as well. Run the program and observe the following: The project can load XML files and display them, and the user can collapse and expand nodes by clicking on them.

The next steps add a few improvements to make the application easier to use.

Step 3: Add Custom Mouse and Keyboard Handling


The C1FlexGrid provides the expanding and collapsing for you, but you may extend and customize its behavior. Every time a branch is expanded or collapsed, the control fires the BeforeCollapse and AfterCollapse events so you may take actions in response to that. Furthermore, you may use the Collapsed property to get and set the collapsed state of each branch in code. In this tutorial, we will trap the DoubleClick and KeyPress events to expand and collapse nodes when the user double clicks or presses the ENTER key. Add the following DoubleClick and KeyPress events to the form: Visual Basic Private Sub C1FlexGrid1_DoubleClick(ByVal sender As Object, ByVal e As EventArgs) Handles C1FlexGrid1.DoubleClick If C1FlexGrid1.MouseCol = 0 Then

148 C1FlexGrid Tutorials

ToggleNodeState() End If End Sub Private Sub C1FlexGrid1_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs) Handles C1FlexGrid1.KeyPress If e.KeyChar = vbCr Then ToggleNodeState() End If End Sub Private Sub ToggleNodeState() ' If the current row is not a node, no work is done. Dim r As Row = C1FlexGrid1.Rows(C1FlexGrid1.Row) If Not r.IsNode Then Exit Sub ' Toggle the collapsed state. r.Node.Collapsed = Not r.Node.Collapsed End Sub C# private void c1FlexGrid1_DoubleClick( object sender, EventArgs e) { if ( c1FlexGrid1.MouseCol == 0 ) { ToggleNodeState(); } } private void c1FlexGrid1_KeyPress( object sender, KeyPressEventArgs e) { if ( e.KeyChar == 13 ) { ToggleNodeState(); } } private void ToggleNodeState() { // If the current row is not a node, no work is done. Row r = c1FlexGrid1.Rows[c1FlexGrid1.Row]; if (! r.IsNode ) return; // Toggle the collapsed state. r.Node.Collapsed = !r.Node.Collapsed; } Delphi procedure C1FlexGrid1_DoubleClick(sender: System.Object; e: System.EventArgs); begin If C1FlexGrid1.MouseCol = 0 Then ToggleNodeState; end; procedure C1FlexGrid1_KeyPress(sender: System.Object;

Outline Tutorial 149

e: KeyPressEventArgs); begin If e.KeyChar = #13 Then ToggleNodeState; end; procedure ToggleNodeState; var r: Row; begin // If the current row is not a node, no work is done. r := C1FlexGrid1.Rows[C1FlexGrid1.Row]; If Not r.IsNode Then exit; // Toggle the collapsed state. r.Node.Collapsed := Not r.Node.Collapsed; end; Run the program and observe the following: The event handlers check whether the user double-clicked the first column or hit the ENTER key, then call the ToggleNodeState routine. ToggleNodeState checks whether the current row is a node row, and toggles the value of the Collapsed property if it is.

Step 4: Allow/Prevent Editing


Recall that we set the AllowEditing property of the first column to False. This prevents users from editing any cells in the first column. We would also like to prevent users from entering data in the second column of node rows. To do this, add the following code to handle the BeforeEdit event: Visual Basic Private Sub C1FlexGrid1_BeforeEdit(ByVal sender As Object, ByVal e As RowColEventArgs) Handles C1FlexGrid1.BeforeEdit ' If the current row is a node, don't edit it. Dim r As Row = C1FlexGrid1.Rows(C1FlexGrid1.Row) If r.IsNode Then e.Cancel = True End Sub C# private void c1FlexGrid1_BeforeEdit( object sender, RowColEventArgs e) { // If the current row is a node, don't edit it. Row r = c1FlexGrid1.Rows[c1FlexGrid1.Row]; if (r.IsNode ) e.Cancel = true; } Delphi procedure C1FlexGrid1_BeforeEdit(sender: System.Object; e: RowColEventArgs); var r: Row; begin // If the current row is a node, don't edit it. r := C1FlexGrid1.Rows[C1FlexGrid1.Row]; If r.IsNode Then e.Cancel := True; end;

150 C1FlexGrid Tutorials

Step 5: Implement ToolTips


To conclude this tutorial, we will add tooltips to the outline. The tooltips will display the text that was stored in each row's UserData property by the GetXMLData routine described above. The tooltips will show the contents of the "Name" node when the user moves the mouse over its parent node. This is useful when the parent node is collapsed and the "Name" node is not visible. 1. 2. Add a ToolTip control to the form. Add the following code to handle the grid's MouseMove event: Visual Basic Private Sub C1FlexGrid1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles C1FlexGrid1.MouseMove ' Check the tooltip for this cell. Dim tip As String If C1FlexGrid1.MouseCol = 0 And C1FlexGrid1.MouseRow > 0 Then tip = C1FlexGrid1.Rows(C1FlexGrid1.MouseRow).UserData End If ' Set it if it is different from the current tooltip. If tip <> ToolTip1.GetToolTip(C1FlexGrid1) Then ToolTip1.SetToolTip(C1FlexGrid1, tip) End If End Sub C# private void c1FlexGrid1_MouseMove( object sender, MouseEventArgs e) { // Check the tooltip for this cell. string tip; if ( c1FlexGrid1.MouseCol == 0 && c1FlexGrid1.MouseRow > 0 ) { tip = c1FlexGrid1.Rows[c1FlexGrid1.MouseRow].UserData; } // Set it if it is different from the current tooltip. if ( tip != ToolTip1.GetToolTip(c1FlexGrid1) ) { ToolTip1.SetToolTip(c1FlexGrid1, tip); } } Delphi procedure C1FlexGrid1_MouseMove(sender: System.Object; e: System.MouseEventArgs); var tip: string; begin // Check the tooltip for this cell. If (C1FlexGrid1.MouseCol = 0) And (C1FlexGrid1.MouseRow > 0) Then tip := C1FlexGrid1.Rows[C1FlexGrid1.MouseRow].UserData; // Set it if it is different from the current tooltip. If tip <> ToolTip1.GetToolTip(C1FlexGrid1) Then ToolTip1.SetToolTip(C1FlexGrid1, tip); end;

Data Analysis Tutorial 151

Run the program and observe the following: The code starts by checking the cell under the mouse using the MouseRow and MouseCol properties. If the mouse is over the first column on a row that contains text for the tooltip, it retrieves the text. Otherwise, the tooltip text is set to Nothing.

Then the routine compares the new and current tooltip text, and updates the text if necessary, by calling the SetToolTip method on the tooltip control. This concludes this tutorial. You can extend this project in many ways, including saving edits back into the XML document, adding, deleting, and moving nodes, using different styles for different types of data, and so on.

Data Analysis Tutorial


This tutorial combines some of the most useful features in the C1FlexGrid control to provide a dynamic view of a data table. The application starts with a simple data-bound grid containing sales data (from the NorthWind database), then adds the following features: Dynamic layout (column order) Automatic sorting Cell merging Automatic subtotals Outlining

The picture below shows what the final application looks like. The user can drag the first three columns to group the data by salesperson, country, and product name. When a column is dragged, the totals are automatically recalculated and the outline tree is rebuilt.

152 C1FlexGrid Tutorials

Step 1: Create the C1FlexGrid Control


Start a new project and add a C1FlexGrid control to the form by clicking the C1FlexGrid icon on the toolbox, then clicking on the form and dragging until the object has the proper size. If you can't find the C1FlexGrid control in the toolbox, right-click on the toolbox and select Choose Items. Then, look for the C1FlexGrid control on the list of .NET components and make sure it is checked. If you can't find the grid in the component list, you may need to re-install the product. 1. Set the following property in the Properties window for the C1FlexGrid control: Property Dock 2. Setting Fill

Double-click the form caption area to open the code window. At the top of the file, add the following statements: Visual Basic Imports System.Data.OleDb Imports System.ComponentModel Imports C1.Win.C1FlexGrid C# using System.Data.OleDb; using System.ComponentModel; using C1.Win.C1FlexGrid; Delphi uses System.Data.OleDb, System.ComponentModel, C1.Win.C1FlexGrid;

This makes the objects defined in the C1FlexGrid and OleDb assemblies visible to the project and saves a lot of typing.

Step 2: Initialize and Populate the Grid


To set up the grid and populate the grid with the sales data we want to analyze, set the layout properties and styles either in the designer or in code, and use the GetDataSource method to populate the grid.

Data Analysis Tutorial 153

1.

Set up the grid layout and styles either in the designer or in code. In the Designer In the Properties window, set the following properties: Property AllowEditing AllowSorting AllowMerging ExtendLastCol SelectionMode Tree.Style Tree.Column Setting False None Nodes True Cell Simple 1

Open the C1FlexGrid Style Editor by selecting Styles from the C1FlexGrid Tasks menu. For more information on accessing the C1FlexGrid Style Editor, see Accessing the C1FlexGrid Style Editor (page 168). Select Normal from the list of Built-In Styles. Set the Border.Style property to None and the Trimming property to EllipsisCharacter. Select Subtotal0 from the list of Built-In Styles. Set the BackColor property to Gold, and the ForeColor property to Black.

154 C1FlexGrid Tutorials

Set the properties for Subtotal1 and Subtotal2 to the following: Subtotal1 BackColor ForeColor Subtotal2 BackColor ForeColor LightGoldenrodYellow Black Khaki Black

Click OK to close the editor.

In Code Add the following code to the Form_Load event to set up the grid layout and styles: Visual Basic Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As EventArgs) Handles MyBase.Load ' Set up the grid layout/behavior. C1FlexGrid1.AllowEditing = False C1FlexGrid1.AllowSorting = AllowSortingEnum.None C1FlexGrid1.AllowMerging = AllowMergingEnum.Nodes C1FlexGrid1.SelectionMode = SelectionModeEnum.Cell C1FlexGrid1.ExtendLastCol = True C1FlexGrid1.Cols(0).Width = C1FlexGrid1.Cols.DefaultSize / 4 C1FlexGrid1.Tree.Style = TreeStyleFlags.Simple C1FlexGrid1.Tree.Column = 1 ' Set up grid styles. C1FlexGrid1.Styles.Normal.Border.Style = BorderStyleEnum.None C1FlexGrid1.Styles.Normal.Trimming = StringTrimming.EllipsisCharacter Dim s As CellStyle = C1FlexGrid1.Styles(CellStyleEnum.GrandTotal) s.BackColor = Color.Black s.ForeColor = Color.White s = C1FlexGrid1.Styles(CellStyleEnum.Subtotal0) s.BackColor = Color.Gold s.ForeColor = Color.Black s = C1FlexGrid1.Styles(CellStyleEnum.Subtotal1) s.BackColor = Color.Khaki s.ForeColor = Color.Black s = C1FlexGrid1.Styles(CellStyleEnum.Subtotal2) s.BackColor = Color.LightGoldenrodYellow s.ForeColor = Color.Black End Sub C# private void Form1_Load( System.object sender, EventArgs e) { // Set up the grid layout/behavior. c1FlexGrid1.AllowEditing = False c1FlexGrid1.AllowSorting = AllowSortingEnum.None; c1FlexGrid1.AllowMerging = AllowMergingEnum.Nodes;

Data Analysis Tutorial 155

c1FlexGrid1.SelectionMode = SelectionModeEnum.Cell; c1FlexGrid1.ExtendLastCol = true; c1FlexGrid1.Cols[0].Width = c1FlexGrid1.Cols.DefaultSize / 4; c1FlexGrid1.Tree.Style = TreeStyleFlags.Simple; c1FlexGrid1.Tree.Column = 1; // Set up grid styles. c1FlexGrid1.Styles.Normal.Border.Style = BorderStyleEnum.None; c1FlexGrid1.Styles.Normal.Trimming = StringTrimming.EllipsisCharacter; CellStyle s = c1FlexGrid1.Styles[CellStyleEnum.GrandTotal]; s.BackColor = Color.Black; s.ForeColor = Color.White; s = c1FlexGrid1.Styles[CellStyleEnum.Subtotal0]; s.BackColor = Color.Gold; s.ForeColor = Color.Black; s = c1FlexGrid1.Styles[CellStyleEnum.Subtotal1]; s.BackColor = Color.Khaki; s.ForeColor = Color.Black; s = c1FlexGrid1.Styles[CellStyleEnum.Subtotal2]; s.BackColor = Color.LightGoldenrodYellow; s.ForeColor = Color.Black; } Delphi procedure Form1_Load(sender: System.Object; e: System.EventArgs); var s: CellStyle; begin // Set up the grid layout/behavior. C1FlexGrid1.AllowEditing = False C1FlexGrid1.AllowSorting := AllowSortingEnum.None; C1FlexGrid1.AllowMerging := AllowMergingEnum.Nodes; C1FlexGrid1.SelectionMode := SelectionModeEnum.Cell; C1FlexGrid1.ExtendLastCol := True; C1FlexGrid1.Cols[0].Width := C1FlexGrid1.Cols.DefaultSize / 4; C1FlexGrid1.Tree.Style := TreeStyleFlags.Simple; C1FlexGrid1.Tree.Column := 1; // Set up grid styles. C1FlexGrid1.Styles.Normal.Border.Style := BorderStyleEnum.None; C1FlexGrid1.Styles.Normal.Trimming := StringTrimming.EllipsisCharacter; s := C1FlexGrid1.Styles[CellStyleEnum.GrandTotal]; s.BackColor := Color.Black; s.ForeColor := Color.White; s = C1FlexGrid1.Styles[CellStyleEnum.Subtotal0]; s.BackColor := Color.Gold; s.ForeColor := Color.Black; s := C1FlexGrid1.Styles[CellStyleEnum.Subtotal1]; s.BackColor := Color.Khaki; s.ForeColor := Color.Black; s := C1FlexGrid1.Styles[CellStyleEnum.Subtotal2]; s.BackColor := Color.LightGoldenrodYellow;

156 C1FlexGrid Tutorials

s.ForeColor := Color.Black; end; The routine starts by setting up the grid layout and some styles. 2. Bind C1FlexGrid to a data source by adding the following code to the Form_Load event: Visual Basic ' Bind C1FlexGrid to the data source. C1FlexGrid1.DataSource = GetDataSource() C# // Bind C1FlexGrid to the data source. c1FlexGrid1.DataSource = GetDataSource(); Delphi // Bind C1FlexGrid to the data source. C1FlexGrid1.DataSource := GetDataSource;

The routine binds it to a data source created by the GetDataSource method, listed below. 3. Lock the last three columns in place by setting their AllowDragging property to False. This is done to prevent the user from grouping the data in these columns (the values in these columns are distinct for each row). This property can be set either in the designer or at in code. In the Designer Select Column 4 in the grid. This will open the Column Tasks menu for Column 4. Uncheck the Allow Dragging check box.

Repeat for Column 5 and Column 6. Open the C1FlexGrid Column Editor by selecting Designer in the C1FlexGrid Tasks menu. For details on how to access the C1FlexGrid Column Editor, see Accessing the C1FlexGrid Column Editor (page 167). Select Column 4 in the right pane. In the left pane, set the AllowDragging property to False.

Alternatively, the AllowDragging property can also be set using the C1FlexGrid Column Editor:

Data Analysis Tutorial 157

Set the AllowDragging property to False for Column 5 and Column 6. Do not close the editor.

In Code Add the following code to the Form_Load event: Visual Basic ' Prevent the user from dragging last three columns. C1FlexGrid1.Cols(4).AllowDragging = False C1FlexGrid1.Cols(5).AllowDragging = False C1FlexGrid1.Cols(6).AllowDragging = False C# // Prevent the user from dragging c1FlexGrid1.Cols[4].AllowDragging c1FlexGrid1.Cols[5].AllowDragging c1FlexGrid1.Cols[6].AllowDragging Delphi // Prevent the user from dragging C1FlexGrid1.Cols[4].AllowDragging C1FlexGrid1.Cols[5].AllowDragging C1FlexGrid1.Cols[6].AllowDragging last three columns. = false; = false; = false; last three columns. := False; := False; := False;

4.

Set the Format property of the Sales Amount column so that the amounts are displayed as currency values. This can be done either in the designer or in code. In the Designer Select Column 6 in the grid. Click the ellipsis button in the Format String box to open the Format String dialog box.

158 C1FlexGrid Tutorials

Under Format type select Currency.

Click OK to close the Format String dialog box. In the C1FlexGrid Column Editor, select Column 6 in the right pane. In the left pane, click the ellipsis button next to the Format property to open the Format String dialog box. Under Format type select Currency. Click OK to close the Format String dialog box. Click OK to close the editor. Visual Basic ' Display currency values in the Sales Amount column. C1FlexGrid1.Cols(6).Format = "c" C# // Display currency values in the Sales Amount column. c1FlexGrid1.Cols(6).Format = "c"; Delphi // Display currency values in the Sales Amount column. C1FlexGrid1.Cols(6).Format := 'c';

Alternatively, the Format property can also be set using the C1FlexGrid Column Editor:

In Code

5.

The GetDataSource method creates the data table that is displayed by the grid. The routine is very basic, except for the SQL statement that retrieves the data. Most people don't write these SQL statements manually, but use visual designers such as the one in Visual Studio or Microsoft Access to do that.

Data Analysis Tutorial 159

Add the following code to the form. Note that you may have to change the connection string slightly, because it has a reference to the NorthWind database and that file might be in a different folder in your system: Visual Basic Private Function GetDataSource() As DataTable ' Set up the connection string. Dim conn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB;" ' Set up the SQL statement. Dim rs As String = _ "SELECT Employees.LastName,Orders.ShipCountry," & _ "Categories.CategoryName,Products.ProductName,Orders.OrderDate," & _ "[Quantity]*[Products].[UnitPrice] AS [Sale Amount] " & _ "FROM (Categories INNER JOIN Products " & _ "ON Categories.CategoryID = Products.CategoryID) " & _ "INNER JOIN ((Employees INNER JOIN Orders " & _ "ON Employees.EmployeeID = Orders.EmployeeID) " & _ "INNER JOIN [Order Details] " & _ "ON Orders.OrderID = [Order Details].OrderID) " & _ "ON Products.ProductID = [Order Details].ProductID " "ORDER BY Employees.LastName,Orders.ShipCountry," & _ "Categories.CategoryName;" ' Retrieve the data into the DataSet. Dim da As OleDbDataAdapter = New OleDbDataAdapter(rs, conn) Dim ds As DataSet = New DataSet() da.Fill(ds) ' Return the data table. GetDataSource = ds.Tables(0) End Function C# private DataTable GetDataSource() { // Set up the connection string. string conn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=C:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB;"; // Set up the SQL statement. string rs = "SELECT Employees.LastName,Orders.ShipCountry," + "Categories.CategoryName,Products.ProductName,Orders.OrderDate," + "[Quantity]*[Products].[UnitPrice] AS [Sale Amount] " + "FROM (Categories INNER JOIN Products " + "ON Categories.CategoryID = Products.CategoryID) " + "INNER JOIN ((Employees INNER JOIN Orders " + "ON Employees.EmployeeID = Orders.EmployeeID) " + "INNER JOIN [Order Details] " + "ON Orders.OrderID = [Order Details].OrderID) " +

160 C1FlexGrid Tutorials

"ON Products.ProductID = [Order Details].ProductID " + "ORDER BY Employees.LastName,Orders.ShipCountry," + "Categories.CategoryName;"; // Retrieve the data into the DataSet. OleDbDataAdapter OleDbDataAdapter da = new OleDbDataAdapter(rs, conn); DataSet DataSet ds = new DataSet(); da.Fill(ds); // Return the data table. GetDataSource = ds.Tables[0] } Delphi function Class1.GetDataSource: DataTable; var DataSet: DataSet; OleDbDataAdapter: OleDbDataAdapter; rs: string; conn: string; begin // Set up the connection string. conn := ('Provider=Microsoft.Jet.OLEDB.4.0;' + 'Data Source=C:\Program Files Microsoft Visual Studio B98 WIND.MDB;'); // Set up the SQL statement. rs := 'SELECT Employees.LastName,Orders.ShipCountry,' + 'Categories.CategoryName,Products.ProductName,Orders.OrderDate,' + '[Quantity]*[Products].[UnitPrice] AS [Sale Amount] ' + 'FROM (Categories INNER JOIN Products ' + 'ON Categories.CategoryID = Products.CategoryID) ' + 'INNER JOIN ((Employees INNER JOIN Orders ' + 'ON Employees.EmployeeID = Orders.EmployeeID) ' + 'INNER JOIN [Order Details] ' + 'ON Orders.OrderID = [Order Details].OrderID) ' + 'ON Products.ProductID = [Order Details].ProductID ' + 'ORDER BY Employees.LastName,Orders.ShipCountry,' + 'Categories.CategoryName;'; // Retrieve the data into the DataSet. da := OleDbDataAdapter.Create(rs, conn); ds := DataSet.Create; da.Fill(ds); // Return the data table. Self.GetDataSource := ds.Tables[0]; end; Run the program and observe the following: You will see a plain-looking grid that allows you to move columns around and browse through the data. However, the data is not structured in a clear way, and this table contains a couple of thousand records, so it is pretty difficult to get an overview of what the data means.

Data Analysis Tutorial 161

Step 3: Allow Automatic Sorting


The first step in organizing the data is sorting it. Furthermore, we would like the data to be sorted automatically whenever the user reorders the columns. After the user reorders the columns, the C1FlexGrid control fires the AfterDragColumn event. We will add an event handler to sort the data in the underlying data table. (If the grid were being used in unbound mode, we would accomplish this using the Sort method.) Add the following code to the form to sort the recordset and rebuild the subtotals when the user drags columns: Visual Basic Private Sub C1FlexGrid1_AfterDragColumn(ByVal sender As Object, ByVal e As DragRowColEventArgs) Handles C1FlexGrid1.AfterDragColumn ' Sort the recordset when the user drags columns. ' This will cause a data refresh, removing all subtotals and ' firing the AfterDataRefresh event, which rebuilds the subtotals. Dim sort As String = C1FlexGrid1.Cols(1).Name & ", " & _ C1FlexGrid1.Cols(2).Name & ", " & _ C1FlexGrid1.Cols(3).Name Dim dt As DataTable = C1FlexGrid1.DataSource dt.DefaultView.Sort = sort End Sub C# private void c1FlexGrid1_AfterDragColumn( object sender, DragRowColEventArgs e) { // Sort the recordset when the user drags columns. // This will cause a data refresh, removing all subtotals and // firing the AfterDataRefresh event, which rebuilds the subtotals. string sort = c1FlexGrid1.Cols[1].Name + ", " + c1FlexGrid1.Cols[2].Name + ", " + c1FlexGrid1.Cols(3).Name;

162 C1FlexGrid Tutorials

DataTable dt = c1FlexGrid1.DataSource; dt.DefaultView.Sort = sort; } Delphi procedure C1FlexGrid1_AfterDragColumn(sender: Object; e: DragRowColEventArgs); var sort: string; dt: DataTable; begin // Sort the recordset when the user drags columns. // This will cause a data refresh, removing all subtotals and // firing the AfterDataRefresh event, which rebuilds the subtotals. sort := C1FlexGrid1.Cols[1].Name + ', ' + C1FlexGrid1.Cols[2].Name + ', ' + C1FlexGrid1.Cols[3].Name; dt := C1FlexGrid1.DataSource; dt.DefaultView.Sort := sort; end; Run the program and observe the following: Run the project and try reordering the first three columns by dragging their headings around. Whenever you move a column, the data is automatically sorted, which makes it easier to interpret.

In the next step, we will add subtotals and an outline tree.

Step 4: Include Subtotals and Outline Tree


When the grid is used in bound mode, any changes to the data source cause the grid to fire the AfterDataRefresh event. This event is the ideal place to put the code that inserts the subtotals and builds the outline tree for the grid.

Data Analysis Tutorial 163

Add the following AfterDataRefresh event handler to the form: Visual Basic Private Sub C1FlexGrid1_AfterDataRefresh(ByVal sender As Object, ByVal e As ListChangedEventArgs) Handles C1FlexGrid1.AfterDataRefresh ' Total the Sale Amount. Dim totalOn As Integer = C1FlexGrid1.Cols("Sale Amount").SafeIndex Dim caption As String = "Total for {0}" ' Calculate three levels of totals. C1FlexGrid1.Subtotal(AggregateEnum.Sum, 0, 1, totalOn, caption) C1FlexGrid1.Subtotal(AggregateEnum.Sum, 1, 2, totalOn, caption) C1FlexGrid1.Subtotal(AggregateEnum.Sum, 2, 3, totalOn, caption) ' Collapse the outline to level 2. C1FlexGrid1.Tree.Show(2) ' Autosize the grid to accommodate the tree. C1FlexGrid1.AutoSizeCols(1, 1, 1000, 3, 30, AutoSizeFlags.IgnoreHidden) End Sub C# private void c1FlexGrid1_AfterDataRefresh( object sender, ListChangedEventArgs e) { // Total the Sale Amount. int totalOn = c1FlexGrid1.Cols["Sale Amount"].SafeIndex; string caption = "Total for {0}"; // Calculate three levels of totals. c1FlexGrid1.Subtotal(AggregateEnum.Sum, 0, 1, totalOn, caption); c1FlexGrid1.Subtotal(AggregateEnum.Sum, 1, 2, totalOn, caption); c1FlexGrid1.Subtotal(AggregateEnum.Sum, 2, 3, totalOn, caption); // Collapse the outline to level 2. c1FlexGrid1.Tree.Show(2); // Autosize the grid to accommodate the tree. c1FlexGrid1.AutoSizeCols(1, 1, 1000, 3, 30, AutoSizeFlags.IgnoreHidden); } Delphi procedure C1FlexGrid1_AfterDataRefresh(sender: System.Object; e: ListChangedEventArgs); var totalOn: Integer; caption: string; begin // Total the Sale Amount. totalOn := C1FlexGrid1.Cols['Sale Amount'].SafeIndex; caption := 'Total for {0}'; // Calculate three levels of totals. C1FlexGrid1.Subtotal(AggregateEnum.Sum, 0, 1, totalOn, caption); C1FlexGrid1.Subtotal(AggregateEnum.Sum, 1, 2, totalOn, caption);

164 C1FlexGrid Tutorials

C1FlexGrid1.Subtotal(AggregateEnum.Sum, 2, 3, totalOn, caption); // Collapse the outline to level 2. C1FlexGrid1.Tree.Show(2); // Autosize the grid to accommodate the tree. C1FlexGrid1.AutoSizeCols(1, 1, 1000, 3, 30, AutoSizeFlags.IgnoreHidden); end; Run the program and observe the following: The code starts by getting the index of the Sale Amount column. In this tutorial, the index will always be the same (Column 6). Looking up the index is usually better than hardwiring it, though, because if someone added a couple of fields to the SQL statement the index would change. The code then calls the Subtotal method to group the data and insert new rows with the subtotals. The new rows are automatically configured as outline nodes (their IsNode property is set to True), so the subtotals are collapsible.

Try dragging columns around. You can easily see the totals by country, product category, or salesperson. You can also expand tree benches to drill down into the data if you want to see more detail.

Data Analysis Tutorial 165

Note also that the grid is editable, changing some values in the Sale Amount column will cause the AfterDataRefresh event to fire again, and the totals will be automatically updated. This concludes this tutorial.

Accessing the C1FlexGrid Editors 167

C1FlexGrid Task-Based Help


The task-based help assumes that you are familiar with programming in Visual Studio .NET, and know how to use bound and unbound controls in general. If you are a novice to the ComponentOne FlexGrid for .NET product, please see the C1FlexGrid Tutorials (page 115) first. Each topic provides a solution for specific tasks using the ComponentOne FlexGrid for .NET product. By following the steps outlined in the help, you will be able to create projects demonstrating a variety of C1FlexGrid features. Each task-based help topic also assumes that you have created a new .NET project. For additional information on this topic, see Creating a .NET 2.0 Project (page 28).

Accessing the C1FlexGrid Editors


The C1FlexGrid editors can be accessed through the C1FlexGrid Tasks menu, the context menu, or the Properties window. There are two C1FlexGrid editors, the C1FlexGrid Column Editor and the C1FlexGrid Style Editor, which allow you to control the layout and appearance of C1FlexGrid at design time. To reorder columns, adjust column widths, set column properties, and insert or remove columns, use the C1FlexGrid Column Editor. To modify existing styles and add custom styles, which may later be assigned to cells, rows, and columns, use the C1FlexGrid Style Editor.

Accessing the C1FlexGrid Column Editor


To access the C1FlexGrid Column Editor, use the C1FlexGrid Tasks menu, the context menu, or the Properties window. For more information on editing columns with the C1FlexGrid Column Editor, see C1FlexGrid Column Editor (page 40). C1FlexGrid Tasks Menu Click the smart tag ( select Designer. )in the upper right corner of C1FlexGrid to open the C1FlexGrid Tasks menu, and

168 C1FlexGrid Task-Based Help

Context Menu Right-click on the form and select Designer from the context menu.

Properties Window In the Properties window, click the ellipsis button next to the Cols property.

Accessing the C1FlexGrid Style Editor


To access the C1FlexGrid Style Editor, use the C1FlexGrid Tasks menu, the context menu, or the Properties window. For more information on customizing cell appearance with the C1FlexGrid Style Editor, see C1FlexGrid Style Editor (page 42). C1FlexGrid Tasks Menu Click the smart tag ( select Styles. ) in the upper right corner of C1FlexGrid to open the C1FlexGrid Tasks menu, and

Accessing the C1FlexGrid Editors 169

Context Menu Right-click on the form and select Styles from the context menu.

Properties Window In the Properties window, click the ellipsis button next to the Styles property.

170 C1FlexGrid Task-Based Help

Adding Pictures and Text to a Cell


To add pictures and text to a cell, use the SetData and SetCellImage methods. Add the following code to the Form_Load event: 1. Resize the cells to fit the image using the Height and Width properties. Visual Basic Me.C1FlexGrid1.Rows(1).Height = 90 Me.C1FlexGrid1.Cols(1).Width = 150 C# this.c1FlexGrid1.Rows[1].Height = 90; this.c1FlexGrid1.Cols[1].Width = 150; Delphi Self.C1FlexGrid1.Rows[1].Height := 90; Self.C1FlexGrid1.Rows[1].Width := 150; Visual Basic Me.C1FlexGrid1.SetCellImage(1,1, Image.FromFile("c:\\c1logo.bmp")) C# this.c1FlexGrid1.SetCellImage(1,1, Image.FromFile("c:\\c1logo.bmp")); Delphi Self.C1FlexGrid1.SetCellImage(1,1, Image.FromFile('c:\\c1logo.bmp')); Visual Basic Me.C1FlexGrid1.SetData(1,1, "ComponentOne") C# this.c1FlexGrid1.SetData(1,1, "ComponentOne"); Delphi Self.C1FlexGrid1.SetData(1,1, 'ComponentOne');

2.

Add the SetCellImage method to add the image.

3.

Add the SetData method to add the text:

4.

Set the alignment of the image to CenterTop and the text to CenterBottom: Visual Basic Me.C1FlexGrid1.Styles.Normal.ImageAlign = C1.Win.C1FlexGrid.ImageAlignEnum.CenterTop Me.C1FlexGrid1.Styles.Normal.TextAlign = C1.Win.C1FlexGrid.TextAlignEnum.CenterBottom C# this.c1FlexGrid1.Styles.Normal.ImageAlign = C1.Win.C1FlexGrid.ImageAlignEnum.CenterTop; this.c1FlexGrid1.Styles.Normal.TextAlign = C1.Win.C1FlexGrid.TextAlignEnum.CenterBottom; Delphi Self.C1FlexGrid1.Styles.Normal.ImageAlign := C1.Win.C1FlexGrid.ImageAlignEnum.CenterTop; Self.C1FlexGrid1.Styles.Normal.TextAlign := C1.Win.C1FlexGrid.TextAlignEnum.CenterBottom;

Adding Row Numbers in a Fixed Column 171

This topic illustrates the following: Your grid will look like the following with an image and text in the same cell.

Note: To set the text on top of the picture, change the alignment of the text to CenterTop, and the alignment of the image to CenterBottom.

Adding Row Numbers in a Fixed Column


To add row numbers in a fixed column, like in Microsoft Excel, use the OwnerDrawCell event to draw the numbers, aligned left, in a fixed column. 1. Add the following code to the Form_Load event to fire the OwnerDrawCell event: 2. Visual Basic Me.C1FlexGrid1.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw C# this.c1FlexGrid1.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw; Delphi Self.C1FlexGrid1.DrawMode := C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw;

Add the OwnerDrawCell event: Visual Basic Private Sub C1FlexGrid1_OwnerDrawCell(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.OwnerDrawCellEventArgs) Handles C1FlexGrid1.OwnerDrawCell If e.Row >= Me.C1FlexGrid1.Rows.Fixed And e.Col = Me.C1FlexGrid1.Cols.Fixed - 1 Then Dim rowNumber As Integer = e.Row - Me.C1FlexGrid1.Rows.Fixed + 1 e.Text = rowNumber.ToString() End If End Sub C# private void c1FlexGrid1_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e) { if(e.Row >= this.c1FlexGrid1.Rows.Fixed && e.Col == this.c1FlexGrid1.Cols.Fixed - 1) {

172 C1FlexGrid Task-Based Help

int rowNumber = e.Row - this.c1FlexGrid1.Rows.Fixed + 1; e.Text = rowNumber.ToString(); } } Delphi procedure C1FlexGrid1_OwnerDrawCell(sender: object; e: C1.Win.C1FlexGrid.OwnerDrawCellEventArgs); begin if ((e.Row >= Self.c1FlexGrid1.Rows.Fixed) and (e.Col = (Self.c1FlexGrid1.Cols.Fixed - 1))) then begin rowNumber := ((e.Row - Self.c1FlexGrid1.Rows.Fixed) + 1); e.Text := rowNumber.ToString; end; end;

This topic illustrates the following: Row numbers appear in the first column, which is fixed, and are left-aligned like in Microsoft Excel.

Adding Three-Dimensional Text to a Header Row


To add three-dimensional text to the table's header row, set the TextEffect property to Raised for text with a shadow offset by one pixel to the right and below the text or Inset for text with a shadow offset by one pixel to the left and above the text. Setting the TextEffect property to Flat gives text no effect. 1. Create a new style called 3DText. In the Designer Open the C1FlexGrid Style Editor. For details on how to access the C1FlexGrid Style Editor, see Accessing the C1FlexGrid Style Editor (page 168). Click Add to create a new style.

Adding Three-Dimensional Text to a Header Row 173

Double-click CustomStyle1, rename it 3DText, and press ENTER when finished. In the Designer

Do not exit the C1FlexGrid Style Editor.

In Code Add the following code to the Form_Load event: Visual Basic Dim tdt As C1.Win.C1FlexGrid.CellStyle tdt = Me.C1FlexGrid1.Styles.Add("3DText") C# C1.Win.C1FlexGrid.CellStyle tdt; tdt = this.c1FlexGrid1.Styles.Add("3Dtext"); Delphi var tdt: C1.Win.C1FlexGrid.CellStyle; begin tdt := Self.C1FlexGrid1.Styles.Add('3Dtext'); end;

174 C1FlexGrid Task-Based Help

2.

Set the TextEffect property to Raised. In the Designer Locate the TextEffect property in the right pane and set it to Raised.

In Code Add the following code to the Form_Load event: 3. Visual Basic tdt.TextEffect = C1.Win.C1FlexGrid.TextEffectEnum.Raised C# tdt.TextEffect = C1.Win.C1FlexGrid.TextEffectEnum.Raised; Delphi tdt.TextEffect := C1.Win.C1FlexGrid.TextEffectEnum.Raised;

Apply the style to the header row by adding the following code to the Form_Load event: Visual Basic Me.C1FlexGrid1.Rows(0).Style = Me.C1FlexGrid.Styles("3DText") C# this.c1FlexGrid1.Rows[0].Style = this.c1FlexGrid1.Styles["3DText"]; Delphi Self.C1FlexGrid1.Rows[0].Style := Self.C1FlexGrid1.Styles['3DText'];

This topic illustrates the following: The table should have a header with raised text similar to the following image.

Adding Three-Dimensional Text to a Header Row 175

Adding Three-Dimensional Text to a Header Row Using Built-In Styles


The TextEffect property can be used to add a three-dimensional text effect to C1FlexGrid's built-in styles. To add a header with three-dimensional text using styles, set the TextEffect property within a style to Raised for text with a shadow offset by one pixel to the right and below the text or Inset for text with a shadow offset by one pixel to the left and above the text. Setting the TextEffect property to Flat gives text no effect. This property can be set either in the designer or in code. In the Designer 1. 2. Open the C1FlexGrid Style Editor. For details on how to access the C1FlexGrid Style Editor, see Accessing the C1FlexGrid Style Editor (page 168). Select Fixed under Built-In Styles. In the right column, locate the TextEffect property and set it to Raised. Click OK to close the editor.

In Code Add the following code to the Form_Load event to set the TextEffect property in the Fixed style: Visual Basic Me.C1FlexGrid1.Styles("Fixed").TextEffect = C1.Win.C1FlexGrid.TextEffectEnum.Raised C# this.c1FlexGrid1.Styles["Fixed"].TextEffect = C1.Win.C1FlexGrid.TextEffectEnum.Raised;

176 C1FlexGrid Task-Based Help

Delphi Self.C1FlexGrid1.Styles['Fixed'].TextEffect := C1.Win.C1FlexGrid.TextEffectEnum.Raised;

This topic illustrates the following: By setting the TextEffect property in the Fixed style, only fixed cells in the table will have a raised threedimensional effect. The TextEffect property can also be set in the all of the built-in styles. See CellStyleEnum Enumeration (page 579) for a list and descriptions of the built-in styles.

Adding ToolTips That Display UserData


To add ToolTips that display UserData, use C1FlexGrid's MouseMove event to get the UserData property and display it in a ToolTip control. ToolTips can be set to a column, a row, or a single cell.

UserData ToolTips for a Column


To add ToolTips that display UserData for a column, use C1FlexGrid's MouseMove event to get the UserData property and display it in a ToolTip control. 1. Locate the ToolTip control in the Toolbox and add it to the form.

2.

In the Form_Load event, set the UserData property for the AtomicMass column: Visual Basic Me.C1FlexGrid1.Cols("AtomicMass").UserData = "in atomic mass units (u)" C# this.c1FlexGrid1.Cols["AtomicMass"].UserData = "in atomic mass units (u)"; Delphi Self.C1FlexGrid1.Cols['AtomicMass'].UserData := 'in atomic mass units (u)';

Adding ToolTips That Display UserData 177

3.

Add the following MouseMove event: Visual Basic Private Sub C1FlexGrid1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles C1FlexGrid1.MouseMove Dim tip As String tip = C1FlexGrid1.Cols(C1FlexGrid1.MouseCol).UserData ToolTip1.SetToolTip(C1FlexGrid1, tip) End Sub C# private void c1FlexGrid1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { string tip; tip = c1FlexGrid1.Cols(c1FlexGrid1.MouseCol).UserData; toolTip1.SetToolTip(c1FlexGrid1, tip); } Delphi procedure C1FlexGrid1_MouseMove(sender: object; e: System.Windows.Forms.MouseEventArgs); var tip: string; begin tip := c1FlexGrid1.Cols(C1FlexGrid1.MouseCol).UserData; toolTip1.SetToolTip(C1FlexGrid1, tip); end;

This topic illustrates the following: The ToolTip appears within the entire AtomicMass column.

178 C1FlexGrid Task-Based Help

UserData ToolTips for a Row


To add ToolTips that display UserData for a row, use C1FlexGrid's MouseMove event to get the UserData property and display it in a ToolTip control. 1. Locate the ToolTip control in the Toolbox and add it to the form.

2.

In the Form_Load event, set the UserData property for the row that contains Oxygen: Visual Basic Me.C1FlexGrid1.Rows(8).UserData = "Oxygen makes up approximately 1/5 of the earth's atmosphere." C# this.c1FlexGrid1.Rows[8].UserData = "Oxygen makes up approximately 1/5 of the earth's atmosphere."; Delphi Self.C1FlexGrid1.Rows[8].UserData := 'Oxygen makes up approximately 1/5 of the earth''s atmosphere.';

3.

Add the following MouseMove event: Visual Basic Private Sub C1FlexGrid1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles C1FlexGrid1.MouseMove Dim tip As String tip = C1FlexGrid1.Rows(C1FlexGrid1.MouseRow).UserData ToolTip1.SetToolTip(C1FlexGrid1, tip) End Sub C# private void c1FlexGrid1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { string tip; tip = c1FlexGrid1.Rows[c1FlexGrid1.MouseRow].UserData; toolTip1.SetToolTip(c1FlexGrid1, tip); } Delphi procedure C1FlexGrid1_MouseMove(sender: object; e: System.Windows.Forms.MouseEventArgs); var tip: string; begin tip := C1FlexGrid1.Rows[C1FlexGrid1.MouseRow].UserData; toolTip1.SetToolTip(C1FlexGrid1, tip); end;

Adding ToolTips That Display UserData 179

This topic illustrates the following: The ToolTip appears across the entire row.

UserData ToolTips for a Single Cell


To add ToolTips that display UserData for a single cell, use C1FlexGrid's MouseMove event to get the UserData and display it in a ToolTip control. 1. Locate the ToolTip control in the Toolbox and add it to the form.

2.

Add the following SetUserData method to the Form_Load event: Visual Basic Me.C1FlexGrid1.SetUserData(1, "Element", "Hydrogen is a highly flammable gas.") C# this.c1FlexGrid1.SetUserData(1, "Element", "Hydrogen is a highly flammable gas."); Delphi Self.C1FlexGrid1.SetUserData(1, 'Element', 'Hydrogen is a highly flammable gas.');

3.

Add the following MouseMove event: Visual Basic Private Sub C1FlexGrid1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles C1FlexGrid1.MouseMove Dim tip As String tip = Me.C1FlexGrid1.GetUserData(C1FlexGrid1.MouseRow, C1FlexGrid1.MouseCol) ToolTip1.SetToolTip(C1FlexGrid1, tip) End Sub

180 C1FlexGrid Task-Based Help

C# private void c1FlexGrid1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { string tip; tip = this.c1FlexGrid1.GetUserData(c1FlexGrid1.MouseRow, c1FlexGrid1.MouseCol); toolTip1.SetToolTip(c1FlexGrid1, tip); } Delphi procedure C1FlexGrid1_MouseMove(sender: object; e: System.Windows.Forms.MouseEventArgs); var tip: string; begin tip := Self.C1FlexGrid1.GetUserData(c1FlexGrid1.MouseRow, c1FlexGrid1.MouseCol); toolTip1.SetToolTip(C1FlexGrid1, tip); end;

This topic illustrates the following: When the mouse moves over the first row in the Element column, the information about Hydrogen appears.

Applying a Gradient Background to a CellRange


To apply a gradient background to a CellRange, use the OwnerDrawCell event to create custom cell painting. 1. Create a LinearGradient brush and a CellRange by adding the following code to the form class level: Visual Basic Dim GradientStyleBrush As System.Drawing.Drawing2D.LinearGradientBrush Dim rng As C1.Win.C1FlexGrid.CellRange

Applying a Gradient Background to a CellRange 181

C# System.Drawing.Drawing2D.LinearGradientBrush GradientStyleBrush; C1.Win.C1FlexGrid.CellRange rng; Delphi var GradientStyleBrush: System.Drawing.Drwing2D.LinearGradientBrush; rng: C1.Win.C1FlexGrid.CellRange; begin

2.

Set C1FlexGrid's DrawMode property to OwnerDraw by adding the following code to the Form_Load event: Visual Basic Me.C1FlexGrid1.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw C# this.c1FlexGrid1.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw; Delphi Self.C1FlexGrid1.DrawMode := C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw;

3.

Set the CellRange using the GetCellRange method: Visual Basic rng = Me.C1FlexGrid1.GetCellRange(2, 2, 4, 4) C# rng = this.c1FlexGrid1.GetCellRange(2, 2, 4, 4); Delphi rng := Self.C1FlexGrid1.GetCellRange(2, 2, 4, 4); Visual Basic GradientStyleBrush = New System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, Color.Navy, Color.Transparent, 270) C# GradientStyleBrush = new System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, Color.Navy, Color.Transparent, 270); Delphi GradientStyleBrush := System.Drawing.Drawing2D.LinearGradientBrush.Create(ClientRectangle, Color.Navy, Color.Transparent, 270);

4.

Set the LinearGradient brush colors and angle of the gradient:

5.

Add the OwnerDrawCell event to draw the gradient in the CellRange: Visual Basic Private Sub C1FlexGrid1_OwnerDrawCell(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.OwnerDrawCellEventArgs) Handles C1FlexGrid1.OwnerDrawCell ' Draw cell background using gradient brush. If (e.Row >= rng.r1) And (e.Row <= rng.r2) Then If (e.Col >= rng.c1) And (e.Col <= rng.c2) Then ' Draw background. e.Graphics.FillRectangle(GradientStyleBrush, e.Bounds)

182 C1FlexGrid Task-Based Help

' Let the grid draw the content. e.DrawCell(C1.Win.C1FlexGrid.DrawCellFlags.Content) ' Finish drawing the cell. e.Handled = True End If End If End Sub C# private void c1FlexGrid1_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e) { // Draw cell background using gradient brush. if ((e.Row >= rng.r1) And (e.row <= rng.r2)) { if ((e.Col >= rng.c1) And (e.Col <= rng.c2)) { // Draw background. e.Graphics.FillRectangle(GradientStyleBrush, e.Bounds); // Let the grid draw the content. e.DrawCell(C1.Win.C1FlexGrid.DrawCellFlags.Content); // Finish drawing the cell. e.Handled = true; } } } Delphi procedure C1FlexGrid1_OwnerDrawCell(sender: object; e: C1.Win.C1FlexGrid.OwnerDrawCellEventArgs); begin // Draw cell background using gradient brush. if (System.Object(&And((e.row <= rng.r2)))) then if (System.Object(&And((e.Col <= rng.c2)))) then begin // Draw background. e.Graphics.FillRectangle(GradientStyleBrush, e.Bounds); // Let the grid draw the content. e.DrawCell(C1.Win.C1FlexGrid.DrawCellFlags.Content); // Finish drawing the cell. e.Handled := True; end; end; end;

Changing the Column Order in the Grid 183

This topic illustrates the following: The Transparent to Navy gradient background appears only in the CellRange.

Changing the Column Order in the Grid


To change the column order in the grid, drag the column to the new position in the grid or use the C1FlexGrid Column Editor, or set the MoveRange method in code. In the Designer 1. 2. In the grid, select the column you would like to move. In this example, the Element column will be moved. Click and drag the column to the left. A vertical dotted line appears where the column can be dropped.

3.

Drop the Element column before the AtomicNumber column.

184 C1FlexGrid Task-Based Help

Alternatively, columns can be reordered in the grid using the C1FlexGrid Column Editor: 1. 2. 3. 4. 5. Open the C1FlexGrid Column Editor. For details on how to access the C1FlexGrid Column Editor, see Accessing the C1FlexGrid Column Editor (page 167). In the designer, select the column you would like to move. In this example, the Element column will be moved. Click and drag the column to the left. A vertical dotted line appears where the column can be dropped. Drop the Element column before the AtomicNumber column. Click OK to close the editor.

In Code Add the following code to the Form_Load event to move Column 2 (the Element column in this example) to the Column 1 position: Visual Basic Me.C1FlexGrid1.Cols.MoveRange(2, 1, 1) C# this.c1FlexGrid1.Cols.MoveRange(2, 1, 1); Delphi Self.C1FlexGrid1.Cols.MoveRange(2, 1, 1);

This topic illustrates the following: The Element column now appears before the AtomicNumber column in the grid.

Clearing a Tree View 185

Clearing a Tree View


To clear a tree view in C1FlexGrid, set the editable row count to zero. For additional information on creating trees, see C1FlexGrid Tutorials (page 115) and Outlining and Summarizing (page 87).

Add the following code for the Button1_Click event. This code will set the editable row count equal to zero, and the tree will be cleared when the button is clicked. Visual Basic Me.C1FlexGrid1.Rows.Count = Me.C1FlexGrid1.Rows.Fixed C# this.c1FlexGrid1.Rows.Count = this.C1FlexGrid1.Rows.Fixed; Delphi Self.C1FlexGrid1.Rows.Count := Self.C1FlexGrid1.Rows.Fixed;

186 C1FlexGrid Task-Based Help

This topic illustrates the following: Once the button is clicked, the tree view disappears.

Clearing C1FlexGrid
To clear C1FlexGrid, use the Clear method. The Clear method clears either the content, styles, UserData, or all three. The following image shows the grid before any content, styles or UserData has been cleared.

Clearing C1FlexGrid 187

Clearing Content
To clear the contents of C1FlexGrid, add the following Clear method. In this example, the code was added to the Click event of the Clear Contents button. Visual Basic Me.C1FlexGrid1.Clear(C1.Win.C1FlexGrid.ClearFlags.Content) C# this.c1FlexGrid1.Clear(C1.Win.C1FlexGrid.ClearFlags.Content); Delphi Self.C1FlexGrid1.Clear(C1.Win.C1FlexGrid.ClearFlags.Content);

This topic illustrates the following: Clicking Clear Contents clears only the contents, not the styles or UserData of the grid.

Clearing Styles
To clear the style formatting of C1FlexGrid, add the following Clear method. In this example, the code was added to the Click event of the Clear Styles button. Visual Basic Me.C1FlexGrid1.Clear(C1.Win.C1FlexGrid.ClearFlags.Style) C# this.c1FlexGrid1.Clear(C1.Win.C1FlexGrid.ClearFlags.Style); Delphi Self.C1FlexGrid1.Clear(C1.Win.C1FlexGrid.ClearFlags.Style);

188 C1FlexGrid Task-Based Help

This topic illustrates the following: Clicking Clear Styles clears only the style formatting, not the contents or UserData of the grid.

Clearing UserData
To clear the UserData of C1FlexGrid, add the following Clear method. In this example, the code was added to the Click event of the Clear UserData button. Visual Basic Me.C1FlexGrid1.Clear(C1.Win.C1FlexGrid.ClearFlags.UserData) C# this.c1FlexGrid1.Clear(C1.Win.C1FlexGrid.ClearFlags.UserData); Delphi Self.C1FlexGrid1.Clear(C1.Win.C1FlexGrid.ClearFlags.UserData);

Note that there will be no visible change to the grid when clearing UserData, since UserData only stores data that is useful to the application.

Clearing Content, Styles, and UserData


To clear the contents, style formatting, and UserData of C1FlexGrid, add the following Clear method. In this example, the code was added to the Click event of the Clear All button. Visual Basic Me.C1FlexGrid1.Clear(C1.Win.C1FlexGrid.ClearFlags.All) C# this.c1FlexGrid1.Clear(C1.Win.C1FlexGrid.ClearFlags.All); Delphi Self.C1FlexGrid1.Clear(C1.Win.C1FlexGrid.ClearFlags.All);

Converting Column Letters to Uppercase 189

This topic illustrates the following: Clicking Clear All clears the contents, style formatting, and UserData of the grid, leaving a blank grid.

Converting Column Letters to Uppercase


To convert column letters from lowercase to uppercase, add the following SetupEditor event to your form: Visual Basic Private Sub C1FlexGrid1_SetupEditor(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.RowColEventArgs) Handles C1FlexGrid1.SetupEditor If Me.C1FlexGrid1.Cols(e.Col).Name = "UCASECOL" Then Dim tb As TextBox = Me.C1FlexGrid1.Editor tb.CharacterCasing = CharacterCasing.Upper End If End Sub C# private void c1FlexGrid1_SetupEditor(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (this.c1FlexGrid1.Cols[e.Col].Name == "UCASECOL") { TextBox tb = this.c1FlexGrid1.Editor as TextBox; tb.CharacterCasing = CharacterCasing.Upper; } } Delphi procedure C1FlexGrid1_SetupEditor(sender: System.Object; e: C1.Win.C1FlexGrid.RowColEventArgs) var tb: TextBox; begin if (Self.C1FlexGrid1.Cols[e.Col].Name = 'UCASECOL') begin

190 C1FlexGrid Task-Based Help

tb := Self.C1FlexGrid1.Editor as TextBox; tb.CharacterCasing := CharacterCasing.Upper; end; end;

Entering Only Numbers in a Cell


To allow entering only numbers in a cell, use the KeyPressEdit event and set the e.Handled parameter to True for the invalid keys. Use the following code to set the fourth column to accept only numbers, BACKSPACE, DELETE, and the PERIOD keys: Visual Basic Private Sub C1FlexGrid1_KeyPressEdit(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.KeyPressEditEventArgs) Handles C1FlexGrid1.KeyPressEdit If e.Col = 3 Then ' If not the characters 0-9, PERIOD, DELETE, or BACKSPACE. If Not (e.KeyChar = Chr(48) Or e.KeyChar = Chr(49) Or _ e.KeyChar = Chr(50) Or e.KeyChar = Chr(51) Or _ e.KeyChar = Chr(52) Or e.KeyChar = Chr(53) Or _ e.KeyChar = Chr(54) Or e.KeyChar = Chr(55) Or _ e.KeyChar = Chr(56) Or e.KeyChar = Chr(57) Or _ e.KeyChar = Chr(46) Or e.KeyChar = Chr(127) Or _ e.KeyChar = Chr(8)) Then ' Stop the character from being entered into the ' control since it is an invalid key. e.Handled = True End If End If End Sub C# private void c1FlexGrid1_KeyPressEdit(object sender, C1.Win.C1FlexGrid.KeyPressEditEventArgs e) { if( e.Col == 3 ) { // If not the characters 0-9, PERIOD, DELETE, or BACKSPACE. if( !((e.KeyChar == 48) || (e.KeyChar == 49) || (e.KeyChar == 50) || (e.KeyChar == 51) || (e.KeyChar == 52) || (e.KeyChar == 53) || (e.KeyChar == 54) || (e.KeyChar == 55) || (e.KeyChar == 56) || (e.KeyChar == 57) || (e.KeyChar == 46) || (e.KeyChar == 127) || (e.KeyChar == 8))) // Stop the character from being entered into the // control since it is an invalid key. e.Handled = true; } } Delphi procedure C1FlexGrid1_KeyPressEdit(sender: object; e: C1.Win.C1FlexGrid.KeyPressEditEventArgs); begin if (e.Col = 3) then begin

Formatting Cells 191

// if or or or or

If not the characters 0-9, PERIOD, DELETE, or BACKSPACE. ((e.KeyChar = 48) or (e.KeyChar = 49) or (e.KeyChar = 50) (e.KeyChar = 51) or (e.KeyChar = 52) or (e.KeyChar = 53) (e.KeyChar = 54) or (e.KeyChar = 55) or (e.KeyChar = 56) (e.KeyChar = 57 or (e.KeyChar = 46) or (e.KeyChar = 127) (e.KeyChar = 8) = False) then

// Stop the character from being entered into the control // since it is an invalid key. e.Handled := True; end; end;

Formatting Cells
Formatting cells allows you to control the accessibility and appearance of data in a single cell or multiple cells. The following topics show you how to set cells to be read-only, format a cell to display currency values, and format cells based on their contents.

Formatting a Cell as Read-Only


To make a single cell or multiple cells read-only, use the BeforeEdit event. Single Cell Read-Only You can make any cell in the grid read-only so that the data within it cannot be changed. For example, enter the following code to make the cell in column 1, row 1 read-only: Visual Basic Private Sub C1FlexGrid1_BeforeEdit(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.RowColEventArgs) Handles C1FlexGrid1.BeforeEdit If e.Row = 1 And e.Col = 1 Then e.Cancel = True End If End Sub C# private void c1FlexGrid1_BeforeEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { if (e.Row == 1 & e.Col == 1) { e.Cancel = true; } } Delphi procedure C1FlexGrid1_BeforeEdit(sender: System.Object; e: C1.Win.C1FlexGrid.RowColEventArgs); begin if (e.Row = 1) and (e.Col = 1) e.Cancel := True; end;

Multiple Cell Read-Only You may also want to set multiple cells in the grid to read-only at one time. Suppose you have an editable grid used to enter customers' information, such as customer IDs, addresses, and orders. While the orders and addresses may change, the customer IDs will not. The sample code below assumes you have nine rows in your

192 C1FlexGrid Task-Based Help

grid, and you would like to make all of the rows in the first column, the Customer ID column, read-only. Enter the following code: Visual Basic Private Sub C1FlexGrid1_BeforeEdit(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.RowColEventArgs) Handles C1FlexGrid1.BeforeEdit Dim i As Integer For i = 1 To 9 If e.Col = 1 And e.Row = i Then e.Cancel = True End If Next End Sub C# private void c1FlexGrid1_BeforeEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { for (int i = 1; i <= 9; i++) { if (e.Col == 1 & e.Row == i) { e.Cancel = true; } } } Delphi procedure C1FlexGrid1_BeforeEdit(sender: System.Object; e: C1.Win.C1FlexGrid.RowColEventArgs); var i: Integer; begin for I := 1 to 9 do if (e.Col = 1) and (e.Row = i) e.Cancel := True; end;

This topic illustrates the following: Notice that none of the cells in the Customer ID column are editable.

Formatting Cells 193

Formatting a Cell with Decimal Content


To format a cell that contains decimal numbers, set the Format property either in the designer or in code. In this example, numbers already entered in the first column will be formatted to a decimal amount. In the Designer 1. 2. 3. Select Column 1 in the grid. This will open the Column Tasks menu for Column 1. Click the ellipsis button in the Format String box to open the Format String dialog box. Under Format type select Custom and set the Custom format to $#,##0.00.

4. 1. 2.

Click OK to close the Format String dialog box. Open the C1FlexGrid Column Editor. For details on how to access the C1FlexGrid Column Editor, see Accessing the C1FlexGrid Column Editor (page 167). Select Column 1 from the right pane and set the Format property to $#,##0.00 in the left pane.

Alternatively, the Format property can also be set using the C1FlexGrid Column Editor:

194 C1FlexGrid Task-Based Help

3.

Click OK to close the editor.

In Code Add the following code to the Form_Load event: Visual Basic Me.C1FlexGrid1.Cols(1).Format = "$#,##0.00" C# this.c1FlexGrid1.Cols[1].Format = "$#,##0.00"; Delphi Self.C1FlexGrid1.Cols[1].Format := '$#,##0.00'; Note: The format specifier follows the standard .NET conventions. Use ',' for thousand separators and '.' for the decimal, regardless of locale.

Formatting Cells 195

This topic illustrates the following: In this example, the numbers in the first column are converted to a dollar amount.

Formatting Cells Based on the Contents


To conditionally format cells based on the contents, create a new style and use the CellChanged event. 1. Create a new CellStyle called LargeValue and set the BackColor property to Gold. In the Designer Open the C1FlexGrid Style Editor. For details on how to access the C1FlexGrid Style Editor, see Accessing the C1FlexGrid Style Editor (page 168). Click Add to create a new style. Double-click CustomStyle1, rename it LargeValue, and press ENTER when finished. Locate the BackColor property in the right pane and set it to Gold.

196 C1FlexGrid Task-Based Help

Locate the Font property and click the ellipsis button next to it to open the Font dialog box. Set the Font style box to Italic.

Formatting Cells 197

Click OK to close the Font dialog box. Click OK to close the C1FlexGrid Style Editor.

In Code Add the following code to the Form_Load event: Visual Basic ' Create a custom style for large values. Dim cs As C1.Win.C1FlexGrid.CellStyle cs = Me.C1FlexGrid1.Styles.Add("LargeValue") cs.Font = New Font(Font, FontStyle.Italic) cs.BackColor = Color.Gold C# // Create a custom style for large values. C1.Win.C1FlexGrid.CellStyle cs; cs = this.c1FlexGrid1.Styles.Add("LargeValue"); cs.Font = new Font(Font, FontStyle.Italic); cs.BackColor = Color.Gold; Delphi var cs: C1.Win.C1FlexGrid.CellStyle; begin // Create a custom style for large values. cs := Self.C1FlexGrid1.Styles.Add('LargeValue'); cs.Font := Font.Create(Font, FontStyle.Italic); cs.BackColor := Color.Gold; end;

198 C1FlexGrid Task-Based Help

2.

Use the CellChanged event to format the cells based on the contents: Visual Basic ' Format cells based on their content. Private Sub C1FlexGrid1_CellChanged(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.RowColEventArgs) Handles C1FlexGrid1.CellChanged ' Mark currency values > 50,000 as LargeValues. ' Reset others by setting their Style to Nothing. Dim cs As C1.Win.C1FlexGridCellStyle If Val(Me.C1FlexGrid1(e.Row, e.Col)) >= 50000 Then cs = Me.C1FlexGrid1.Styles("LargeValue") End If Me.C1FlexGrid1.SetCellStyle(e.Row, e.Col, cs) End Sub C# // Format cells based on their content. private void c1FlexGrid1_CellChanged(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { // Mark currency values > 50,000 as LargeValues. // Reset others by setting their Style to Nothing. C1.Win.C1FlexGrid.CellStyle cs; if (Val(this.c1FlexGrid1(e.Row, e.Col)) >= 50000) { cs = this.c1FlexGrid1.Styles("LargeValue"); } this.c1FlexGrid1.SetCellStyle(e.Row, e.Col, cs); } Delphi // Format cells based on their content. procedure C1FlexGrid1_CellChanged(sender: System.Object; e: C1.Win.C1FlexGrid.RowColEventArgs); var cs: C1.Win.C1FlexGrid.CellStyle; begin // Mark currency values > 50,000 as LargeValues. // Reset others by setting their Style to Nothing. if (double.Parse(Self.C1FlexGrid1[e.Row, e.Col]) >= 50000) begin cs := C1FlexGrid1.Styles[LargeValue]; end; Self.C1FlexGrid1.SetCellStyle(e.Row, e.Col, cs); end;

Formatting the Border Style 199

This topic illustrates the following: In this example, cells containing values greater than or equal to 50,000 are highlighted in gold.

Formatting the Border Style


Formatting the border style allows you to customize the appearance of the grid. The border style can be set for both the control and the grid.

Formatting the Border Style of the Control


To format the border style of the control, set the BorderStyle property to Fixed3D, FixedSingle, Light3D, None, or XpThemes. This property can be set either in the designer or in code. The following table describes each of the border styles. Border Fixed3D FixedSingle Light3D None XpThemes In the Designer Locate the BorderStyle property in the Properties window and set it to Fixed3D, FixedSingle, Light3D, None, or XpThemes. In this example, the BorderStyle property is set to Fixed3D. Description A three-dimensional border. This is the default setting. A single line border. A light sunken border. No border. A border drawn using XP themes.

200 C1FlexGrid Task-Based Help

In Code Add code to the Form_Load event to set the BorderStyle property to Fixed3D, FixedSingle, Light3D, None, or XpThemes. The following code sets the BorderStyle property to Fixed3D: Visual Basic Me.C1FlexGrid1.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Fixed3D C# this.c1FlexGrid1.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Fixed3D; Delphi Self.C1FlexGrid1.BorderStyle := C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Fixed3D;

Three-Dimensional Border The border will be three-dimensional.

Formatting the Border Style 201

Single Line Border The border will be a single line.

Light Sunken Border The border will be light and three-dimensional.

202 C1FlexGrid Task-Based Help

No Border There is no border.

XP Theme Border The border will be XP themed.

Formatting the Border Style 203

Formatting the Border Style of the Grid


To format the border style of the grid, set the Style property to Dotted, Double, Fillet, Flat, Groove, Inset, None, or Raised. This property can be set using C1FlexGrid's built-in styles either in the designer or in code. The following table describes each of the border styles. Border Dotted Double Fillet Flat Groove Inset None Raised In the Designer 1. 2. Open the C1FlexGrid Style Editor. For details on how to access the C1FlexGrid Style Editor, see Accessing the C1FlexGrid Style Editor (page 168). Select Normal under Built-In Styles. In the right column, locate the Border property and expand it. Set the Style property to Dotted, Double, Fillet, Flat, Groove, Inset, None, or Raised. In this example, the Style property is set to Dotted. Description Dotted border. Double border. Fillet border. Solid flat border. Groove border. Inset border. No border. This is the default setting. Raised border.

204 C1FlexGrid Task-Based Help

3.

Click OK to close the editor.

In Code Add code to the Form_Load event to set the Style property in the Normal style one of the following options: Dotted, Double, Fillet, Flat, Groove, Inset, None, or Raised. The following code sets the Style property to Dotted. Visual Basic Me.C1FlexGrid1.Styles("Normal").Border.Style = C1.Win.C1FlexGrid.BorderStyleEnum.Dotted C# this.c1FlexGrid1.Styles["Normal"].Border.Style = C1.Win.C1FlexGrid.BorderStyleEnum.Dotted; Delphi Self.C1FlexGrid1.Styles['Normal'].Border.Style := C1.Win.C1FlexGrid.BorderStyleEnum.Dotted;

Dotted Border The cell border will be a dotted line.

Formatting the Border Style 205

Double Border The cell border will be double lines.

Fillet Border The cell border will be fillet.

206 C1FlexGrid Task-Based Help

Flat Border The cell border will be a solid flat line.

Groove Border The cell border will be grooved.

Formatting the Border Style 207

Inset Border The cell border will be inset.

No Border There is no cell border.

208 C1FlexGrid Task-Based Help

Raised Border The cell border will be raised.

Freezing Rows and Columns


To allow the user to freeze rows and columns with the mouse, set the AllowFreezing property to Columns to freeze only columns, Rows to freeze only rows, or Both to freeze both columns and rows. Conversely, to disable freezing, set the AllowFreezing property to None, which is the default setting. This property can be set either in the designer or in code. In the Designer Locate the AllowFreezing property in the Properties window and set it to Both.

In Code Add the following code to the Form_Load event to set the AllowFreezing property to Both: Visual Basic Me.C1FlexGrid1.AllowFreezing = C1.Win.C1FlexGrid.AllowFreezingEnum.Both C# this.c1FlexGrid1.AllowFreezing = C1.Win.C1FlexGrid.AllowFreezingEnum.Both; Delphi Self.C1FlexGrid1.AllowFreezing := C1.Win.C1FlexGrid.AllowFreezingEnum.Both;

Freezing Rows and Columns 209

This topic illustrates the following: When the mouse pointer becomes the lock rows or the lock columns icon, click and drag the mouse over the rows or columns to freeze. In this example, the Element column is frozen and will remain on the grid when it is scrolled to the right.

In this example, the row containing Hydrogen is frozen and will remain on the grid when it is scrolled to the bottom.

Note: Setting the AllowFreezing property to Both allows both rows and columns to be frozen at the same time, as seen in the following image.

210 C1FlexGrid Task-Based Help

Populating an Unbound Grid with Data


To populate an unbound grid with data, use the grid's indexer to populate a column, row, or a single cell. To populate a cell range, use the Data property.

Populating a Column with Data


To populate a column with data when the form loads, set a loop with the grid's indexer to the data to fill the column. Add the following code to the Form_Load event to set column one to zero: Visual Basic Dim r As Integer For r = C1FlexGrid1.Rows.Fixed To C1FlexGrid1.Rows.Count - 1 Me.C1FlexGrid1(r, 1) = 0 Next C# int r; for (r = c1FlexGrid1.Rows.Fixed; r <= c1FlexGrid1.Rows.Count -1;r++) { this.c1FlexGrid1[r, 1] = 0; } Delphi var r: Integer; begin while (r <= (c1FlexGrid1.Rows.Count - 1)) do begin Self.C1FlexGrid1[r, 1] := 0; end; end;

Populating an Unbound Grid with Data 211

This topic illustrates the following: Column one fills with zeros.

Populating a Range of Cells with Data


To populate a range of cells with data when the form loads, set the Data property of the CellRange. Add the following code to the Form_Load event to set the Data property to zero: Visual Basic Dim rng As C1.Win.C1FlexGrid.CellRange = Me.C1FlexGrid1.GetCellRange(1, 1, 3, 3) rng.Data = 0 C# C1.Win.C1FlexGrid.CellRange rng = this.c1FlexGrid1.GetCellRange(1,1,3,3); rng.Data = 0; Delphi var rng: C1.Win.C1FlexGrid.CellRange; begin rng := Self.c1FlexGrid1.GetCellRange(1, 1, 3, 3); rng.Data := 0; end;

212 C1FlexGrid Task-Based Help

This topic illustrates the following: The cell range fills with zeros.

Populating a Row with Data


To populate a row with data when the form loads, set a loop with the grid's indexer to the data to fill the row. Add the following code to the Form_Load event to set column one to zero: Visual Basic Dim r As Integer For r = C1FlexGrid1.Cols.Fixed To C1FlexGrid1.Cols.Count - 1 Me.C1FlexGrid1(1, r) = 0 Next C# int r; for (r = c1FlexGrid1.Cols.Fixed; r <= c1FlexGrid1.Cols.Count -1;r++) { this.c1FlexGrid1[1, r] = 0; } Delphi var r: Integer; begin while (r <= (c1FlexGrid1.Rows.Count - 1)) do begin Self.C1FlexGrid1[1, r] := 0; end; end;

Populating an Unbound Grid with Data 213

This topic illustrates the following: Row one fills with zeros.

Populating a Single Cell with Data


To populate a single cell with data when the form loads, set the grid's indexer to the data. Add the following code to the Form_Load event to set the cell text: Visual Basic Me.C1FlexGrid1(3, 2) = "Cell Text" C# this.c1FlexGrid1[3, 2] = "Cell Text"; Delphi Self.C1FlexGrid[3, 2] := 'Cell Text';

214 C1FlexGrid Task-Based Help

This topic illustrates the following: The text Cell Text is in the fourth row, third column.

Restricting Grid Editing


To disable editing of the entire grid, specific column or specific row, set the AllowEditing property to False. Conversely, to allow editing, set the AllowEditing property to True, which is the default value.

Disable Editing for the Entire Grid


To disable editing for the entire grid, setting the AllowEditing property to False either in the designer or in code. In the Designer In the C1FlexGrid Tasks menu, uncheck the Enable Editing check box.

Alternatively, locate the AllowEditing property in the Properties window and set it to False.

In Code Add the following code to the Form_Load event: Visual Basic Me.C1FlexGrid1.AllowEditing = False

Restricting Grid Editing 215

C# this.c1FlexGrid1.AllowEditing = false; Delphi Self.C1FlexGrid1.AllowEditing := False;

Disable Editing for a Specific Column


To disable editing for a specific column, set the AllowEditing property to False either in the designer or in code. In the Designer 1. 2. Select the column in the grid that you would like to edit. This will open the Column Tasks menu for that column. Uncheck the Allow Editing check box.

Alternatively, the AllowEditing property can be set using the C1FlexGrid Column Editor: 1. 2. Open the C1FlexGrid Column Editor. For details on how to access the C1FlexGrid Column Editor, see Accessing the C1FlexGrid Column Editor (page 167). Select the column that you would like to edit from the right pane and set the AllowEditing property to True in the left pane.

216 C1FlexGrid Task-Based Help

3.

Click OK to close the editor.

In Code Add the following code to the Form_Load event to restrict editing the AtomicMass column: Visual Basic Me.C1FlexGrid1.Cols("AtomicMass").AllowEditing = False ' Is the same as: Me.C1FlexGrid1.Cols(4).AllowEditing = False C# this.c1FlexGrid1.Cols["AtomicMass"].AllowEditing = false; // Is the same as: this.c1FlexGrid1.Cols[4].AllowEditing = false; Delphi Self.C1FlexGrid1.Cols['AtomicMass'].AllowEditing := False; // Is the same as: Self.C1FlexGrid1.Cols[4].AllowEditing := False;

Disable Editing for a Specific Row


To disable editing for a specific row, add the following code to the Form_Load event to set the AllowEditing property to False. In this example, the code will restrict editing in the 6th row: Visual Basic Me.C1FlexGrid1.Rows(5).AllowEditing = False C# this.c1FlexGrid1.Rows[5].AllowEditing = false; Delphi Self.C1FlexGrid1.Rows[5].AllowEditing := False;

Scaling an Image 217

Scaling an Image
To scale an image in a single column when the rows of the grid are resized, set the ImageAlign property to Scale. 1. Set the row height of the first two rows by adding the following code to the Form_Load event: Visual Basic Me.C1FlexGrid1.Rows(1).Height = 2 * Me.C1FlexGrid1.Rows.DefaultSize Me.C1FlexGrid1.Rows(2).Height = 2 * Me.C1FlexGrid1.Rows.DefaultSize C# this.c1FlexGrid1.Rows[1].Height = 2 * this.c1FlexGrid1.Rows.DefaultSize; this.c1FlexGrid1.Rows[2].Height = 2 * this.c1FlexGrid1.Rows.DefaultSize; Delphi Self.C1FlexGrid1.Rows[1].Height := 2 * Self.C1FlexGrid1.Rows.DefaultSize; Self.C1FlexGrid1.Rows[2].Height := 2 * Self.C1FlexGrid1.Rows.DefaultSize;

2.

Scale the images in the column. In the Designer Open the C1FlexGrid Column Editor. For details on how to access the C1FlexGrid Column Editor, see Accessing the C1FlexGrid Column Editor (page 167). Select the column that contains the images from the right pane and set the ImageAlign property to Scale in the left pane.

218 C1FlexGrid Task-Based Help

Click OK to close the editor.

In Code Add the following code after the code in step 1: Visual Basic Me.C1FlexGrid1.Cols(3).ImageAlign = C1.Win.C1FlexGrid.ImageAlignEnum.Scale C# this.c1FlexGrid1.Cols[3].ImageAlign = C1.Win.C1FlexGrid.ImageAlignEnum.Scale; Delphi Self.C1FlexGrid1.Cols[3].ImageAlign := C1.Win.C1FlexGrid.ImageAlignEnum.Scale;

This topic illustrates the following: By using the ImageAlign property, the image will be scaled to fit the maximum area within the cell while preserving the picture's original aspect ratio.

Scaling Images in the Entire Grid


To scale the images in the entire grid, not just one column, set the ImageAlign property for the Normal style to Scale. In the Designer 1. 2. 3. Open the C1FlexGrid Style Editor. For details on how to access the C1FlexGrid Style Editor, see Accessing the C1FlexGrid Style Editor (page 168). Select Normal in the Built-In Styles list. In the right pane, locate the ImageAlign property and set it to Scale.

Searching for Entries in a Column 219

4.

Click OK to close the editor.

In Code Add the following code to the Form_Load event: Visual Basic Me.C1FlexGrid1.Styles("Normal").ImageAlign = C1.Win.C1FlexGrid.ImageAlignEnum.Scale C# this.c1FlexGrid1.Styles["Normal"].ImageAlign = C1.Win.C1FlexGrid.ImageAlignEnum.Scale; Delphi Self.C1FlexGrid1.Styles['Normal'].ImageAlign := C1.Win.C1FlexGrid.ImageAlignEnum.Scale;

Searching for Entries in a Column


To search for entries in a column as a user types, set the AutoSearch property to FromCursor to begin the search from the current row or FromTop to begin the search from the first scrollable row. Conversely, to disable the search, set the AutoSearch property to None, which is the default setting. This property can be set either in the designer or in code.

220 C1FlexGrid Task-Based Help

In the Designer Locate the AutoSearch property in the Properties window and set it to FromTop.

In Code Add the following code to the Form_Load event to set the AutoSearch property to FromTop: Visual Basic Me.C1FlexGrid1.AutoSearch = C1.Win.C1FlexGrid.AutoSearchEnum.FromTop C# this.c1FlexGrid1.AutoSearch = C1.Win.C1FlexGrid.AutoSearchEnum.FromTop; Delphi Self.C1FlexGrid1.AutoSearch := C1.Win.C1FlexGrid.AutoSearchEnum.FromTop;

This topic illustrates the following: As the user types, the search will highlight the cell containing that letter. In this example, tying C in the Element column highlights Carbon.

Note: If more than one entries begin with the same letter, typing the next letter will highlight the entry with those letters. For example, typing He in the Element column will highlight Helium.

Setting a Cell's Value to Zero When Users Press the Delete Key
To set a cell's value to zero when a user presses the DELETE key, use FlexGrid's KeyDown event to catch when the DELETE key is pressed.

Setting Rows As Headers 221

Add the following KeyDown event to your form: Visual Basic Private Sub C1FlexGrid1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles C1FlexGrid1.KeyDown If (e.KeyCode = Keys.Delete) Then C1FlexGrid1(C1FlexGrid1.Row, C1FlexGrid1.Col) = 0 End If End Sub C# private void c1FlexGrid1_KeyDown(object sender, System.Windows.Forms.KeyDownEventArgs e) { if (e.KeyCode == Keys.Delete) { c1FlexGrid1(c1FlexGrid1.Row, c1FlexGrid1.Col) = 0; } } Delphi procedure C1FlexGrid1_KeyDown(sender: object; e: System.Windows.Forms.KeyDownEventArgs); begin if (e.KeyCode = Keys.Delete) then C1FlexGrid1(C1FlexGrid1.Row, C1FlexGrid1.Col) := 0; end; end;

Setting Rows As Headers


To set rows as headers, set the Caption and DataType properties for each row. 1. Add the following code to the Form_Load event to set the number of rows and columns to appear in the grid. Visual Basic Me.C1FlexGrid1.Cols.Count = 5 Me.C1FlexGrid1.Rows.Count = 7 C# this.c1FlexGrid1.Cols.Count = 5; this.c1FlexGrid1.Rows.Count = 7; Delphi Self.C1FlexGrid1.Cols.Count := 5; Self.C1FlexGrid1.Rows.Count := 7; Visual Basic Dim row As C1.Win.C1FlexGrid.RowCollection = Me.C1FlexGrid1.Rows C# C1.Win.C1FlexGrid.RowCollection row = this.c1FlexGrid1.Rows;

2.

Add the rows to the RowCollection:

222 C1FlexGrid Task-Based Help

Delphi var row: C1.Win.C1FlexGrid.RowCollection; rng: C1.Win.C1FlexGrid.CellRange; begin row := Self.c1FlexGrid1.Rows;

3.

Set the Caption and DataType for each row. Visual Basic row(1).Caption = "Date" row(1).DataType = GetType(DateTime) row(2).Caption = "Contact" row(2).DataType = GetType(String) row(3).Caption = "Phone" row(3).DataType = GetType(String) row(3).EditMask = "(999) 999-9999;*" row(4).Caption = "Platform" row(4).DataType = GetType(String) row(4).ComboList = "|Windows XP|Windows 2000|Windows ME|Windows NT|Windows 98|Windows 95" row(5).Caption = "Error Code" row(5).DataType = GetType(Integer) row(6).Caption = "Resolved" row(6).DataType = GetType(Boolean) C# row[1].Caption = "Date"; row[1].DataType = GetType(DateTime); row[2].Caption = "Contact"; row[2].DataType = GetType(string); row[3].Caption = "Phone"; row[3].DataType = GetType(string); row[3].EditMask = "(999) 999-999;*"; row[4].Caption = "Platform"; row[4].DataType = GetType(string); row[4].ComboList = "|Windows XP|Windows 2000|Windows ME|Windows NT|Windows 98|Windows 95"; row[5].Caption = "Error Code"; row[5].DataType = GetType(int); row[6].Caption = "Resolved"; row[6].DataType = GetType(bool); Delphi row[1].Caption := 'Date'; row[1].DataType := GetType(DateTime); row[2].Caption := 'Contact';

Setting Rows As Headers 223

row[2].DataType := GetType(String); row[3].Caption := 'Phone'; row[3].DataType := GetType(String); row[3].EditMask := '(999) 999-999;*'; row[4].Caption := 'Platform'; row[4].DataType := GetType(String); row[4].ComboList := '|Windows XP|Windows 2000|Windows ME|Windows NT|Windows 98|Windows 95'; row[5].Caption := 'Error Code'; row[5].DataType := GetType(Integer); row[6].Caption := 'Resolved'; row[6].DataType := GetType(Boolean); 4. Format the headers to Tahoma, 9pt, Bold font. Visual Basic Me.C1FlexGrid1.Styles("Fixed").Font = New Font("Tahoma", 9, FontStyle.Bold) C# this.c1FlexGrid1.Styles["Fixed"].Font = new Font("Tahoma, 9, FontStyle.Bold); Delphi Self.C1FlexGrid1.Styles['Fixed'].Font := Font.Create("Tahoma, 9, FontStyle.Bold); Visual Basic Me.C1FlexGrid1.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.FixedOnly row(0).AllowMerging = True Dim rng As C1.Win.C1FlexGrid.CellRange = C1FlexGrid1.GetCellRange(0, 1, 0, 4) rng.Data = "Call Log" C# this.c1FlexGrid1.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.FixedOnly; row[0].AllowMerging = true; C1.Win.C1FlexGrid.CellRange rng = c1FlexGrid1.GetCellRange(0,1,0,4); rng.Data = "Call Log"; Delphi Self.C1FlexGrid1.AllowMerging := C1.Win.C1FlexGrid.AllowMergingEnum.FixedOnly; row[0].AllowMerging := True; rng := C1FlexGrid1.GetCellRange(0, 1, 0, 4); rng.Data := 'Call Log';

5.

Merge the fixed row and add a header to it:

224 C1FlexGrid Task-Based Help

This topic illustrates the following: The row headers appears in the first column and the each row will be formatted according to its DataType property.

Setting the Background Color of Columns and Rows


To set the background color of columns and rows, create a new style and assign it to a column and row. Setting the Background Color of Columns 1. Create a new style for the column. In the Designer Open the C1FlexGrid Style Editor. For details on how to access the C1FlexGrid Style Editor, see Accessing the C1FlexGrid Style Editor (page 168). Click Add to create a new style. Double-click CustomStyle1, rename it ColumnColor, and press ENTER when finished.

Setting the Background Color of Columns and Rows 225

Do not exit the C1FlexGrid Style Editor.

In Code Add the following code to the Form_Load event: Visual Basic Dim cc As C1.Win.C1FlexGrid.CellStyle cc = Me.C1FlexGrid1.Styles.Add("ColumnColor") C# C1.Win.C1FlexGrid.CellStyle cc; cc = this.c1FlexGrid1.Styles.Add("ColumnColor"); Delphi var cc: C1.Win.C1FlexGrid.CellStyle; begin cc := Self.c1FlexGrid1.Styles.Add('ColumnColor');

2.

Set the BackColor color to CornSilk. In the Designer In the C1FlexGrid Style Editor, locate the BackColor property in the right pane and set it to CornSilk.

226 C1FlexGrid Task-Based Help

Click OK to close the C1FlexGrid Style Editor.

In Code Add the following code to the Form_Load event: 3. Visual Basic cc.BackColor = Color.Cornsilk C# cc.BackColor = Color.Cornsilk; Delphi cc.BackColor := Color.Cornsilk;

Assign the style to a column by adding the following code to the Form_Load event: Visual Basic Me.C1FlexGrid1.Cols(1).Style = Me.C1FlexGrid.Styles("ColumnColor") C# this.c1FlexGrid1.Cols[1].Style = this.c1FlexGrid1.Styles["ColumnColor"]; Delphi Self.C1FlexGrid1.Cols[1].Style := Self.C1FlexGrid1.Styles['ColumnColor'];

Setting the Background Color of Columns and Rows 227

This topic illustrates the following: The background color of the Element column is set to CornSilk.

Setting the Background Color of Rows 1. Create a new style for the row. In the Designer Open the C1FlexGrid Style Editor. For details on how to access the C1FlexGrid Style Editor, see Accessing the C1FlexGrid Style Editor (page 168). Click Add to create a new style. Double-click CustomStyle1, rename it RowColor, and press ENTER when finished.

228 C1FlexGrid Task-Based Help

Do not exit the C1FlexGrid Style Editor.

In Code Add the following code to the Form_Load event: Visual Basic Dim rs As C1.Win.C1FlexGrid.CellStyle rs = Me.C1FlexGrid1.Styles.Add("RowColor") C# C1.Win.C1FlexGrid.CellStyle rs; rs = this.c1FlexGrid1.Styles.Add("RowColor"); Delphi var rs: C1.Win.C1FlexGrid.CellStyle; begin rs := Self.c1FlexGrid1.Styles.Add('RowColor');

2.

Set the BackColor to PowderBlue. In the Designer In the C1FlexGrid Style Editor, locate the BackColor property and set it to PowderBlue.

Setting the Background Color of Columns and Rows 229

3.

Click OK to close the C1FlexGrid Style Editor. Visual Basic rs.BackColor = Color.PowderBlue C# rs.BackColor = Color.PowderBlue; Delphi rs.BackColor := Color.PowderBlue;

In Code

Assign the style to a row by adding the following code to the Form_Load event: Visual Basic Me.C1FlexGrid1.Rows(8).Style = Me.C1FlexGrid1.Styles("RowColor") C# this.c1FlexGrid1.Rows[8].Style = this.c1FlexGrid1.Styles["RowColor"]; Delphi Self.C1FlexGrid1.Rows[8].Style := Self.C1FlexGrid1.Styles['RowColor'];

230 C1FlexGrid Task-Based Help

This topic illustrates the following: The background color of the row is set to PowderBlue. Notice how the column color takes precedence over the row color.

Setting the Background Color of Rows and Columns in a Single Statement


To set the background color of rows and columns in a single statement, add the following code to the Form_Load event: Visual Basic Me.C1FlexGrid1.Cols(2).StyleNew.BackColor = Color.Cornsilk Me.C1FlexGrid1.Rows(8).StyleNew.BackColor = Color.PowderBlue C# this.c1FlexGrid1.Cols[2].StyleNew.BackColor = Color.Cornsilk; this.c1FlexGrid1.Rows[8].StyleNew.BackColor = Color.PowderBlue; Delphi Self.C1FlexGrid1.Cols[2].StyleNew.BackColor := Color.Cornsilk; Self.C1FlexGrid1.Rows[8].StyleNew.BackColor := Color.PowderBlue;

Setting the Font of a Single Cell 231

This topic illustrates the following: The single line of code produces the same result as creating a new style and assigning it to a row. However, using a single statement only changes the row or column it is set to. To apply a style to multiple columns or rows, create a new style and set it to the columns or rows as in Setting the Background Color of Columns and Rows (page 224).

Setting the Font of a Single Cell


To set the font of a single cell, create a new style and assign it to a cell. 1. Create a new style. In the Designer Open the C1FlexGrid Style Editor. For details on how to access the C1FlexGrid Style Editor, see Accessing the C1FlexGrid Style Editor (page 168). Click Add to create a new style. Double-click CustomStyle1, rename it myStyle, and press ENTER when finished.

232 C1FlexGrid Task-Based Help

Do not exit the C1FlexGrid Style Editor.

In Code Add the following code to the Form_Load event: Visual Basic Dim cs As C1.Win.C1FlexGrid.CellStyle cs = Me.C1FlexGrid1.Styles.Add("myStyle") C# C1.Win.C1FlexGrid.CellStyle cs; cs = this.c1FlexGrid1.Styles.Add("myStyle"); Delphi var cs: C1.Win.C1FlexGrid.CellStyle; begin cs := Self.c1FlexGrid1.Styles.Add('myStyle');

2.

Set the font to Tahoma, 10 pt, Bold. In the Designer In the C1FlexGrid Style Editor, locate the Font property in the right pane and click the ellipsis button. The Font dialog will appear. Set the Font box to Tahoma. Set the Font style box to Bold.

Setting the Font of a Single Cell 233

Set the Size box to 10.

Click OK to close the Font dialog box, but do not exit the C1FlexGrid Style Editor.

In Code Add the following code to the Form_Load event: 3. Visual Basic cs.Font = New Font("Tahoma", 10, FontStyle.Bold) C# cs.Font = new Font("Tahoma", 10, FontStyle.Bold); Delphi cs.Font := Font.Create('Tahoma', 10, FontStyle.Bold);

Set the font color to Blue. In the Designer In the C1FlexGrid Style Editor, locate the ForeColor property in the right pane and set it to Blue.

234 C1FlexGrid Task-Based Help

Click OK to close the C1FlexGrid Style Editor.

In Code Add the following code to the Form_Load event: 4. Visual Basic cs.ForeColor = Color.Blue C# cs.ForeColor = Color.Blue; Delphi cs.ForeColor := Color.Blue;

Assign the style to a cell by adding the following code to the Form_Load event: Visual Basic Me.C1FlexGrid1.SetCellStyle(6, 2, "myStyle") C# this.c1FlexGrid1.SetCellStyle(6, 2, "myStyle"); Delphi Self.C1FlexGrid1.SetCellStyle(6, 2, 'myStyle');

Setting the Text Delimiting Character in C1FlexGrid 235

This topic illustrates the following: Carbon appears in Blue, Bold, 10 pt, Tahoma font.

Setting the Text Delimiting Character in C1FlexGrid


To set the text delimiting character in C1FlexGrid, set the Split method. Add the following code to the Form_Load event to set the delimiting character to a semicolon: Visual Basic Dim cols As String = "Product;Region;Salesperson;Sales;Bonus" Dim colNames As String() = cols.Split(";") Me.C1FlexGrid1.Cols.Count = 5 Me.C1FlexGrid1.Cols.Fixed = 0 Dim i% For i = 0 To Me.C1FlexGrid1.Cols.Count - 1 Me.C1FlexGrid1(0, i) = colNames(i) Me.C1FlexGrid1.Cols(i).Name = colNames(i) Next C# string cols = "Product;Region;Salesperson;Sales;Bonus" String() colNames = cols.Split(";"); this.c1FlexGrid1.Cols.Count = 5; this.c1FlexGrid1.Cols.Fixed = 0; for (int i = 0; i < fg.Cols.Count; i++) { this.c1FlexGrid1[0, i] = colNames[i]; this.c1FlexGrid1.Cols[i].Name = colNames[i]; } Delphi var cols: String;

236 C1FlexGrid Task-Based Help

colNames: String(); begin cols := 'Product;Region;Salesperson;Sales;Bonus'; colNames := cols.Split(';'); Self.C1FlexGrid1.Cols.Count := 5; Self.C1FlexGrid1.Cols.Fixed := 0; For i := 0 To fg.Cols.Count 1 do begin Self.C1FlexGrid1[0, i] := colNames[i]; Self.C1FlexGrid1.Cols[i].Name := colNames[i]; end; end; This topic illustrates the following: The string in the Split method determines the delimiting character. Changing the semicolon to a comma in both the Split method and the string will produce the same output as the semicolon.

Sorting Multiple Columns


To sort multiple columns, set each column's Sort property and use the Sort method to sort according to the column settings. 1. Add the following code to the Form_Load event to set the second column to sort in ascending order and the third column to sort in descending order. Visual Basic Me.C1FlexGrid1.Cols(1).Sort = C1.Win.C1FlexGrid.SortFlags.Ascending Me.C1FlexGrid1.Cols(2).Sort = C1.Win.C1FlexGrid.SortFlags.Descending C# this.c1FlexGrid1.Cols[1].Sort = C1.Win.C1FlexGrid.SortFlags.Ascending; this.c1FlexGrid1.Cols[2].Sort = C1.Win.C1FlexGrid.SortFlags.Descending; Delphi Self.C1FlexGrid1.Cols[1].Sort := C1.Win.C1FlexGrid.SortFlags.Ascending;

Undoing a Sort 237

Self.C1FlexGrid1.Cols[2].Sort := C1.Win.C1FlexGrid.SortFlags.Descending; 2. Add the following Sort method to sort according to the settings in columns two and three. Visual Basic Me.C1FlexGrid1.Sort(C1.Win.C1FlexGrid.SortFlags.UseColSort, 1, 2) C# this.c1FlexGrid1.Sort(C1.Win.C1FlexGrid.SortFlags.UseColSort, 1, 2) Delphi Self.C1FlexGrid1.Sort(C1.Win.C1FlexGrid.SortFlags.UseColSort, 1, 2);

This topic illustrates the following: Your grid will look like the following with the second column sorted in ascending order, then the third column in descending order. In this example, Neon appears before Argon in the Element column since the grid is sorted first by the StandardState column in ascending order, then by the Element column in descending order.

Undoing a Sort
To undo a sort in C1FlexGrid when the grid is bound to a DataTable, set the DefaultView property to null. Add the following code to the Button1_Click event: Visual Basic Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click CustTable.DefaultView.Sort = "" End Sub C# private void Button1_Click(object sender, System.EventArgs e) { CustTable.DefaultView.Sort = ""; }

238 C1FlexGrid Task-Based Help

Delphi procedure Button1_Click(sender: System.Object; e: System.EventArgs) begin CustTable.DefaultView.Sort := ''; end; Note: The DataTable.DefaultView returns the DataView of the DataTable, and setting the sort string to null forces the DataView to undo the previous sort.

This topic illustrates the following: Click the Last Name column to sort on it.

Click the Undo button, and the sort will be undone.

Using Password Entries in C1FlexGrid


To show placeholder characters (*) in cells used for password entry, use the SetupEditor event. 1. Create a column for passwords in the grid and set the draw mode: Visual Basic Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.C1FlexGrid1.Cols(0).Width = Me.C1FlexGrid1.Rows(0).HeightDisplay Me.C1FlexGrid1.ShowCursor = True

Using Password Entries in C1FlexGrid 239

Me.C1FlexGrid1.Cols(1).Caption =((Me.C1FlexGrid1.Cols(1).Name) = "Password") Me.C1FlexGrid1.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw End Sub C# private void Form1_Load(object sender, System.EventArgs e) { this.c1FlexGrid1.Cols[0].Width = this.c1FlexGrid1.Rows[0].HeightDisplay; this.c1FlexGrid1.ShowCursor = true; this.c1FlexGrid1.Cols[1].Caption = this.c1FlexGrid1.Cols[1].Name = "Password"; this.c1FlexGrid1.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw; } Delphi procedure Form1_Load(sender: System.Object; e: System.EventArgs); begin Self.C1FlexGrid1.Cols[0].Width := Self.C1FlexGrid1.Rows[0].HeightDisplay; Self.C1FlexGrid1.ShowCursor := true; Self.C1FlexGrid1.Cols[1].Caption := 'Password'; Self.C1FlexGrid1.Cols[1].Name = 'Password'; Self.C1FlexGrid1.DrawMode := C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw; end;

2.

Add the following code for the SetupEditor event. This code will hide characters that are entered by the user. Visual Basic Private Sub C1FlexGrid1_SetupEditor(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.RowColEventArgs) Handles C1FlexGrid1.SetupEditor Dim tb As TextBox = Me.C1FlexGrid1.Editor If Not (tb Is Nothing) Then If Me.C1FlexGrid1.Cols(e.Col).Name = "Password" Then tb.PasswordChar = "*"c Else tb.PasswordChar = CChar(0) End If End If End Sub C# private void c1FlexGrid1_SetupEditor(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { TextBox tb = this.c1FlexGrid1.Editor as TextBox; if (tb != null) { if (this.c1FlexGrid1.Cols[e.Col].Name == "Password") tb.PasswordChar = '*'; else tb.PasswordChar = (char)0; } }

240 C1FlexGrid Task-Based Help

Delphi procedure C1FlexGrid1_SetupEditor(sender: System.Object; e: C1.Win.C1FlexGrid.RowColEventArgs); var tb: TextBox; begin tb := Self.C1FlexGrid1.Editor as TextBox; if (tb <> nil) begin If (Self.C1FlexGrid1.Cols[e.Col].Name = Password) tb.PasswordChar := * else tb.PasswordChar := #0; end; end;

This topic illustrates the following: When the user enters a password in the Password column and presses ENTER, the text is automatically converted to asterisks.

Hiding Characters Already Entered


To hide the characters that have already been entered and do not need edited, use the OwnerDrawCell event. 1. Add the following code for the OwnerDrawCell event. This code will hide the characters that have already been entered and do not need edited. Visual Basic Private Sub C1FlexGrid1_OwnerDrawCell(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.OwnerDrawCellEventArgs) Handles C1FlexGrid1.OwnerDrawCell If e.Row >= Me.C1FlexGrid1.Rows.Fixed And Me.C1FlexGrid1.Cols(e.Col).Name = "Password" Then e.Text = New String("*"c, e.Text.Length) End If End Sub C# private void c1FlexGrid1_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e) { if (e.Row >= this.c1FlexGrid1.Rows.Fixed && this.c1FlexGrid1.Cols[e.Col].Name == "Password") {

Word Wrapping in a Header or Fixed Row 241

e.Text = new string('*', e.Text.Length); } } Delphi procedure C1FlexGrid1_OwnerDrawCell(sender: System.Object; e: C1.Win.C1FlexGrid.OwnerDrawCellEventArgs) begin if (e.Row >= Self.C1FlexGrid1.Rows.Fixed) and (Self.C1FlexGrid1.Cols[e.Col].Name = 'Password') then begin e.Text := string.Create('*', e.Text.Length); end; end;

2.

Add the following code to the Form_Load event: Visual Basic Me.C1FlexGrid1(1, 1) = "123456" C# this.c1FlexGrid1[1,1] = "123456"; Delphi Self.C1FlexGrid1[1,1] := "123456";

This topic illustrates the following: Run the project again and notice the numbers are automatically loaded onto the form in the Password column as asterisks.

Word Wrapping in a Header or Fixed Row


To set word wrapping in a header or fixed row, set the Height and WordWrap properties. 1. Set the Caption property for a column header in the grid. In the Designer Select a column in the grid. This will open the Column Tasks menu for that column. In the Column Caption box, enter Word Wrapping in Header.

242 C1FlexGrid Task-Based Help

Alternatively, the Caption property can also be set using the C1FlexGrid Column Editor. Open the C1FlexGrid Column Editor. For details on how to access the C1FlexGrid Column Editor, see Accessing the C1FlexGrid Column Editor (page 167). Select a column in the right pane and set the Caption property in the left pane to Word Wrapping in Header.

Click OK to close the editor.

In Code Add the following code to the Form_Load event. 2. Visual Basic Me.C1FlexGrid1.Cols(1).Caption = "Word Wrapping in Header" C# this.c1FlexGrid1.Cols[1].Caption = "Word Wrapping in Header"; Delphi Self.C1FlexGrid1.Cols[1].Caption := 'Word Wrapping in Header'; Visual Basic Me.C1FlexGrid1.Rows(0).Height = 3 * Me.C1FlexGrid1.Rows.DefaultSize C# this.c1FlexGrid1.Rows[0].Height = 3 * this.c1FlexGrid1.Rows.DefaultSize;

Set the row height of the header.

Word Wrapping in a Header or Fixed Row 243

Delphi Self.C1FlexGrid1.Rows[0].Height := 3 * Self.C1FlexGrid1.Rows.DefaultSize;

3.

Enable word wrapping for the fixed cells. In the Designer Open the C1FlexGrid Style Editor. For details on how to access the C1FlexGrid Style Editor, see Accessing the C1FlexGrid Style Editor (page 168). Select Fixed in the Built-In Styles list. Locate the WordWrap property in the right pane and set it to True.

Click OK to close the designer.

In Code Add the following code to the Form_Load event: Visual Basic Me.C1FlexGrid1.Styles("Fixed").WordWrap = True C# this.c1FlexGrid1.Styles["Fixed"].WordWrap = true; Delphi Self.C1FlexGrid1.Styles['Fixed'].WordWrap := true;

244 C1FlexGrid Task-Based Help

This topic illustrates the following: In this example, a three-line header is created, and the text is wrapped.

C1.Win.C1FlexGrid.2 Assembly 245

C1.Win.C1FlexGrid.2 Assembly
Namespaces
C1.Win.C1FlexGrid C1.Win.C1FlexGrid.Util.BaseControls See Also C1.Win.C1FlexGrid.Classic.2 Assembly

C1.Win.C1FlexGrid.Classic.2 Assembly
Namespaces
C1.Win.C1FlexGrid.Classic See Also C1.Win.C1FlexGrid.2 Assembly

C1.Win.C1FlexGrid Namespace 247

C1.Win.C1FlexGrid Namespace
C1.Win.C1FlexGrid Hierarchy

Classes
Class BeforeMouseDownEventArgs C1FlexGrid Description Provides data for the C1FlexGridBase.BeforeMouseDown event. The C1FlexGrid control is a powerful, full-featured grid. C1FlexGrid provides advanced features such as outline trees, cell merging, masked editing, translated combo and image lists, owner-draw cells, and automatic data aggregation. C1FlexGridBase CellBorder CellRangeCollection CellStyle Base class for the C1FlexGrid control. The CellBorder class encapsulates properties that control the appearance of borders in CellStyle objects. Collection of CellRange objects. The CellStyle class encapsulates properties that control the appearance of grid cells. This information includes the background and foreground colors, font, text and image alignment, and so on. Collection of CellStyle objects defined for a grid. Class that represents a grid column. Collection of grid Column objects. Helper class that provides information about a currently active ComboBox editor. Provides data for the C1FlexGridBase.BeforeDragColumn, C1FlexGridBase.BeforeDragRow, C1FlexGridBase.AfterDragColumn, and C1FlexGridBase.AfterDragRow events. Provides data for the C1FlexGridBase.GetCellErrorInfo and C1FlexGridBase.GetRowErrorInfo events. Provides data for the C1FlexGridBase.GridChanged event handler. Provides data for the C1FlexGridBase.GridError event. Represents a collection of glyphs (images) indexed by glyph type ( GlyphEnum type). The GridPrinter class encapsulates properties that control printing, such as page and printer settings.

CellStyleCollection Column ColumnCollection ComboBoxEditor DragRowColEventArgs

GetErrorInfoEventArgs GridChangedEventArgs GridErrorEventArgs GridGlyphs GridPrinter

248 C1.Win.C1FlexGrid Namespace

Class GridTree

Description The GridTree class enapsulates properties that specify the appearance, position, and behavior of the outline tree. Provides data for the C1FlexGridBase.KeyDownEdit and C1FlexGridBase.KeyUpEdit events. Provides data for the C1FlexGridBase.KeyPressEdit event. Class that implements the IC1MultiColumnDictionary and can be used as a column DataMap to create multicolumn combo editors. The Node class encapsulates properties and methods used for manipulating node rows (collapsing, expanding, moving, and sorting them). Provides data for the C1FlexGridBase.OwnerDrawCell event. Provides data for the C1FlexGridBase.AfterRowColChange, C1FlexGridBase.AfterScroll, C1FlexGridBase.AfterSelChange, C1FlexGridBase.BeforeRowColChange, C1FlexGridBase.BeforeScroll, and C1FlexGridBase.BeforeSelChange events. Class that represents a grid row. Base class for grid rows and columns ( Row and Column classes). Base class for grid row and column collections ( RowCollection and ColumnCollection classes). Provides data for the C1FlexGridBase.AfterEdit, C1FlexGridBase.AfterResizeColumn, C1FlexGridBase.AfterResizeRow, C1FlexGridBase.BeforeEdit, C1FlexGridBase.BeforePageBreak, C1FlexGridBase.BeforeResizeColumn, C1FlexGridBase.BeforeResizeRow, ShowScrollTip, C1FlexGridBase.CellButtonClick, C1FlexGridBase.ComboCloseUp, C1FlexGridBase.ComboDropDown, C1FlexGridBase.SetupEditor, and C1FlexGridBase.StartEdit events. Collection of grid Row objects. Provides data for the C1FlexGridBase.BeforeSort and C1FlexGridBase.AfterSort events. Provides data for the C1FlexGridBase.ShowScrollTip event.

KeyEditEventArgs KeyPressEditEventArgs MultiColumnDictionary

Node

OwnerDrawCellEventArgs RangeEventArgs

Row RowCol RowColCollection RowColEventArgs

RowCollection SortColEventArgs ToolTipEventArgs

C1.Win.C1FlexGrid Namespace 249

Class UnboundValueEventArgs

Description Provides data for the C1FlexGridBase.GetUnboundValue and C1FlexGridBase.SetUnboundValue events. Provides data for the C1FlexGridBase.ValidateEdit event.

ValidateEditEventArgs

Interfaces
Interface IC1EmbeddedEditor IC1MultiColumnDictionary Description Interface implemented by editors and used by the grid to host edit controls on cells. Interface that extends Collections.IDictionary and can be used to implement multi-column data maps.

Delegates
Delegate BeforeMouseDownEventHandler DragRowColEventHandler Description Represents the method that will handle the C1FlexGridBase.BeforeMouseDown event. Represents the method that will handle the C1FlexGridBase.BeforeDragColumn, C1FlexGridBase.BeforeDragRow, C1FlexGridBase.AfterDragColumn and C1FlexGridBase.AfterDragRow events. Represents the method that will handle the C1FlexGridBase.GetCellErrorInfo and C1FlexGridBase.GetRowErrorInfo events. Represents the method that will handle the C1FlexGridBase.GridChanged event. Represents the method that will handle the C1FlexGridBase.GridError event. Represents the method that will handle the C1FlexGridBase.KeyDownEdit and C1FlexGridBase.KeyUpEdit events. Represents the method that will handle the C1FlexGridBase.KeyPressEdit event. Represents the method that will handle the C1FlexGridBase.OwnerDrawCell event. Represents the method that will handle the C1FlexGridBase.AfterRowColChange, C1FlexGridBase.AfterScroll, C1FlexGridBase.AfterSelChange, C1FlexGridBase.BeforeRowColChange, C1FlexGridBase.BeforeScroll, and C1FlexGridBase.BeforeSelChange events.

GetErrorInfoEventHandler

GridChangedEventHandler GridErrorEventHandler KeyEditEventHandler

KeyPressEditEventHandler OwnerDrawCellEventHandler RangeEventHandler

250 C1.Win.C1FlexGrid Namespace

Delegate RowColEventHandler

Description Represents the method that will handle the C1FlexGridBase.AfterEdit, C1FlexGridBase.AfterResizeColumn, C1FlexGridBase.AfterResizeRow, C1FlexGridBase.BeforeEdit, C1FlexGridBase.BeforePageBreak, C1FlexGridBase.BeforeResizeColumn, C1FlexGridBase.BeforeResizeRow, ShowScrollTip, C1FlexGridBase.CellButtonClick, C1FlexGridBase.ComboCloseUp, C1FlexGridBase.ComboDropDown, C1FlexGridBase.SetupEditor, and C1FlexGridBase.StartEdit events. Represents the method that will handle the C1FlexGridBase.ShowScrollTip event. Represents the method that will handle the C1FlexGridBase.BeforeSort and C1FlexGridBase.AfterSort events. Represents the method that will handle the C1FlexGridBase.GetUnboundValue and C1FlexGridBase.SetUnboundValue events. Represents the method that will handle the C1FlexGridBase.ValidateEdit event.

RowColToolTipEventHandler SortColEventHandler

UnboundValueEventHandler

ValidateEditEventHandler

Enumerations
Enumeration AggregateEnum Description Specifies the type of aggregate function to calculate with the C1FlexGridBase.Aggregate and C1FlexGridBase.Subtotal methods. Specifies options to use when calculating aggregates with the C1FlexGridBase.Aggregate method. Specifies whether the user should be able to drag rows and columns with the mouse. Specifies whether the user should be able to freeze rows and columns with the mouse. Specifies how adjacent cells are merged for display. Specifies whether the user should be able to resize rows and columns with the mouse. Specifies whether the user should be able to sort columns with the mouse. Specifies where the grid should start searching for cells when using the C1FlexGridBase.AutoSearch property. Specifies options that control autosizing. Specifies the direction of cell borders. Specifies the type of cell border to display.

AggregateFlags AllowDraggingEnum AllowFreezingEnum AllowMergingEnum AllowResizingEnum AllowSortingEnum AutoSearchEnum AutoSizeFlags BorderDirEnum BorderStyleEnum

C1.Win.C1FlexGrid Namespace 251

Enumeration CellStyleEnum CheckEnum ClearFlags DisplayEnum DragModeEnum DrawCellFlags DrawModeEnum DropModeEnum EditFlags FileFlags

Description Enumeration used to retrieve CellStyle objects from the C1FlexGridBase.Styles collection. Specifies the type of checkbox to draw in a cell. Specifies which elements of the grid should be cleared by the C1FlexGridBase.Clear method. Specifies whether a style should display the cell text, image, both, or none. Specifies the behavior of the control as an OLE dragdrop source. Specifies which elements of the cell should be drawn by the grid. Specifies whether cells should be drawn entirely by the grid or with help from custom drawing code. Specifies the behavior of the control as an OLE dragdrop target. Specifies options that customize the grid's editing behavior. Specifies options for use with the C1FlexGridBase.SaveGrid and C1FlexGridBase.LoadGrid methods. Specifies the type of file to save or load with the C1FlexGridBase.SaveGrid and C1FlexGridBase.LoadGrid methods. Specifies the appearance of the focus rectangle. Specifies a type of glyph (image) used by the grid to convey information about a row, column, or cell. Specifies the type of change that occurred when the controls fires the C1FlexGridBase.GridChanged event. Specifies whether the grid should highlight the selected range. Type of grid element at a specific point on the control. Specifies how images are aligns in grid cells. Specifies the action to perform when the ENTER and TAB keys are pressed. This enumeration is for internal use only. Specifies the destination of nodes when they are moved with the Node.Move method. Specifies a node with respect to another given node. Contains flags that specify printing options to use with the C1FlexGridBase.PrintGrid method. Specifies options that customize scrollbar behavior. Specifies the type of selection provided by the grid.

FileFormatEnum

FocusRectEnum GlyphEnum GridChangedTypeEnum HighLightEnum HitTestTypeEnum ImageAlignEnum KeyActionEnum MoveCursorEnum NodeMoveEnum NodeTypeEnum PrintGridFlags ScrollFlags SelectionModeEnum

252 C1.Win.C1FlexGrid Namespace

Enumeration ShowButtonsEnum ShowThemedHeadersEnum SortFlags StyleElementFlags SubtotalPositionEnum

Description Specifies when the grid should display combo buttons in cells. Specifies whether the control should use themes for displaying row or column headers. Specifies how grid columns should be sorted. Contains flags that specify which style elements are defined in a CellStyle object. Specifies whether subtotals rows created with the C1FlexGridBase.Subtotal method should be inserted above or below the data they refer to. Specifies how text is aligned in a grid cell. Specifies the direction to use when rendering text in a grid cell. Specifies a 3D effect to use when rendering cell text. Specifies the appearance of the outline tree.

TextAlignEnum TextDirectionEnum TextEffectEnum TreeStyleFlags

Structures
Structure CellRange HitTestInfo Description Represents cell ranges, allowing the caller to set properties for multiple cells with a single statement. HitTestInfo contains information about the control at a point on the screen (it returned by the C1FlexGridBase.HitTest method).

See Also C1.Win.C1FlexGrid.2 Assembly

C1.Win.C1FlexGrid Hierarchy
System.Object System.MarshalByRefObject System.ComponentModel.Component System.Windows.Forms.Control C1.Win.C1FlexGrid.Util.BaseControls.ScrollableControl C1.Win.C1FlexGrid.C1FlexGridBase ---- System.ComponentModel.ISupportInitialize, C1.Win.j C1.Win.C1FlexGrid.C1FlexGrid System.EventArgs C1.Win.C1FlexGrid.BeforeMouseDownEventArgs C1.Win.C1FlexGrid.DragRowColEventArgs C1.Win.C1FlexGrid.GetErrorInfoEventArgs C1.Win.C1FlexGrid.GridChangedEventArgs

C1.Win.C1FlexGrid Hierarchy 253

C1.Win.C1FlexGrid.GridErrorEventArgs C1.Win.C1FlexGrid.KeyEditEventArgs C1.Win.C1FlexGrid.KeyPressEditEventArgs C1.Win.C1FlexGrid.OwnerDrawCellEventArgs C1.Win.C1FlexGrid.RangeEventArgs C1.Win.C1FlexGrid.RowColEventArgs C1.Win.C1FlexGrid.ToolTipEventArgs C1.Win.C1FlexGrid.SortColEventArgs C1.Win.C1FlexGrid.UnboundValueEventArgs C1.Win.C1FlexGrid.ValidateEditEventArgs C1.Win.C1FlexGrid.CellBorder C1.Win.C1FlexGrid.CellRangeCollection ---- System.Collections.IEnumerable C1.Win.C1FlexGrid.CellStyle C1.Win.C1FlexGrid.CellStyleCollection ---- System.Collections.ICollection, System.Collections.IEnumerable C1.Win.C1FlexGrid.RowCol C1.Win.C1FlexGrid.Column C1.Win.C1FlexGrid.Row C1.Win.C1FlexGrid.RowColCollection ---- System.Collections.IEnumerable C1.Win.C1FlexGrid.ColumnCollection C1.Win.C1FlexGrid.RowCollection C1.Win.C1FlexGrid.ComboBoxEditor C1.Win.C1FlexGrid.GridGlyphs C1.Win.C1FlexGrid.GridPrinter C1.Win.C1FlexGrid.GridTree System.Collections.Specialized.ListDictionary C1.Win.C1FlexGrid.MultiColumnDictionary ---- C1.Win.C1FlexGrid.IC1MultiColumnDictionary C1.Win.C1FlexGrid.Node System.ValueType C1.Win.C1FlexGrid.CellRange C1.Win.C1FlexGrid.HitTestInfo System.[Enum] C1.Win.C1FlexGrid.AggregateEnum C1.Win.C1FlexGrid.AggregateFlags C1.Win.C1FlexGrid.AllowDraggingEnum C1.Win.C1FlexGrid.AllowFreezingEnum C1.Win.C1FlexGrid.AllowMergingEnum C1.Win.C1FlexGrid.AllowResizingEnum

254 C1.Win.C1FlexGrid Namespace

C1.Win.C1FlexGrid.AllowSortingEnum C1.Win.C1FlexGrid.AutoSearchEnum C1.Win.C1FlexGrid.AutoSizeFlags C1.Win.C1FlexGrid.BorderDirEnum C1.Win.C1FlexGrid.BorderStyleEnum C1.Win.C1FlexGrid.CellStyleEnum C1.Win.C1FlexGrid.CheckEnum C1.Win.C1FlexGrid.ClearFlags C1.Win.C1FlexGrid.DisplayEnum C1.Win.C1FlexGrid.DragModeEnum C1.Win.C1FlexGrid.DrawCellFlags C1.Win.C1FlexGrid.DrawModeEnum C1.Win.C1FlexGrid.DropModeEnum C1.Win.C1FlexGrid.EditFlags C1.Win.C1FlexGrid.FileFlags C1.Win.C1FlexGrid.FileFormatEnum C1.Win.C1FlexGrid.FocusRectEnum C1.Win.C1FlexGrid.GlyphEnum C1.Win.C1FlexGrid.GridChangedTypeEnum C1.Win.C1FlexGrid.HighLightEnum C1.Win.C1FlexGrid.HitTestTypeEnum C1.Win.C1FlexGrid.ImageAlignEnum C1.Win.C1FlexGrid.KeyActionEnum C1.Win.C1FlexGrid.MoveCursorEnum C1.Win.C1FlexGrid.NodeMoveEnum C1.Win.C1FlexGrid.NodeTypeEnum C1.Win.C1FlexGrid.PrintGridFlags C1.Win.C1FlexGrid.ScrollFlags C1.Win.C1FlexGrid.SelectionModeEnum C1.Win.C1FlexGrid.ShowButtonsEnum C1.Win.C1FlexGrid.ShowThemedHeadersEnum C1.Win.C1FlexGrid.SortFlags C1.Win.C1FlexGrid.StyleElementFlags C1.Win.C1FlexGrid.SubtotalPositionEnum C1.Win.C1FlexGrid.TextAlignEnum C1.Win.C1FlexGrid.TextDirectionEnum C1.Win.C1FlexGrid.TextEffectEnum

AggregateEnum Enumeration 255

C1.Win.C1FlexGrid.TreeStyleFlags System.[Delegate] System.MulticastDelegate C1.Win.C1FlexGrid.BeforeMouseDownEventHandler C1.Win.C1FlexGrid.DragRowColEventHandler C1.Win.C1FlexGrid.GetErrorInfoEventHandler C1.Win.C1FlexGrid.GridChangedEventHandler C1.Win.C1FlexGrid.GridErrorEventHandler C1.Win.C1FlexGrid.KeyEditEventHandler C1.Win.C1FlexGrid.KeyPressEditEventHandler C1.Win.C1FlexGrid.OwnerDrawCellEventHandler C1.Win.C1FlexGrid.RangeEventHandler C1.Win.C1FlexGrid.RowColEventHandler C1.Win.C1FlexGrid.RowColToolTipEventHandler C1.Win.C1FlexGrid.SortColEventHandler C1.Win.C1FlexGrid.UnboundValueEventHandler C1.Win.C1FlexGrid.ValidateEditEventHandler See Also C1.Win.C1FlexGrid Namespace

AggregateEnum Enumeration
Specifies the type of aggregate function to calculate with the C1FlexGridBase.Aggregate and C1FlexGridBase.Subtotal methods. [Visual Basic] Public Enum AggregateEnum [C#] public enum AggregateEnum [Delphi] type AggregateEnum = (Average, Clear, Count, Max, Min, None, Percent, Std, StdPop, Sum, Var, VarPop); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Average Description Returns the average value of the non-empty cells in a range.

256 C1.Win.C1FlexGrid Namespace

Member name Clear

Description Clear existing aggregates. This setting is used with the C1FlexGridBase.Subtotal method to clear any existing subtotals, usually before calculating new subtotals. Returns the count of non-empty cells in a range. Returns the maximum value in a range. Returns the minimum value in a range. No aggregate. This setting is used with the C1FlexGridBase.Subtotal method to create an outline tree without any numerical aggregates. Percent of grand total. This setting is used with the C1FlexGridBase.Subtotal method to calculate the percentage of the grand total represented by each sub group. (This setting can't be used with the C1FlexGridBase.Aggregate method). Returns the sample standard deviation of the values in a range (uses the formula based on n-1). Returns the population standard deviation of the values in a range (uses the formula based on n). Returns the sum of all values in the range. Returns the sample variance of the values in a range (uses the formula based on n-1). Returns the population variance of the values in a range (uses the formula based on n).

Count Max Min None

Percent

Std StdPop Sum Var VarPop See Also C1.Win.C1FlexGrid Namespace

AggregateFlags Enumeration
Specifies options to use when calculating aggregates with the C1FlexGridBase.Aggregate method. [Visual Basic] Public Enum AggregateFlags [C#] public enum AggregateFlags [Delphi] type AggregateFlags = (AggregateBooleans, AggregateDates, ExcludeNodes, None); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll)

AllowDraggingEnum Enumeration 257

Members Member name AggregateBooleans Description Calculate aggregates for Boolean values. This flag causes the value True to be interpreted as one, and False as zero. This option is useful for counting the number of checked checkboxes in a range. Calculate aggregates for dates instead of numerical values. Only a few aggregate functions are meaningful for dates: count, maximum, and minimum. Exclude node rows from aggregate. This option is useful when the grid contains subtotal rows, which are marked as nodes and contain values that are subtotals and should thus be excluded from aggregates. Default setting. Include all rows and use numerical values only.

AggregateDates

ExcludeNodes

None See Also C1.Win.C1FlexGrid Namespace

AllowDraggingEnum Enumeration
Specifies whether the user should be able to drag rows and columns with the mouse. [Visual Basic] Public Enum AllowDraggingEnum [C#] public enum AllowDraggingEnum [Delphi] type AllowDraggingEnum = (Both, Columns, None, Rows); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Both Columns None Rows See Also C1.Win.C1FlexGrid Namespace Description The user may drag rows and columns with the mouse. The user may drag columns with the mouse. The user may not drag rows or columns. The user may drag rows with the mouse.

AllowFreezingEnum Enumeration
Specifies whether the user should be able to freeze rows and columns with the mouse.

258 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Enum AllowFreezingEnum [C#] public enum AllowFreezingEnum [Delphi] type AllowFreezingEnum = (Both, Columns, None, Rows); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Both Columns None Rows See Also C1.Win.C1FlexGrid Namespace Description The user may freeze rows and columns by dragging the frozen region boundaries with the mouse. The user may freeze columns by dragging the frozen region vertical boundary with the mouse. The user may not freeze rows or columns. The user may freeze rows by dragging the frozen region horizontal boundary with the mouse.

AllowMergingEnum Enumeration
Specifies how adjacent cells are merged for display. [Visual Basic] Public Enum AllowMergingEnum [C#] public enum AllowMergingEnum [Delphi] type AllowMergingEnum = (Custom, FixedOnly, Free, Nodes, None, RestrictAll, RestrictCols, RestrictRows, Spill); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Custom FixedOnly Description Use C1FlexGrid.MergedRanges collection to determine which cells are merged. Merge only fixed cells. This setting is useful for setting up complex headers for the data and preventing the data itself from being merged.

AllowResizingEnum Enumeration 259

Member name Free Nodes None RestrictAll RestrictCols RestrictRows Spill See Also C1.Win.C1FlexGrid Namespace

Description Merge any adjacent cells with same contents. Allow long entries in node rows to spill into empty adjacent cells. Do not merge any cells. Merge cells only if cells above or to the left are also merged. Merge columns only if cells to the left are also merged. Merge rows only if cells above are also merged. Allow long entries to spill into empty adjacent cells.

AllowResizingEnum Enumeration
Specifies whether the user should be able to resize rows and columns with the mouse. [Visual Basic] Public Enum AllowResizingEnum [C#] public enum AllowResizingEnum [Delphi] type AllowResizingEnum = (Both, BothUniform, Columns, ColumnsUniform, None, Rows, RowsUniform); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Both BothUniform Columns Description The user may resize rows and columns with the mouse. The user may change the default column width or row height with the mouse. The user may resize columns with the mouse by dragging the edge of the column headers. Doubleclicking the edge of a column header automatically sizes the column to fit the widest entry. The user may change the default column width with the mouse. Resizing any column will resize all columns that don't have a specific width assigned to them. The user may not resize rows or columns.

ColumnsUniform

None

260 C1.Win.C1FlexGrid Namespace

Member name Rows

Description The user may resize rows with the mouse by dragging the edge of the row headers. Double-clicking the edge of a row header automatically sizes the row to fit the tallest entry. The user may change the default row height with the mouse. Resizing any row will resize all rows that don't have a specific height assigned to them.

RowsUniform

See Also C1.Win.C1FlexGrid Namespace

AllowSortingEnum Enumeration
Specifies whether the user should be able to sort columns with the mouse. [Visual Basic] Public Enum AllowSortingEnum [C#] public enum AllowSortingEnum [Delphi] type AllowSortingEnum = (MultiColumn, None, SingleColumn); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name MultiColumn None SingleColumn See Also C1.Win.C1FlexGrid Namespace Description The user may sort a range of columns by clicking on the header cell of the rightmost column in the range. The user may not sort columns with the mouse. The user may sort single columns by clicking on its header cell.

AutoSearchEnum Enumeration
Specifies where the grid should start searching for cells when using the C1FlexGridBase.AutoSearch property. [Visual Basic] Public Enum AutoSearchEnum [C#] public enum AutoSearchEnum

AutoSizeFlags Enumeration 261

[Delphi] type AutoSearchEnum = (FromCursor, FromTop, None); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name FromCursor FromTop None See Also C1.Win.C1FlexGrid Namespace Description Search from the current row. Search from the first scrollable row. No auto-searching.

AutoSizeFlags Enumeration
Specifies options that control autosizing. [Visual Basic] Public Enum AutoSizeFlags [C#] public enum AutoSizeFlags [Delphi] type AutoSizeFlags = (IgnoreHidden, IgnoreMerged, None, SameSize); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name IgnoreHidden IgnoreMerged None SameSize See Also C1.Win.C1FlexGrid Namespace Description Ignore invisible rows (or columns) when auto-sizing. Ignore merged cells when auto-sizing. Default behavior. All rows (or columns) in the range are set to the same size.

BeforeMouseDownEventArgs Class
Provides data for the C1FlexGridBase.BeforeMouseDown event. For a list of all members of this type, see BeforeMouseDownEventArgs Members.

262 C1.Win.C1FlexGrid Namespace

System.Object System.EventArgs C1.Win.C1FlexGrid.BeforeMouseDownEventArgs [Visual Basic] Public Class BeforeMouseDownEventArgs Inherits EventArgs [C#] public class BeforeMouseDownEventArgs : EventArgs [Delphi] type BeforeMouseDownEventArgs = class (EventArgs); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also BeforeMouseDownEventArgs Members | C1.Win.C1FlexGrid Namespace

BeforeMouseDownEventArgs Members
BeforeMouseDownEventArgs overview Public Constructors BeforeMouseDownEventArgs Constructor Public Fields Button Cancel Clicks Delta Gets which mouse button was pressed. Gets or sets a value indicating whether the event should be canceled. Gets the number of times the mouse button was pressed and released. Gets a signed count of the number of detents the mouse wheel has rotated. A detent is one notch of the mouse wheel. Gets the x-coordinate of a mouse click. Gets the y-coordinate of a mouse click. BeforeMouseDownEventArgs Class | C1.Win.C1FlexGrid Namespace Initializes a new instance of the BeforeMouseDownEventArgs class.

X Y See Also

BeforeMouseDownEventArgs Constructor
Overload List Initializes a new instance of the BeforeMouseDownEventArgs class. [Visual Basic] Public Function New(C1FlexGridBase, MouseButtons, Integer) [C#] public BeforeMouseDownEventArgs(C1FlexGridBase, MouseButtons, int);

BeforeMouseDownEventArgs Constructor (C1FlexGridBase, MouseButtons, Int32) 263

[Delphi] public constructor Create(C1FlexGridBase; MouseButtons; Int32); overload; Initializes a new instance of the BeforeMouseDownEventArgs class. [Visual Basic] Public Function New(MouseEventArgs) [C#] public BeforeMouseDownEventArgs(MouseEventArgs); [Delphi] public constructor Create(MouseEventArgs); overload; See Also BeforeMouseDownEventArgs Class | BeforeMouseDownEventArgs Members | C1.Win.C1FlexGrid Namespace

BeforeMouseDownEventArgs Constructor (C1FlexGridBase, MouseButtons, Int32)


Initializes a new instance of the BeforeMouseDownEventArgs class. [Visual Basic] Public Function New( _ ByVal view As C1FlexGridBase, _ ByVal buttons As MouseButtons, _ ByVal clicks As Integer _ ) [C#] public BeforeMouseDownEventArgs( C1FlexGridBase view, MouseButtons buttons, int clicks ); [Delphi] public constructor Create( view: C1FlexGridBase; buttons: MouseButtons; clicks: Int32 ); overload; Parameters view Control that will fire the event. buttons Windows.Forms.MouseButtons value that indicates which button was pressed. clicks Number of times the button was pressed and released. See Also BeforeMouseDownEventArgs Class | BeforeMouseDownEventArgs Members | C1.Win.C1FlexGrid Namespace | BeforeMouseDownEventArgs Constructor Overload List

BeforeMouseDownEventArgs Constructor (MouseEventArgs)


Initializes a new instance of the BeforeMouseDownEventArgs class.

264 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Function New( _ ByVal e As MouseEventArgs _ ) [C#] public BeforeMouseDownEventArgs( MouseEventArgs e ); [Delphi] public constructor Create( e: MouseEventArgs ); overload; Parameters e Windows.Forms.MouseEventArgs with mouse event information. See Also BeforeMouseDownEventArgs Class | BeforeMouseDownEventArgs Members | C1.Win.C1FlexGrid Namespace | BeforeMouseDownEventArgs Constructor Overload List

BeforeMouseDownEventArgs Fields
The fields of the BeforeMouseDownEventArgs class are listed here. For a complete list of BeforeMouseDownEventArgs class members, see the BeforeMouseDownEventArgs Members topic. Public Fields Button Cancel Clicks Delta Gets which mouse button was pressed. Gets or sets a value indicating whether the event should be canceled. Gets the number of times the mouse button was pressed and released. Gets a signed count of the number of detents the mouse wheel has rotated. A detent is one notch of the mouse wheel. Gets the x-coordinate of a mouse click. Gets the y-coordinate of a mouse click. BeforeMouseDownEventArgs Class | C1.Win.C1FlexGrid Namespace

X Y See Also

BeforeMouseDownEventArgs.Button Field
Gets which mouse button was pressed. [Visual Basic] Public ReadOnly Button As MouseButtons

BeforeMouseDownEventArgs.Cancel Field 265

[C#] public readonly MouseButtons Button [Delphi] public Button: MouseButtons; See Also BeforeMouseDownEventArgs Class | BeforeMouseDownEventArgs Members | C1.Win.C1FlexGrid Namespace

BeforeMouseDownEventArgs.Cancel Field
Gets or sets a value indicating whether the event should be canceled. [Visual Basic] Public Cancel As Boolean [C#] public bool Cancel [Delphi] public Cancel: Boolean; See Also BeforeMouseDownEventArgs Class | BeforeMouseDownEventArgs Members | C1.Win.C1FlexGrid Namespace

BeforeMouseDownEventArgs.Clicks Field
Gets the number of times the mouse button was pressed and released. [Visual Basic] Public ReadOnly Clicks As Integer [C#] public readonly int Clicks [Delphi] public Clicks: Int32; See Also BeforeMouseDownEventArgs Class | BeforeMouseDownEventArgs Members | C1.Win.C1FlexGrid Namespace

BeforeMouseDownEventArgs.Delta Field
Gets a signed count of the number of detents the mouse wheel has rotated. A detent is one notch of the mouse wheel. [Visual Basic] Public ReadOnly Delta As Integer [C#] public readonly int Delta

266 C1.Win.C1FlexGrid Namespace

[Delphi] public Delta: Int32; See Also BeforeMouseDownEventArgs Class | BeforeMouseDownEventArgs Members | C1.Win.C1FlexGrid Namespace

BeforeMouseDownEventArgs.X Field
Gets the x-coordinate of a mouse click. [Visual Basic] Public ReadOnly X As Integer [C#] public readonly int X [Delphi] public X: Int32; See Also BeforeMouseDownEventArgs Class | BeforeMouseDownEventArgs Members | C1.Win.C1FlexGrid Namespace

BeforeMouseDownEventArgs.Y Field
Gets the y-coordinate of a mouse click. [Visual Basic] Public ReadOnly Y As Integer [C#] public readonly int Y [Delphi] public Y: Int32; See Also BeforeMouseDownEventArgs Class | BeforeMouseDownEventArgs Members | C1.Win.C1FlexGrid Namespace

BeforeMouseDownEventHandler Delegate
Represents the method that will handle the C1FlexGridBase.BeforeMouseDown event. [Visual Basic] Public Delegate Sub BeforeMouseDownEventHandler( _ ByVal sender As Object, _ ByVal e As BeforeMouseDownEventArgs _ )

BorderDirEnum Enumeration 267

[C#] public delegate void BeforeMouseDownEventHandler( object sender, BeforeMouseDownEventArgs e ); [Delphi] type BeforeMouseDownEventHandler = procedure ( sender: Object; e: BeforeMouseDownEventArgs ) of object; Parameters sender Object that fired the event. e BeforeMouseDownEventArgs object that contains the event data. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also C1.Win.C1FlexGrid Namespace

BorderDirEnum Enumeration
Specifies the direction of cell borders. [Visual Basic] Public Enum BorderDirEnum [C#] public enum BorderDirEnum [Delphi] type BorderDirEnum = (Both, Horizontal, Vertical); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Both Horizontal Vertical See Also C1.Win.C1FlexGrid Namespace Description Draw cell borders in both directions. Draw cell borders only in the horizontal direction. Draw cell borders only in the vertical direction.

268 C1.Win.C1FlexGrid Namespace

C1.Win.C1FlexGrid.BorderStyleEnum Enumeration
Specifies the type of cell border to display. [Visual Basic] Public Enum C1.Win.C1FlexGrid.BorderStyleEnum [C#] public enum C1.Win.C1FlexGrid.BorderStyleEnum [Delphi] type C1.Win.C1FlexGrid.BorderStyleEnum = (Dotted, Double, Fillet, Flat, Groove, Inset, None, Raised); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Dotted Double Fillet Flat Groove Inset None Raised See Also C1.Win.C1FlexGrid Namespace Description Dotted border. Double border. Fillet border. Solid flat border. Groove border. Inset border. No border. Raised border.

C1FlexGrid Class
The C1FlexGrid control is a powerful, full-featured grid. C1FlexGrid provides advanced features such as outline trees, cell merging, masked editing, translated combo and image lists, owner-draw cells, and automatic data aggregation. For a list of all members of this type, see C1FlexGrid Members.

C1FlexGrid Members 269

System.Object System.MarshalByRefObject System.ComponentModel.Component System.Windows.Forms.Control C1.Win.C1FlexGrid.Util.BaseControls.ScrollableControl C1.Win.C1FlexGrid.C1FlexGridBase C1.Win.C1FlexGrid.C1FlexGrid C1.Win.C1FlexGrid.Classic.C1FlexGridClassic [Visual Basic] Public Class C1FlexGrid Inherits C1FlexGridBase [C#] public class C1FlexGrid : C1FlexGridBase [Delphi] type C1FlexGrid = class (C1FlexGridBase); Remarks C1FlexGrid can be used in bound mode, where it displays data from .NET data sources, or in unbound mode, where the grid itself manages the data. You can use C1FlexGrid to read and write Excel files (.xls), or read and write grid contents to and from XML files. Classes derived from C1FlexGrid should have a LicenseProvider attribute so Visual Studio will embed the appropriate licensing information into projects that use the derived control. For example: [LicenseProvider(typeof(LicenseProvider))] public class MyGrid : C1FlexGrid { // implementation } Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also C1FlexGrid Members | C1.Win.C1FlexGrid Namespace

C1FlexGrid Members
C1FlexGrid overview Public Constructors C1FlexGrid Constructor Creates a new instance of the C1FlexGrid control.

270 C1.Win.C1FlexGrid Namespace

Public Properties AllowAddNew (inherited from C1FlexGridBase) AllowDelete (inherited from C1FlexGridBase) AllowDragging (inherited from C1FlexGridBase) AllowEditing (inherited from C1FlexGridBase) AllowFreezing (inherited from C1FlexGridBase) AllowMerging AllowResizing (inherited from C1FlexGridBase) AllowSorting (inherited from C1FlexGridBase) AutoClipboard (inherited from C1FlexGridBase) Gets or sets whether the grid should display a new row template after the last data row. Gets or sets whether the grid should monitor the keyboard and handle the DEL key. Gets or sets whether the user is allowed to drag rows and columns with the mouse. Gets or sets whether the user is allowed to edit grid contents. Gets or sets whether the user is allowed to freeze rows and columns with the mouse. Specifies whether cells with the same contents should be merged. Gets or sets whether the user is allowed to resize rows and columns with the mouse. Gets or sets whether the user is allowed to sort columns using the mouse. Gets or sets whether the grid should handle the clipboard keys and automatically perform cut, copy, paste, and delete operations. Gets or sets whether columns are automatically created when the grid is bound to a data source. Gets or sets whether column widths are automatically adjusted when data is loaded. Gets or sets whether the grid should move the cursor searching for entries as the user types. Gets or sets the delay (in seconds) before the AutoSearch buffer is reset. Gets or sets the background color for the control. Gets or sets the type of border around the control. Gets the last visible row in the scrollable area. Gets or sets the image to be used in cell buttons. Gets or sets the contents of the selected range. Gets or sets the characters used as row and column separators in clip strings. Gets or sets the column that contains the cursor. Gets the collection of Column objects in the grid. Gets or sets the last column in the current selection. Gets a ComboBoxEditor object that provides easy access to properties of the currently active ComboBox editor. Gets or sets the list of items to be used by the dropdown editor.

AutoGenerateColumns (inherited from C1FlexGridBase) AutoResize (inherited from C1FlexGridBase) AutoSearch (inherited from C1FlexGridBase) AutoSearchDelay (inherited from C1FlexGridBase) BackColor (inherited from C1FlexGridBase) BorderStyle (inherited from ScrollableControl) BottomRow (inherited from C1FlexGridBase) CellButtonImage (inherited from C1FlexGridBase) Clip (inherited from C1FlexGridBase) ClipSeparators (inherited from C1FlexGridBase) Col (inherited from C1FlexGridBase) Cols (inherited from C1FlexGridBase) ColSel (inherited from C1FlexGridBase) ComboBoxEditor (inherited from C1FlexGridBase)

ComboList (inherited from C1FlexGridBase)

C1FlexGrid Members 271

CursorCell (inherited from C1FlexGridBase) CustomComparer (inherited from C1FlexGridBase)

Gets a CellRange object that contains the cell at coordinates Row, Col. Gets or sets a custom comparer object used by the grid to perform grouping, merging, and searching operations. Gets or sets the specific list in a DataSource object that the grid should display. Gets or sets the data source for the grid. Gets or sets whether the control should use an offscreen buffer when painting to reduce flicker. Gets or sets a value that determines if the user can drag data from the control. Gets or sets whether the control should fire the OwnerDrawCell event. Gets or sets a value that determines if the control can accept data that the user drags onto it. Gets or sets the input mask to use when editing cells. Gets or sets an EditFlags flags that affect the grid's editing behavior. Gets or sets a reference to the cell editor that is currently active. Gets or sets whether the last column should be extended to fill the control. Gets or sets the type of focus rectangle to display. Gets or sets the foreground color for the control. Gets the collection of control glyphs (images used to show sorting, checkboxes, and so on). Gets or sets when to highlight selected cells. Gets or sets the action to be performed when the user presses the ENTER key. Gets or sets the action to be performed when the user presses the TAB key. Gets or sets the first visible column in the scrollable area. Gets the CellRangeCollection that determines which grid cells are merged when the AllowMerging property is set to AllowMergingEnum.Custom. Gets the index of the column under the cursor. Gets the index of the row under the cursor. Gets a GridPrinter object that specifies printing parameters for the grid. Gets or sets whether the grid should paint its contents.

DataMember (inherited from C1FlexGridBase) DataSource (inherited from C1FlexGridBase) DoubleBuffer (inherited from C1FlexGridBase) DragMode (inherited from C1FlexGridBase) DrawMode (inherited from C1FlexGridBase) DropMode (inherited from C1FlexGridBase) EditMask (inherited from C1FlexGridBase) EditOptions (inherited from C1FlexGridBase) Editor (inherited from C1FlexGridBase) ExtendLastCol (inherited from C1FlexGridBase) FocusRect (inherited from C1FlexGridBase) ForeColor (inherited from C1FlexGridBase) Glyphs (inherited from C1FlexGridBase) HighLight (inherited from C1FlexGridBase) KeyActionEnter (inherited from C1FlexGridBase) KeyActionTab (inherited from C1FlexGridBase) LeftCol (inherited from C1FlexGridBase) MergedRanges

MouseCol (inherited from C1FlexGridBase) MouseRow (inherited from C1FlexGridBase) PrintParameters (inherited from C1FlexGridBase) Redraw (inherited from C1FlexGridBase)

272 C1.Win.C1FlexGrid Namespace

RightCol (inherited from C1FlexGridBase) Row (inherited from C1FlexGridBase) Rows (inherited from C1FlexGridBase) RowSel (inherited from C1FlexGridBase) ScrollableRectangle (inherited from C1FlexGridBase) ScrollBars (inherited from ScrollableControl) ScrollBarsVisible (inherited from ScrollableControl) ScrollOptions (inherited from C1FlexGridBase) ScrollPosition (inherited from ScrollableControl) Selection (inherited from C1FlexGridBase) SelectionMode (inherited from C1FlexGridBase) ShowButtons (inherited from C1FlexGridBase) ShowCellLabels (inherited from C1FlexGridBase) ShowCursor (inherited from C1FlexGridBase) ShowErrors (inherited from C1FlexGridBase) ShowSort (inherited from C1FlexGridBase) ShowThemedHeaders (inherited from C1FlexGridBase) SortColumn (inherited from C1FlexGridBase) Styles (inherited from C1FlexGridBase) SubtotalPosition (inherited from C1FlexGridBase) TopRow (inherited from C1FlexGridBase) Tree (inherited from C1FlexGridBase) UseCompatibleTextRendering (inherited from C1FlexGridBase) Item (inherited from C1FlexGridBase) Public Methods BeginInit (inherited from C1FlexGridBase) Clear (inherited from C1FlexGridBase) CreateImage (inherited from C1FlexGridBase)

Gets the last visible column in the scrollable area. Gets or sets the row that contains the cursor. Gets the collection of Row objects in the grid. Gets or sets the last row in the current selection. Gets a rectangle that defines the scrollable portion of the control. Gets or sets which scroll bars should appear on the control. Gets a ScrollBars value that indicates which scrollbars are currently visible. Gets or sets a ScrollFlags value that specifies the grid scrolling behavior. Gets or sets the location of the auto-scroll position. Gets the selected range in normalized form. Gets or sets the grid's selection behavior. Gets or sets when to display combo buttons in cells. Gets or sets whether the grid should display labels over cells whose contents are partially hidden. Gets or sets whether the grid should display a DB-style cursor on the first fixed column. Gets or sets whether the grid should display error information in cells and rows. Gets or sets whether the grid should display sorting glyphs (a triangle) on the headers of sorted columns. Gets or sets whether the control should use Xp themes for displaying row or column headers. Gets a reference to the column that defines the current sort applied to the grid. Gets the collection of cell styles defined in the grid. Gets or sets whether node rows appear above or below the data. Gets or sets the first visible row in the scrollable area. Gets a reference to the GridTree object that controls the appearance of the outline tree in the grid. Specifies whether text rendering should be compatible with previouse releases of WinForms.

Signals the object that initialization is starting. Overloaded. Clears the grid. Overloaded. Creates an image of the entire grid.

C1FlexGrid Members 273

EndInit (inherited from C1FlexGridBase) FinishEditing (inherited from C1FlexGridBase) GetMergedRange HitTest (inherited from C1FlexGridBase) Invalidate IsCellCheckBox (inherited from C1FlexGridBase) IsCellCursor IsCellHighlighted IsCellSelected (inherited from C1FlexGridBase) RemoveItem (inherited from C1FlexGridBase) LoadExcel (inherited from C1FlexGridBase) AutoSizeCols (inherited from C1FlexGridBase) StartEditing (inherited from C1FlexGridBase) SaveExcel (inherited from C1FlexGridBase) AutoSizeRows (inherited from C1FlexGridBase) GetDataDisplay (inherited from C1FlexGridBase) Subtotal (inherited from C1FlexGridBase) Public Events AfterAddRow (inherited from C1FlexGridBase) AfterCollapse (inherited from C1FlexGridBase) AfterDataRefresh (inherited from C1FlexGridBase) AfterDeleteRow (inherited from C1FlexGridBase) AfterDragColumn (inherited from C1FlexGridBase) AfterDragRow (inherited from C1FlexGridBase) AfterEdit (inherited from C1FlexGridBase) AfterFreezeColumn (inherited from C1FlexGridBase) AfterFreezeRow (inherited from C1FlexGridBase)

Signals the object that initialization is complete. Overloaded. Finishes editing the current cell and takes the grid out of edit mode. Overloaded. Returns the merged range of cells that includes a given cell. Overloaded. Returns information about the control at the current mouse position. Overloaded. Overridden. Invalidates a cell range, causing it to be repainted. Gets a value that determines whether the cell contents are displayed as a checkbox. Overridden. Gets a value that determines if a cell contains the grid cursor. Overridden. Gets a value that determines if a cell is part of the selection and should be highlighted. Gets a value that determines if a cell is selected. Overloaded. Removes the last row from the grid. Loads the grid from the first worksheet in a Microsoft Excel (.xls) file. Adjusts the width of all columns to fit the data. Overloaded. Puts the grid in edit mode and starts editing the current cell. Saves the grid contents to a Microsoft Excel (.xls) file. Adjusts the height of all rows to fit the data. Gets the value in a grid cell, formatted as a string, and the image or checkbox in the cell. Groups rows based on cell contents and calculates aggregate values. Fires after a new row is added by the user. Fires after a node row is collapsed or expanded. Fires after any data source change notifications. Fires after one or more rows are deleted by the user. Fires after the user finishes dragging a column. Fires after the user finishes dragging a row. Fires after a cell has been edited. Fires after columns are frozen by dragging the frozen column divider. Fires after rows are frozen by dragging the frozen row divider.

274 C1.Win.C1FlexGrid Namespace

AfterResizeColumn (inherited from C1FlexGridBase) AfterResizeRow (inherited from C1FlexGridBase) AfterRowColChange (inherited from C1FlexGridBase) AfterScroll (inherited from C1FlexGridBase) AfterSelChange (inherited from C1FlexGridBase) AfterSort (inherited from C1FlexGridBase) BeforeAddRow (inherited from C1FlexGridBase) BeforeAutosizeColumn (inherited from C1FlexGridBase) BeforeAutosizeRow (inherited from C1FlexGridBase) BeforeCollapse (inherited from C1FlexGridBase) BeforeDeleteRow (inherited from C1FlexGridBase) BeforeDoubleClick (inherited from C1FlexGridBase) BeforeDragColumn (inherited from C1FlexGridBase) BeforeDragRow (inherited from C1FlexGridBase) BeforeEdit (inherited from C1FlexGridBase) BeforeFreezeColumn (inherited from C1FlexGridBase) BeforeFreezeRow (inherited from C1FlexGridBase) BeforeMouseDown (inherited from C1FlexGridBase) BeforePageBreak (inherited from C1FlexGridBase) BeforeResizeColumn (inherited from C1FlexGridBase) BeforeResizeRow (inherited from C1FlexGridBase) BeforeRowColChange (inherited from C1FlexGridBase) BeforeScroll (inherited from C1FlexGridBase) BeforeSelChange (inherited from C1FlexGridBase) BeforeSort (inherited from C1FlexGridBase)

Fires after a column is resized by dragging the column header. Fires after a row is resized by dragging the row header. Fires after the current cell changes ( Row and Col properties). Fires after the grid scrolls. Fires after the selection changes ( Row, Col, RowSel, ColSel properties). Fires after a column is sorted by a click on a column header. Fires before a new row is added by the user. Fires before a column is automatically resized by a double-click on a column header. Fires before a row is automatically resized by a doubleclick on a row header. Fires before a node row is collapsed or expanded. Fires before a row is deleted by the user. Fires before the DoubleClick event is handled by the grid. Fires before the user starts dragging a column. Fires before the user starts dragging a row. Fires before the grid enters edit mode, and also when the cell that has the focus needs to be painted. Fires before columns are frozen by dragging the frozen column divider. Fires before rows are frozen by dragging the frozen row divider. Fires before the MouseDown event is handled by the grid. Fires while the control is being printed to provide control over page breaks. Fires before a column is resized by dragging the column header. Fires before a row is resized by dragging the row header. Fires before the current cell changes ( Row and Col properties). Fires before the grid scrolls. Fires before the selection changes ( Row, Col, RowSel, ColSel properties). Fires before a column is sorted by a click on a column header.

C1FlexGrid Members 275

BeginPrint (inherited from C1FlexGridBase) CancelAddRow (inherited from C1FlexGridBase) CellButtonClick (inherited from C1FlexGridBase) CellChanged (inherited from C1FlexGridBase) ChangeEdit (inherited from C1FlexGridBase) ComboCloseUp (inherited from C1FlexGridBase) ComboDropDown (inherited from C1FlexGridBase) EndPrint (inherited from C1FlexGridBase) EnterCell (inherited from C1FlexGridBase) GetCellErrorInfo (inherited from C1FlexGridBase) GetRowErrorInfo (inherited from C1FlexGridBase) GetUnboundValue (inherited from C1FlexGridBase) GridChanged (inherited from C1FlexGridBase) GridError (inherited from C1FlexGridBase) KeyDownEdit (inherited from C1FlexGridBase) KeyPressEdit (inherited from C1FlexGridBase) KeyUpEdit (inherited from C1FlexGridBase) LeaveCell (inherited from C1FlexGridBase) LeaveEdit (inherited from C1FlexGridBase) MouseHoverCell (inherited from C1FlexGridBase) OwnerDrawCell (inherited from C1FlexGridBase) PrintPage (inherited from C1FlexGridBase) RowColChange (inherited from C1FlexGridBase) SelChange (inherited from C1FlexGridBase) SetUnboundValue (inherited from C1FlexGridBase) SetupEditor (inherited from C1FlexGridBase)

Fires before the grid starts printing. Fires when the cursor leaves the new row without making any changes to it. Fires after the user clicks a cell button. Fires after the contents of a cell have changed. Fires in edit mode, after the contents of the editor change. Fires in edit mode, when the dropdown portion of an editor closes. Fires in edit mode, when the dropdown portion of an editor opens. Fires after the grid finishes printing. Fires after the current cell changes ( Row and Col properties). Fires when ShowErrors is set to true and the control needs error information for a cell. Fires when ShowErrors is set to true and the control needs error information for a row. Fires when the grid needs to retrieve data for an unbound cell. Fires when the grid or its contents change. Fires after the data source reports an error condition. Fires in edit mode, when the user presses a key. Fires in edit mode, when the user presses a character key. Fires in edit mode, when the user releases a key. Fires before the current cell changes ( Row and Col properties). Fires after the control leaves edit mode. Fires when the mouse enters or leaves a cell. Fires before the grid draws a cell, when the DrawMode property is set to DrawModeEnum.OwnerDraw. Fires after the grid finishes printing a page. Fires after the current cell changes ( Row and Col properties). Fires after the selection changes ( Row, Col, RowSel, ColSel properties). Fires when the grid needs to store data in an unbound cell. Fires after a cell editor has been initialized by the grid, to allow additional custom initialization.

276 C1.Win.C1FlexGrid Namespace

ShowScrollTip (inherited from C1FlexGridBase) StartDrag (inherited from C1FlexGridBase) StartEdit (inherited from C1FlexGridBase) ValidateEdit (inherited from C1FlexGridBase) Protected Methods CreateAccessibilityInstance (inherited from C1FlexGridBase) DrawCell DrawRow GetHeaderThemeState OnChangeScrollBarPosition (inherited from C1FlexGridBase) OnImeStartComposition (inherited from ScrollableControl) OnScroll OnThemeChanged (inherited from C1FlexGridBase) See Also C1FlexGrid Class | C1.Win.C1FlexGrid Namespace

Fires before the vertical scrolltip is displayed. Fires before the grid starts an automatic OLE drag operation. Fires before the control enters edit mode. Fires before the control exits cell edit mode, while the editor is still active. Creates a new accessibility object for the control. Overridden. Draws a grid cell. Overridden. Draws a grid row. Overridden. Gets the state for a Windows XP theme while the mouse moves over a cell. Calculates the new position of a scrollbar in response to a user command. Called when the control receives a WM_IME_STARTCOMPOSITION message. Overridden. Called when the grid contents scroll. Called when the control receives a WM_THEMECHANGED message.

C1FlexGrid Constructor
Creates a new instance of the C1FlexGrid control. [Visual Basic] Public Function New() [C#] public C1FlexGrid() [Delphi] public constructor Create(); See Also C1FlexGrid Class | C1FlexGrid Members | C1.Win.C1FlexGrid Namespace

C1FlexGrid Properties
The properties of the C1FlexGrid class are listed here. For a complete list of C1FlexGrid class members, see the C1FlexGrid Members topic.

C1FlexGrid Properties 277

Public Properties AllowAddNew (inherited from C1FlexGridBase) AllowDelete (inherited from C1FlexGridBase) AllowDragging (inherited from C1FlexGridBase) AllowEditing (inherited from C1FlexGridBase) AllowFreezing (inherited from C1FlexGridBase) AllowMerging AllowResizing (inherited from C1FlexGridBase) AllowSorting (inherited from C1FlexGridBase) AutoClipboard (inherited from C1FlexGridBase) Gets or sets whether the grid should display a new row template after the last data row. Gets or sets whether the grid should monitor the keyboard and handle the DEL key. Gets or sets whether the user is allowed to drag rows and columns with the mouse. Gets or sets whether the user is allowed to edit grid contents. Gets or sets whether the user is allowed to freeze rows and columns with the mouse. Specifies whether cells with the same contents should be merged. Gets or sets whether the user is allowed to resize rows and columns with the mouse. Gets or sets whether the user is allowed to sort columns using the mouse. Gets or sets whether the grid should handle the clipboard keys and automatically perform cut, copy, paste, and delete operations. Gets or sets whether columns are automatically created when the grid is bound to a data source. Gets or sets whether column widths are automatically adjusted when data is loaded. Gets or sets whether the grid should move the cursor searching for entries as the user types. Gets or sets the delay (in seconds) before the AutoSearch buffer is reset. Gets or sets the background color for the control. Gets or sets the type of border around the control. Gets the last visible row in the scrollable area. Gets or sets the image to be used in cell buttons. Gets or sets the contents of the selected range. Gets or sets the characters used as row and column separators in clip strings. Gets or sets the column that contains the cursor. Gets the collection of Column objects in the grid. Gets or sets the last column in the current selection. Gets a ComboBoxEditor object that provides easy access to properties of the currently active ComboBox editor. Gets or sets the list of items to be used by the dropdown editor.

AutoGenerateColumns (inherited from C1FlexGridBase) AutoResize (inherited from C1FlexGridBase) AutoSearch (inherited from C1FlexGridBase) AutoSearchDelay (inherited from C1FlexGridBase) BackColor (inherited from C1FlexGridBase) BorderStyle (inherited from ScrollableControl) BottomRow (inherited from C1FlexGridBase) CellButtonImage (inherited from C1FlexGridBase) Clip (inherited from C1FlexGridBase) ClipSeparators (inherited from C1FlexGridBase) Col (inherited from C1FlexGridBase) Cols (inherited from C1FlexGridBase) ColSel (inherited from C1FlexGridBase) ComboBoxEditor (inherited from C1FlexGridBase)

ComboList (inherited from C1FlexGridBase)

278 C1.Win.C1FlexGrid Namespace

CursorCell (inherited from C1FlexGridBase) CustomComparer (inherited from C1FlexGridBase)

Gets a CellRange object that contains the cell at coordinates Row, Col. Gets or sets a custom comparer object used by the grid to perform grouping, merging, and searching operations. Gets or sets the specific list in a DataSource object that the grid should display. Gets or sets the data source for the grid. Gets or sets whether the control should use an offscreen buffer when painting to reduce flicker. Gets or sets a value that determines if the user can drag data from the control. Gets or sets whether the control should fire the OwnerDrawCell event. Gets or sets a value that determines if the control can accept data that the user drags onto it. Gets or sets the input mask to use when editing cells. Gets or sets an EditFlags flags that affect the grid's editing behavior. Gets or sets a reference to the cell editor that is currently active. Gets or sets whether the last column should be extended to fill the control. Gets or sets the type of focus rectangle to display. Gets or sets the foreground color for the control. Gets the collection of control glyphs (images used to show sorting, checkboxes, and so on). Gets or sets when to highlight selected cells. Gets or sets the action to be performed when the user presses the ENTER key. Gets or sets the action to be performed when the user presses the TAB key. Gets or sets the first visible column in the scrollable area. Gets the CellRangeCollection that determines which grid cells are merged when the AllowMerging property is set to AllowMergingEnum.Custom. Gets the index of the column under the cursor. Gets the index of the row under the cursor. Gets a GridPrinter object that specifies printing parameters for the grid. Gets or sets whether the grid should paint its contents.

DataMember (inherited from C1FlexGridBase) DataSource (inherited from C1FlexGridBase) DoubleBuffer (inherited from C1FlexGridBase) DragMode (inherited from C1FlexGridBase) DrawMode (inherited from C1FlexGridBase) DropMode (inherited from C1FlexGridBase) EditMask (inherited from C1FlexGridBase) EditOptions (inherited from C1FlexGridBase) Editor (inherited from C1FlexGridBase) ExtendLastCol (inherited from C1FlexGridBase) FocusRect (inherited from C1FlexGridBase) ForeColor (inherited from C1FlexGridBase) Glyphs (inherited from C1FlexGridBase) HighLight (inherited from C1FlexGridBase) KeyActionEnter (inherited from C1FlexGridBase) KeyActionTab (inherited from C1FlexGridBase) LeftCol (inherited from C1FlexGridBase) MergedRanges

MouseCol (inherited from C1FlexGridBase) MouseRow (inherited from C1FlexGridBase) PrintParameters (inherited from C1FlexGridBase) Redraw (inherited from C1FlexGridBase)

C1FlexGrid Properties 279

RightCol (inherited from C1FlexGridBase) Row (inherited from C1FlexGridBase) Rows (inherited from C1FlexGridBase) RowSel (inherited from C1FlexGridBase) ScrollableRectangle (inherited from C1FlexGridBase) ScrollBars (inherited from ScrollableControl) ScrollBarsVisible (inherited from ScrollableControl) ScrollOptions (inherited from C1FlexGridBase) ScrollPosition (inherited from ScrollableControl) Selection (inherited from C1FlexGridBase) SelectionMode (inherited from C1FlexGridBase) ShowButtons (inherited from C1FlexGridBase) ShowCellLabels (inherited from C1FlexGridBase) ShowCursor (inherited from C1FlexGridBase) ShowErrors (inherited from C1FlexGridBase) ShowSort (inherited from C1FlexGridBase) ShowThemedHeaders (inherited from C1FlexGridBase) SortColumn (inherited from C1FlexGridBase) Styles (inherited from C1FlexGridBase) SubtotalPosition (inherited from C1FlexGridBase) TopRow (inherited from C1FlexGridBase) Tree (inherited from C1FlexGridBase) UseCompatibleTextRendering (inherited from C1FlexGridBase) Item (inherited from C1FlexGridBase) See Also C1FlexGrid Class | C1.Win.C1FlexGrid Namespace

Gets the last visible column in the scrollable area. Gets or sets the row that contains the cursor. Gets the collection of Row objects in the grid. Gets or sets the last row in the current selection. Gets a rectangle that defines the scrollable portion of the control. Gets or sets which scroll bars should appear on the control. Gets a ScrollBars value that indicates which scrollbars are currently visible. Gets or sets a ScrollFlags value that specifies the grid scrolling behavior. Gets or sets the location of the auto-scroll position. Gets the selected range in normalized form. Gets or sets the grid's selection behavior. Gets or sets when to display combo buttons in cells. Gets or sets whether the grid should display labels over cells whose contents are partially hidden. Gets or sets whether the grid should display a DB-style cursor on the first fixed column. Gets or sets whether the grid should display error information in cells and rows. Gets or sets whether the grid should display sorting glyphs (a triangle) on the headers of sorted columns. Gets or sets whether the control should use Xp themes for displaying row or column headers. Gets a reference to the column that defines the current sort applied to the grid. Gets the collection of cell styles defined in the grid. Gets or sets whether node rows appear above or below the data. Gets or sets the first visible row in the scrollable area. Gets a reference to the GridTree object that controls the appearance of the outline tree in the grid. Specifies whether text rendering should be compatible with previouse releases of WinForms.

280 C1.Win.C1FlexGrid Namespace

C1FlexGrid.AllowMerging Property
Specifies whether cells with the same contents should be merged. [Visual Basic] Public Property AllowMerging As AllowMergingEnum [C#] public AllowMergingEnum AllowMerging {get;set;} [Delphi] public property AllowMerging: AllowMergingEnum read get_AllowMerging write set_AllowMerging; Remarks Merging cells allows you to display data in a clear, appealing way, because it highlights groups of identical information. It also gives you flexibility to build tables similar to the ones you can create in HTML or using Microsoft Word, both of which support merged cells. To create tables with merged cells, set the AllowMerging property to a value other than AllowMergingEnum.None, and set the RowCol.AllowMerging property of individual rows and columns true for the rows and columns you wish to merge. After these properties are set, the grid will automatically merge adjacent cells that have the same contents. Whenever the cell contents change, the grid updates the merging state. Example The code below causes the grid to merge cells with the same data in column 1: Visual Basic flex.AllowMerging = AllowMergingEnum.Free flex.Cols(1).AllowMerging = True ' merge values in column 1 C# flex.AllowMerging = AllowMergingEnum.Free; flex.Cols[1].AllowMerging = true; // merge values in column 1 Delphi flex.AllowMerging := AllowMergingEnum.Free; flex.Cols[1].AllowMerging := true; // merge values in column 1

See Also C1FlexGrid Class | C1FlexGrid Members | C1.Win.C1FlexGrid Namespace

C1FlexGrid.MergedRanges Property
Gets the CellRangeCollection that determines which grid cells are merged when the AllowMerging property is set to AllowMergingEnum.Custom. [Visual Basic] Public ReadOnly Property MergedRanges As CellRangeCollection [C#] public CellRangeCollection MergedRanges {get;}

C1FlexGrid Methods 281

[Delphi] public property MergedRanges: CellRangeCollection read get_MergedRanges; See Also C1FlexGrid Class | C1FlexGrid Members | C1.Win.C1FlexGrid Namespace

C1FlexGrid Methods
The methods of the C1FlexGrid class are listed here. For a complete list of C1FlexGrid class members, see the C1FlexGrid Members topic. Public Methods BeginInit (inherited from C1FlexGridBase) Clear (inherited from C1FlexGridBase) CreateImage (inherited from C1FlexGridBase) EndInit (inherited from C1FlexGridBase) FinishEditing (inherited from C1FlexGridBase) GetMergedRange HitTest (inherited from C1FlexGridBase) Invalidate IsCellCheckBox (inherited from C1FlexGridBase) IsCellCursor IsCellHighlighted IsCellSelected (inherited from C1FlexGridBase) RemoveItem (inherited from C1FlexGridBase) LoadExcel (inherited from C1FlexGridBase) AutoSizeCols (inherited from C1FlexGridBase) StartEditing (inherited from C1FlexGridBase) SaveExcel (inherited from C1FlexGridBase) AutoSizeRows (inherited from C1FlexGridBase) GetDataDisplay (inherited from C1FlexGridBase) Subtotal (inherited from C1FlexGridBase) Signals the object that initialization is starting. Overloaded. Clears the grid. Overloaded. Creates an image of the entire grid. Signals the object that initialization is complete. Overloaded. Finishes editing the current cell and takes the grid out of edit mode. Overloaded. Returns the merged range of cells that includes a given cell. Overloaded. Returns information about the control at the current mouse position. Overloaded. Overridden. Invalidates a cell range, causing it to be repainted. Gets a value that determines whether the cell contents are displayed as a checkbox. Overridden. Gets a value that determines if a cell contains the grid cursor. Overridden. Gets a value that determines if a cell is part of the selection and should be highlighted. Gets a value that determines if a cell is selected. Overloaded. Removes the last row from the grid. Loads the grid from the first worksheet in a Microsoft Excel (.xls) file. Adjusts the width of all columns to fit the data. Overloaded. Puts the grid in edit mode and starts editing the current cell. Saves the grid contents to a Microsoft Excel (.xls) file. Adjusts the height of all rows to fit the data. Gets the value in a grid cell, formatted as a string, and the image or checkbox in the cell. Groups rows based on cell contents and calculates aggregate values.

282 C1.Win.C1FlexGrid Namespace

Protected Methods CreateAccessibilityInstance (inherited from C1FlexGridBase) DrawCell DrawRow GetHeaderThemeState OnChangeScrollBarPosition (inherited from C1FlexGridBase) OnImeStartComposition (inherited from ScrollableControl) OnScroll OnThemeChanged (inherited from C1FlexGridBase) See Also C1FlexGrid Class | C1.Win.C1FlexGrid Namespace Creates a new accessibility object for the control. Overridden. Draws a grid cell. Overridden. Draws a grid row. Overridden. Gets the state for a Windows XP theme while the mouse moves over a cell. Calculates the new position of a scrollbar in response to a user command. Called when the control receives a WM_IME_STARTCOMPOSITION message. Overridden. Called when the grid contents scroll. Called when the control receives a WM_THEMECHANGED message.

C1FlexGrid.DrawCell Method
Draws a grid cell. [Visual Basic] Overrides Protected Function DrawCell( _ ByVal e As PaintEventArgs, _ ByVal row As Integer, _ ByVal col As Integer _ ) As Integer [C#] override protected int DrawCell( PaintEventArgs e, int row, int col ); [Delphi] strict protected function DrawCell( e: PaintEventArgs; row: Int32; col: Int32 ): Int32; override; Parameters e A Windows.Forms.PaintEventArgs that contains a Drawing.Graphics object where the cell will be drawn. row Index of the cell's row.

C1FlexGrid.DrawRow Method 283

col Index of the cell's column. Return Value The index of the last column painted (may be greater than col if columns are merged). Remarks This method is for internal use. It allows inherited classes to customize the grid appearance. See Also C1FlexGrid Class | C1FlexGrid Members | C1.Win.C1FlexGrid Namespace

C1FlexGrid.DrawRow Method
Draws a grid row. [Visual Basic] Overrides Protected Sub DrawRow( _ ByVal e As PaintEventArgs, _ ByVal row As Integer _ ) [C#] override protected void DrawRow( PaintEventArgs e, int row ); [Delphi] strict protected procedure DrawRow( e: PaintEventArgs; row: Int32 ); override; Parameters e A Windows.Forms.PaintEventArgs that contains a Drawing.Graphics object where the row will be drawn. row Index of the row to draw. Remarks This method is for internal use. It allows inherited classes to customize the grid appearance. See Also C1FlexGrid Class | C1FlexGrid Members | C1.Win.C1FlexGrid Namespace

C1FlexGrid.GetHeaderThemeState Method
Gets the state for a Windows XP theme while the mouse moves over a cell.

284 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overrides Protected Function GetHeaderThemeState( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Integer [C#] override protected int GetHeaderThemeState( int row, int col ); [Delphi] strict protected function GetHeaderThemeState( row: Int32; col: Int32 ): Int32; override; Parameters row Row under the mouse. col Column under the mouse. Return Value An integer representing the item state (2 for hot-tracking, 1 for normal). Remarks This method is for internal use. It allows inherited classes to customize the hot-tracking behavior. See Also C1FlexGrid Class | C1FlexGrid Members | C1.Win.C1FlexGrid Namespace

C1FlexGrid.GetMergedRange Method
Overload List Returns the merged range of cells that includes a given cell. [Visual Basic] Overloads Public Function GetMergedRange(Integer, Integer) As CellRange [C#] public CellRange GetMergedRange(int, int); [Delphi] public function GetMergedRange(Int32; Int32) : CellRange; overload; Returns the merged range of cells that includes a given cell. [Visual Basic] Overloads Overridable Public Function GetMergedRange(Integer, Integer, Boolean) As CellRange [C#] virtual public CellRange GetMergedRange(int, int, bool); [Delphi] public function GetMergedRange(Int32; Int32; Boolean) : CellRange; overload; virtual; See Also C1FlexGrid Class | C1FlexGrid Members | C1.Win.C1FlexGrid Namespace

C1FlexGrid.GetMergedRange Method 285

C1FlexGrid.GetMergedRange Method (Int32, Int32)


Returns the merged range of cells that includes a given cell. [Visual Basic] Overloads Public Function GetMergedRange( _ ByVal row As Integer, _ ByVal col As Integer _ ) As CellRange [C#] public CellRange GetMergedRange( int row, int col ); [Delphi] public function GetMergedRange( row: Int32; col: Int32 ): CellRange; overload; Parameters row Row index. col Column index. Return Value A CellRange object that contains the given cell. Remarks This method returns the entire range, including invisible cells. See Also C1FlexGrid Class | C1FlexGrid Members | C1.Win.C1FlexGrid Namespace | C1FlexGrid.GetMergedRange Overload List

C1FlexGrid.GetMergedRange Method (Int32, Int32, Boolean)


Returns the merged range of cells that includes a given cell. [Visual Basic] Overloads Overridable Public Function GetMergedRange( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal clip As Boolean _ ) As CellRange

286 C1.Win.C1FlexGrid Namespace

[C#] virtual public CellRange GetMergedRange( int row, int col, bool clip ); [Delphi] public function GetMergedRange( row: Int32; col: Int32; clip: Boolean ): CellRange; overload; virtual; Parameters row Row index. col Column index. clip Whether the range should be clipped to the visible area of the grid. Return Value A CellRange object that contains the given cell. Remarks Cell merging is controlled by the AllowMerging property. The GetMergedRange method allows you to determine whether a cell is merged with adjacent cells. You can override the GetMergedRange method to implement custom merging logic. If you do this, make sure the merging method is consistent and efficient, since it gets called frequently and affects the grid's appearance and behavior. Example The code below checks the current cell after a selection to see if it is part of a merged range: Visual Basic Private Sub _flex_SelChange(sender As Object, e As System.EventArgs) Dim rg As CellRange = Me._flex.GetMergedRange(_flex.Row, _flex.Col, False) If Not rg.IsSingleCell Then Console.WriteLine("selection is merged: {0},{1}-{2},{3}", rg.TopRow, rg.LeftCol, rg.BottomRow, rg.RightCol) End If End Sub C# private void _flex_SelChange(object sender, System.EventArgs e) { CellRange rg = this._flex.GetMergedRange(_flex.Row, _flex.Col, false); if (!rg.IsSingleCell) { Console.WriteLine("selection is merged: {0},{1}-{2},{3}",

C1FlexGrid.GetMergedRange Method 287

rg.TopRow, rg.LeftCol, rg.BottomRow, rg.RightCol); } } Delphi procedure _flex_SelChange(sender: object; e: System.EventArgs); var rg := Self._flex.GetMergedRange(_flex.Row, _flex.Col, False); begin if (rg.IsSingleCell = False) then Console.WriteLine('selection is merged: {0},{1}-{2},{3}', rg.TopRow, rg.LeftCol, rg.BottomRow, rg.RightCol); end; Visual Basic Public Class CustomMerge Inherits C1FlexGrid Public Sub New() ' allow free merging by default AllowMerging = AllowMergingEnum.Free Dim r As Integer For r = 0 To Rows.Count - 1 Rows(r).AllowMerging = True Next r Dim c As Integer For c = 0 To Cols.Count - 1 Cols(c).AllowMerging = True Next c End Sub Public Overrides Function GetMergedRange(row As Integer, col As Integer, clip As Boolean) As CellRange ' merge cells in range (1,1)-(3,3) If row >= 1 And row <= 3 And col >= 1 And col <= 3 Then Return GetCellRange(1, 1, 3, 3) End If ' don't merge anything else Return GetCellRange(row, col) End Function 'GetMergedRange End Class C# public class CustomMerge : C1FlexGrid { public CustomMerge() { // allow free merging by default AllowMerging = AllowMergingEnum.Free; for (int r = 0; r < Rows.Count; r++) Rows[r].AllowMerging = true; for (int c = 0; c < Cols.Count; c++) Cols[c].AllowMerging

The code below shows how you can override the GetMergedRange method to provide custom merging:

288 C1.Win.C1FlexGrid Namespace

= true; } override public CellRange GetMergedRange(int row, int col, bool clip) { // merge cells in range (1,1)-(3,3) if (row >= 1 && row <= 3 && col >= 1 && col <= 3) return GetCellRange(1, 1, 3, 3); // don't merge anything else return GetCellRange(row, col); } } Delphi -- N/A

See Also C1FlexGrid Class | C1FlexGrid Members | C1.Win.C1FlexGrid Namespace | C1FlexGrid.GetMergedRange Overload List

C1FlexGrid.Invalidate Method
Invalidates a cell range, causing it to be repainted. [Visual Basic] Overrides Public Sub Invalidate( _ ByVal rg As CellRange _ ) [C#] override public void Invalidate( CellRange rg ); [Delphi] public procedure Invalidate( rg: CellRange ); overload; override; Parameters rg Range to be invalidated. Remarks This method is rarely used by the programmer, since the grid automatically performs invalidation as needed. See Also C1FlexGrid Class | C1FlexGrid Members | C1.Win.C1FlexGrid Namespace

C1FlexGrid.IsCellCursor Method
Gets a value that determines if a cell contains the grid cursor.

C1FlexGrid.IsCellHighlighted Method 289

[Visual Basic] Overrides Public Function IsCellCursor( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Boolean [C#] override public bool IsCellCursor( int row, int col ); [Delphi] public function IsCellCursor( row: Int32; col: Int32 ): Boolean; override; Parameters row Row index. col Column index. Return Value True if the cell contains the cursor, false otherwise. See Also C1FlexGrid Class | C1FlexGrid Members | C1.Win.C1FlexGrid Namespace

C1FlexGrid.IsCellHighlighted Method
Gets a value that determines if a cell is part of the selection and should be highlighted. [Visual Basic] Overrides Public Function IsCellHighlighted( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Boolean [C#] override public bool IsCellHighlighted( int row, int col ); [Delphi] public function IsCellHighlighted( row: Int32; col: Int32 ): Boolean; override;

290 C1.Win.C1FlexGrid Namespace

Parameters row Row index. col Column index. Return Value True if the cell should be highlighted, false otherwise. See Also C1FlexGrid Class | C1FlexGrid Members | C1.Win.C1FlexGrid Namespace

C1FlexGrid.OnScroll Method
Called when the grid contents scroll. [Visual Basic] Overrides Protected Sub OnScroll( _ ByVal sb As ScrollBars _ ) [C#] override protected void OnScroll( ScrollBars sb ); [Delphi] strict protected procedure OnScroll( sb: ScrollBars ); override; Parameters sb Windows.Forms.ScrollBars value that specifies the scroll direction. Remarks This method is for internal use. It allows inherited classes to customize the grid scrolling behavior. See Also C1FlexGrid Class | C1FlexGrid Members | C1.Win.C1FlexGrid Namespace

C1FlexGrid Events
The events of the C1FlexGrid class are listed here. For a complete list of C1FlexGrid class members, see the C1FlexGrid Members topic. Public Events AfterAddRow (inherited from C1FlexGridBase) AfterCollapse (inherited from C1FlexGridBase) AfterDataRefresh (inherited from C1FlexGridBase) AfterDeleteRow (inherited from C1FlexGridBase) Fires after a new row is added by the user. Fires after a node row is collapsed or expanded. Fires after any data source change notifications. Fires after one or more rows are deleted by the user.

C1FlexGrid Events 291

AfterDragColumn (inherited from C1FlexGridBase) AfterDragRow (inherited from C1FlexGridBase) AfterEdit (inherited from C1FlexGridBase) AfterFreezeColumn (inherited from C1FlexGridBase) AfterFreezeRow (inherited from C1FlexGridBase) AfterResizeColumn (inherited from C1FlexGridBase) AfterResizeRow (inherited from C1FlexGridBase) AfterRowColChange (inherited from C1FlexGridBase) AfterScroll (inherited from C1FlexGridBase) AfterSelChange (inherited from C1FlexGridBase) AfterSort (inherited from C1FlexGridBase) BeforeAddRow (inherited from C1FlexGridBase) BeforeAutosizeColumn (inherited from C1FlexGridBase) BeforeAutosizeRow (inherited from C1FlexGridBase) BeforeCollapse (inherited from C1FlexGridBase) BeforeDeleteRow (inherited from C1FlexGridBase) BeforeDoubleClick (inherited from C1FlexGridBase) BeforeDragColumn (inherited from C1FlexGridBase) BeforeDragRow (inherited from C1FlexGridBase) BeforeEdit (inherited from C1FlexGridBase) BeforeFreezeColumn (inherited from C1FlexGridBase) BeforeFreezeRow (inherited from C1FlexGridBase) BeforeMouseDown (inherited from C1FlexGridBase) BeforePageBreak (inherited from C1FlexGridBase) BeforeResizeColumn (inherited from C1FlexGridBase) BeforeResizeRow (inherited from C1FlexGridBase)

Fires after the user finishes dragging a column. Fires after the user finishes dragging a row. Fires after a cell has been edited. Fires after columns are frozen by dragging the frozen column divider. Fires after rows are frozen by dragging the frozen row divider. Fires after a column is resized by dragging the column header. Fires after a row is resized by dragging the row header. Fires after the current cell changes ( Row and Col properties). Fires after the grid scrolls. Fires after the selection changes ( Row, Col, RowSel, ColSel properties). Fires after a column is sorted by a click on a column header. Fires before a new row is added by the user. Fires before a column is automatically resized by a double-click on a column header. Fires before a row is automatically resized by a doubleclick on a row header. Fires before a node row is collapsed or expanded. Fires before a row is deleted by the user. Fires before the DoubleClick event is handled by the grid. Fires before the user starts dragging a column. Fires before the user starts dragging a row. Fires before the grid enters edit mode, and also when the cell that has the focus needs to be painted. Fires before columns are frozen by dragging the frozen column divider. Fires before rows are frozen by dragging the frozen row divider. Fires before the MouseDown event is handled by the grid. Fires while the control is being printed to provide control over page breaks. Fires before a column is resized by dragging the column header. Fires before a row is resized by dragging the row header.

292 C1.Win.C1FlexGrid Namespace

BeforeRowColChange (inherited from C1FlexGridBase) BeforeScroll (inherited from C1FlexGridBase) BeforeSelChange (inherited from C1FlexGridBase) BeforeSort (inherited from C1FlexGridBase) BeginPrint (inherited from C1FlexGridBase) CancelAddRow (inherited from C1FlexGridBase) CellButtonClick (inherited from C1FlexGridBase) CellChanged (inherited from C1FlexGridBase) ChangeEdit (inherited from C1FlexGridBase) ComboCloseUp (inherited from C1FlexGridBase) ComboDropDown (inherited from C1FlexGridBase) EndPrint (inherited from C1FlexGridBase) EnterCell (inherited from C1FlexGridBase) GetCellErrorInfo (inherited from C1FlexGridBase) GetRowErrorInfo (inherited from C1FlexGridBase) GetUnboundValue (inherited from C1FlexGridBase) GridChanged (inherited from C1FlexGridBase) GridError (inherited from C1FlexGridBase) KeyDownEdit (inherited from C1FlexGridBase) KeyPressEdit (inherited from C1FlexGridBase) KeyUpEdit (inherited from C1FlexGridBase) LeaveCell (inherited from C1FlexGridBase) LeaveEdit (inherited from C1FlexGridBase) MouseHoverCell (inherited from C1FlexGridBase) OwnerDrawCell (inherited from C1FlexGridBase) PrintPage (inherited from C1FlexGridBase)

Fires before the current cell changes ( Row and Col properties). Fires before the grid scrolls. Fires before the selection changes ( Row, Col, RowSel, ColSel properties). Fires before a column is sorted by a click on a column header. Fires before the grid starts printing. Fires when the cursor leaves the new row without making any changes to it. Fires after the user clicks a cell button. Fires after the contents of a cell have changed. Fires in edit mode, after the contents of the editor change. Fires in edit mode, when the dropdown portion of an editor closes. Fires in edit mode, when the dropdown portion of an editor opens. Fires after the grid finishes printing. Fires after the current cell changes ( Row and Col properties). Fires when ShowErrors is set to true and the control needs error information for a cell. Fires when ShowErrors is set to true and the control needs error information for a row. Fires when the grid needs to retrieve data for an unbound cell. Fires when the grid or its contents change. Fires after the data source reports an error condition. Fires in edit mode, when the user presses a key. Fires in edit mode, when the user presses a character key. Fires in edit mode, when the user releases a key. Fires before the current cell changes ( Row and Col properties). Fires after the control leaves edit mode. Fires when the mouse enters or leaves a cell. Fires before the grid draws a cell, when the DrawMode property is set to DrawModeEnum.OwnerDraw. Fires after the grid finishes printing a page.

C1FlexGridBase Class 293

RowColChange (inherited from C1FlexGridBase) SelChange (inherited from C1FlexGridBase) SetUnboundValue (inherited from C1FlexGridBase) SetupEditor (inherited from C1FlexGridBase) ShowScrollTip (inherited from C1FlexGridBase) StartDrag (inherited from C1FlexGridBase) StartEdit (inherited from C1FlexGridBase) ValidateEdit (inherited from C1FlexGridBase) See Also C1FlexGrid Class | C1.Win.C1FlexGrid Namespace

Fires after the current cell changes ( Row and Col properties). Fires after the selection changes ( Row, Col, RowSel, ColSel properties). Fires when the grid needs to store data in an unbound cell. Fires after a cell editor has been initialized by the grid, to allow additional custom initialization. Fires before the vertical scrolltip is displayed. Fires before the grid starts an automatic OLE drag operation. Fires before the control enters edit mode. Fires before the control exits cell edit mode, while the editor is still active.

C1FlexGridBase Class
Base class for the C1FlexGrid control. For a list of all members of this type, see C1FlexGridBase Members. System.Object System.MarshalByRefObject System.ComponentModel.Component System.Windows.Forms.Control C1.Win.C1FlexGrid.Util.BaseControls.ScrollableControl C1.Win.C1FlexGrid.C1FlexGridBase C1.Win.C1FlexGrid.C1FlexGrid [Visual Basic] MustInherit Public Class C1FlexGridBase Inherits ScrollableControl Implements ISupportInitialize, j [C#] public abstract class C1FlexGridBase : ScrollableControl , ISupportInitialize, j [Delphi] type C1FlexGridBase = class abstract (ScrollableControl, ISupportInitialize, j); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll)

294 C1.Win.C1FlexGrid Namespace

See Also C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase Members
C1FlexGridBase overview Public Properties AllowAddNew AllowDelete AllowDragging AllowEditing AllowFreezing AllowResizing AllowSorting AutoClipboard Gets or sets whether the grid should display a new row template after the last data row. Gets or sets whether the grid should monitor the keyboard and handle the DEL key. Gets or sets whether the user is allowed to drag rows and columns with the mouse. Gets or sets whether the user is allowed to edit grid contents. Gets or sets whether the user is allowed to freeze rows and columns with the mouse. Gets or sets whether the user is allowed to resize rows and columns with the mouse. Gets or sets whether the user is allowed to sort columns using the mouse. Gets or sets whether the grid should handle the clipboard keys and automatically perform cut, copy, paste, and delete operations. Gets or sets whether columns are automatically created when the grid is bound to a data source. Gets or sets whether column widths are automatically adjusted when data is loaded. Gets or sets whether the grid should move the cursor searching for entries as the user types. Gets or sets the delay (in seconds) before the AutoSearch buffer is reset. Overridden. Gets or sets the background color for the control. Gets or sets the type of border around the control. Gets the last visible row in the scrollable area. Gets or sets the image to be used in cell buttons. Gets or sets the contents of the selected range. Gets or sets the characters used as row and column separators in clip strings. Gets or sets the column that contains the cursor. Gets the collection of Column objects in the grid. Gets or sets the last column in the current selection.

AutoGenerateColumns AutoResize AutoSearch AutoSearchDelay BackColor BorderStyle (inherited from ScrollableControl) BottomRow CellButtonImage Clip ClipSeparators Col Cols ColSel

C1FlexGridBase Members 295

ComboBoxEditor

Gets a ComboBoxEditor object that provides easy access to properties of the currently active ComboBox editor. Gets or sets the list of items to be used by the dropdown editor. Gets a CellRange object that contains the cell at coordinates Row, Col. Gets or sets a custom comparer object used by the grid to perform grouping, merging, and searching operations. Gets or sets the specific list in a DataSource object that the grid should display. Gets or sets the data source for the grid. Gets or sets whether the control should use an offscreen buffer when painting to reduce flicker. Gets or sets a value that determines if the user can drag data from the control. Gets or sets whether the control should fire the OwnerDrawCell event. Gets or sets a value that determines if the control can accept data that the user drags onto it. Gets or sets the input mask to use when editing cells. Gets or sets an EditFlags flags that affect the grid's editing behavior. Gets or sets a reference to the cell editor that is currently active. Gets or sets whether the last column should be extended to fill the control. Gets or sets the type of focus rectangle to display. Overridden. Gets or sets the foreground color for the control. Gets the collection of control glyphs (images used to show sorting, checkboxes, and so on). Gets or sets when to highlight selected cells. Gets or sets the action to be performed when the user presses the ENTER key. Gets or sets the action to be performed when the user presses the TAB key. Gets or sets the first visible column in the scrollable area. Gets the index of the column under the cursor. Gets the index of the row under the cursor.

ComboList CursorCell CustomComparer

DataMember DataSource DoubleBuffer DragMode DrawMode DropMode EditMask EditOptions Editor ExtendLastCol FocusRect ForeColor Glyphs HighLight KeyActionEnter KeyActionTab LeftCol MouseCol MouseRow

296 C1.Win.C1FlexGrid Namespace

PrintParameters Redraw RightCol Row Rows RowSel ScrollableRectangle ScrollBars (inherited from ScrollableControl) ScrollBarsVisible (inherited from ScrollableControl) ScrollOptions Selection SelectionMode ShowButtons ShowCellLabels ShowCursor ShowErrors ShowSort ShowThemedHeaders SortColumn Styles SubtotalPosition TopRow Tree UseCompatibleTextRendering Item Public Methods AddItem

Gets a GridPrinter object that specifies printing parameters for the grid. Gets or sets whether the grid should paint its contents. Gets the last visible column in the scrollable area. Gets or sets the row that contains the cursor. Gets the collection of Row objects in the grid. Gets or sets the last row in the current selection. Overridden. Gets a rectangle that defines the scrollable portion of the control. Gets or sets which scroll bars should appear on the control. Gets a ScrollBars value that indicates which scrollbars are currently visible. Gets or sets a ScrollFlags value that specifies the grid scrolling behavior. Gets the selected range in normalized form. Gets or sets the grid's selection behavior. Gets or sets when to display combo buttons in cells. Gets or sets whether the grid should display labels over cells whose contents are partially hidden. Gets or sets whether the grid should display a DB-style cursor on the first fixed column. Gets or sets whether the grid should display error information in cells and rows. Gets or sets whether the grid should display sorting glyphs (a triangle) on the headers of sorted columns. Gets or sets whether the control should use Xp themes for displaying row or column headers. Gets a reference to the column that defines the current sort applied to the grid. Gets the collection of cell styles defined in the grid. Gets or sets whether node rows appear above or below the data. Gets or sets the first visible row in the scrollable area. Gets a reference to the GridTree object that controls the appearance of the outline tree in the grid. Specifies whether text rendering should be compatible with previouse releases of WinForms.

Overloaded. Adds a row to the grid and populates the new row with data.

C1FlexGridBase Members 297

Aggregate AutoSizeCol AutoSizeCols AutoSizeRow AutoSizeRows BeginInit Clear CreateImage EndInit FindRow FinishEditing GetCellCheck GetCellImage GetCellRange GetCellRect GetCellStyle GetCellStyleDisplay GetData GetDataDisplay GetUserData HitTest Invalidate IsCellCheckBox IsCellCursor IsCellFixed IsCellHighlighted IsCellSelected

Overloaded. Calculates aggregate statistics for the current selection. Overloaded. Adjusts the width of a column to fit the data. Overloaded. Adjusts the width of all columns to fit the data. Adjusts the height of a row to fit the data. Overloaded. Adjusts the height of all rows to fit the data. Signals the object that initialization is starting. Overloaded. Clears the grid. Overloaded. Creates an image of the entire grid. Signals the object that initialization is complete. Overloaded. Finds a row that contains a specified RowCol.UserData value. Overloaded. Finishes editing the current cell and takes the grid out of edit mode. Gets the state of the checkbox in a grid cell. Gets the image displayed in a grid cell. Overloaded. Gets a CellRange object that can be used to format and manipulate a cell. Overloaded. Gets a Drawing.Rectangle object with the coordinates of the cell within the control. Gets a custom CellStyle associated with a cell. Gets the style used to render a cell. Overloaded. Gets the value of a grid cell. Overloaded. Gets the value in a grid cell, formatted as a string. Overloaded. Gets user data associated with a cell. Overloaded. Returns information about the control at the current mouse position. Overloaded. Overridden. Invalidates a cell range, causing it to be repainted. Gets a value that determines whether the cell contents are displayed as a checkbox. Gets a value that determines if a cell contains the grid cursor. Gets a value that determines if a cell belongs to a fixed row or column. Gets a value that determines if a cell is part of the selection and should be highlighted. Gets a value that determines if a cell is selected.

298 C1.Win.C1FlexGrid Namespace

IsCellValid LoadExcel LoadExcelSheetNames LoadGrid PrintGrid ReadXml RemoveItem SaveExcel SaveGrid Select SetCellCheck SetCellImage SetCellStyle SetData SetDataBinding SetUserData ShowCell ShowSortAt Sort StartEditing Subtotal WriteXml Public Events AfterAddRow AfterCollapse AfterDataRefresh AfterDeleteRow AfterDragColumn AfterDragRow

Gets a value that determines if a pair of cell coordinates are valid. Overloaded. Loads the grid from the first worksheet in a Microsoft Excel (.xls) file. Gets a list with the names of the worksheets in a Microsoft Excel (.xls) file. Overloaded. Loads the grid from a file. Overloaded. Prints the grid, optionally showing a page setup or print preview dialog. Overloaded. Loads the grid from an XML document. Overloaded. Removes the last row from the grid. Overloaded. Saves the grid contents to a Microsoft Excel (.xls) file. Overloaded. Saves the grid contents to a file. Overloaded. Selects a range of cells and scrolls it into view. Sets the state of the checkbox in a grid cell. Sets the image displayed in a grid cell. Overloaded. Assigns a custom CellStyle to a cell. Overloaded. Assigns a value to a range of cells, coercing the value into each cell's specified DataType. Overloaded. Sets the DataSource and DataMember properties. Overloaded. Assigns user data to a cell. Scrolls a cell into view. Shows the sorting glyph on a column header. Overloaded. Sorts a range of cells in the grid. Overloaded. Puts the grid in edit mode and starts editing the current cell. Overloaded. Groups rows based on cell contents and calculates aggregate values. Overloaded. Saves the grid contents to an XML document. Fires after a new row is added by the user. Fires after a node row is collapsed or expanded. Fires after any data source change notifications. Fires after one or more rows are deleted by the user. Fires after the user finishes dragging a column. Fires after the user finishes dragging a row.

C1FlexGridBase Members 299

AfterEdit AfterFreezeColumn AfterFreezeRow AfterResizeColumn AfterResizeRow AfterRowColChange AfterScroll AfterSelChange AfterSort BeforeAddRow BeforeAutosizeColumn BeforeAutosizeRow BeforeCollapse BeforeDeleteRow BeforeDoubleClick BeforeDragColumn BeforeDragRow BeforeEdit BeforeFreezeColumn BeforeFreezeRow BeforeMouseDown BeforePageBreak BeforeResizeColumn BeforeResizeRow BeforeRowColChange

Fires after a cell has been edited. Fires after columns are frozen by dragging the frozen column divider. Fires after rows are frozen by dragging the frozen row divider. Fires after a column is resized by dragging the column header. Fires after a row is resized by dragging the row header. Fires after the current cell changes ( Row and Col properties). Fires after the grid scrolls. Fires after the selection changes ( Row, Col, RowSel, ColSel properties). Fires after a column is sorted by a click on a column header. Fires before a new row is added by the user. Fires before a column is automatically resized by a double-click on a column header. Fires before a row is automatically resized by a doubleclick on a row header. Fires before a node row is collapsed or expanded. Fires before a row is deleted by the user. Fires before the DoubleClick event is handled by the grid. Fires before the user starts dragging a column. Fires before the user starts dragging a row. Fires before the grid enters edit mode, and also when the cell that has the focus needs to be painted. Fires before columns are frozen by dragging the frozen column divider. Fires before rows are frozen by dragging the frozen row divider. Fires before the MouseDown event is handled by the grid. Fires while the control is being printed to provide control over page breaks. Fires before a column is resized by dragging the column header. Fires before a row is resized by dragging the row header. Fires before the current cell changes ( Row and Col properties).

300 C1.Win.C1FlexGrid Namespace

BeforeScroll BeforeSelChange BeforeSort BeginPrint CancelAddRow CellButtonClick CellChanged ChangeEdit ComboCloseUp ComboDropDown EndPrint EnterCell GetCellErrorInfo GetRowErrorInfo GetUnboundValue GridChanged GridError KeyDownEdit KeyPressEdit KeyUpEdit LeaveCell LeaveEdit MouseHoverCell OwnerDrawCell PrintPage RowColChange SelChange

Fires before the grid scrolls. Fires before the selection changes ( Row, Col, RowSel, ColSel properties). Fires before a column is sorted by a click on a column header. Fires before the grid starts printing. Fires when the cursor leaves the new row without making any changes to it. Fires after the user clicks a cell button. Fires after the contents of a cell have changed. Fires in edit mode, after the contents of the editor change. Fires in edit mode, when the dropdown portion of an editor closes. Fires in edit mode, when the dropdown portion of an editor opens. Fires after the grid finishes printing. Fires after the current cell changes ( Row and Col properties). Fires when ShowErrors is set to true and the control needs error information for a cell. Fires when ShowErrors is set to true and the control needs error information for a row. Fires when the grid needs to retrieve data for an unbound cell. Fires when the grid or its contents change. Fires after the data source reports an error condition. Fires in edit mode, when the user presses a key. Fires in edit mode, when the user presses a character key. Fires in edit mode, when the user releases a key. Fires before the current cell changes ( Row and Col properties). Fires after the control leaves edit mode. Fires when the mouse enters or leaves a cell. Fires before the grid draws a cell, when the DrawMode property is set to DrawModeEnum.OwnerDraw. Fires after the grid finishes printing a page. Fires after the current cell changes ( Row and Col properties). Fires after the selection changes ( Row, Col, RowSel, ColSel properties).

C1FlexGridBase Members 301

SetUnboundValue SetupEditor ShowScrollTip StartDrag StartEdit ValidateEdit Protected Constructors C1FlexGridBase Constructor Protected Methods BuildScrollableRectangle

Fires when the grid needs to store data in an unbound cell. Fires after a cell editor has been initialized by the grid, to allow additional custom initialization. Fires before the vertical scrolltip is displayed. Fires before the grid starts an automatic OLE drag operation. Fires before the control enters edit mode. Fires before the control exits cell edit mode, while the editor is still active. Initializes a new instance of the C1FlexGridBase class. Overridden. Builds a rectangle that defines the scrollable portion of the control for a given pair of scroll offsets. Overridden. Creates a new accessibility object for the control. Overloaded. Overridden. Releases all resources used by the Control. Draws a grid cell. Draws a grid row. Gets the state for a Windows Xp theme while the mouse moves over a cell. Overridden. Determines if a character is an input character that the control recognizes. Overridden. Determines whether the specified key is a regular input key or a special key that requires preprocessing. Overridden. Raises the BackColorChanged event. Overridden. Raises the BindingContextChanged event. Overridden. Calculates the new position of a scrollbar in response to a user command. Overridden. Raises the DoubleClick event. Overridden. Raises the DragDrop event. Overridden. Raises the DragEnter event. Overridden. Raises the DragOver event. Overridden. Raises the FontChanged event. Overridden. Raises the ForeColorChanged event. Overridden. Raises the GotFocus event. Overridden. Raises the HandleDestroyed event.

CreateAccessibilityInstance Dispose DrawCell DrawRow GetHeaderThemeState IsInputChar IsInputKey

OnBackColorChanged OnBindingContextChanged OnChangeScrollBarPosition OnDoubleClick OnDragDrop OnDragEnter OnDragOver OnFontChanged OnForeColorChanged OnGotFocus OnHandleDestroyed

302 C1.Win.C1FlexGrid Namespace

OnKeyDown OnKeyPress OnLeave OnLostFocus OnMouseDown OnMouseLeave OnMouseMove OnMouseUp OnPaint OnPaintBackground OnScroll OnScrollTip OnSizeChanged OnThemeChanged OnValidating OnVisibleChanged See Also

Overridden. Raises the KeyDown event. Overridden. Raises the KeyPress event. Overridden. Raises the Leave event. Overridden. Raises the LostFocus event. Overridden. Raises the MouseDown event. Overridden. Raises the MouseLeave event. Overridden. Raises the MouseMove event. Overridden. Raises the MouseUp event. Overridden. Raises the Paint event. Overridden. Paints the control background. Overridden. Called when the grid contents scroll. Overridden. Called when the grid contents scroll vertically, to update the value of the scroll tip. Overridden. Raises the SizeChanged event. Overridden. Called when the control receives a WM_THEMECHANGED message. Overridden. Raises the Validating event. Overridden. Raises the VisibleChanged event.

C1FlexGridBase Class | C1.Win.C1FlexGrid Namespace

C1FlexGridBase Constructor
Initializes a new instance of the C1FlexGridBase class. [Visual Basic] Protected Function New() [C#] protected C1FlexGridBase() [Delphi] strict protected constructor Create(); See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase Properties
The properties of the C1FlexGridBase class are listed here. For a complete list of C1FlexGridBase class members, see the C1FlexGridBase Members topic. Public Properties AllowAddNew Gets or sets whether the grid should display a new row template after the last data row.

C1FlexGridBase Properties 303

AllowDelete AllowDragging AllowEditing AllowFreezing AllowResizing AllowSorting AutoClipboard

Gets or sets whether the grid should monitor the keyboard and handle the DEL key. Gets or sets whether the user is allowed to drag rows and columns with the mouse. Gets or sets whether the user is allowed to edit grid contents. Gets or sets whether the user is allowed to freeze rows and columns with the mouse. Gets or sets whether the user is allowed to resize rows and columns with the mouse. Gets or sets whether the user is allowed to sort columns using the mouse. Gets or sets whether the grid should handle the clipboard keys and automatically perform cut, copy, paste, and delete operations. Gets or sets whether columns are automatically created when the grid is bound to a data source. Gets or sets whether column widths are automatically adjusted when data is loaded. Gets or sets whether the grid should move the cursor searching for entries as the user types. Gets or sets the delay (in seconds) before the AutoSearch buffer is reset. Overridden. Gets or sets the background color for the control. Gets or sets the type of border around the control. Gets the last visible row in the scrollable area. Gets or sets the image to be used in cell buttons. Gets or sets the contents of the selected range. Gets or sets the characters used as row and column separators in clip strings. Gets or sets the column that contains the cursor. Gets the collection of Column objects in the grid. Gets or sets the last column in the current selection. Gets a ComboBoxEditor object that provides easy access to properties of the currently active ComboBox editor. Gets or sets the list of items to be used by the dropdown editor. Gets a CellRange object that contains the cell at coordinates Row, Col.

AutoGenerateColumns AutoResize AutoSearch AutoSearchDelay BackColor BorderStyle (inherited from ScrollableControl) BottomRow CellButtonImage Clip ClipSeparators Col Cols ColSel ComboBoxEditor

ComboList CursorCell

304 C1.Win.C1FlexGrid Namespace

CustomComparer

Gets or sets a custom comparer object used by the grid to perform grouping, merging, and searching operations. Gets or sets the specific list in a DataSource object that the grid should display. Gets or sets the data source for the grid. Gets or sets whether the control should use an offscreen buffer when painting to reduce flicker. Gets or sets a value that determines if the user can drag data from the control. Gets or sets whether the control should fire the OwnerDrawCell event. Gets or sets a value that determines if the control can accept data that the user drags onto it. Gets or sets the input mask to use when editing cells. Gets or sets an EditFlags flags that affect the grid's editing behavior. Gets or sets a reference to the cell editor that is currently active. Gets or sets whether the last column should be extended to fill the control. Gets or sets the type of focus rectangle to display. Overridden. Gets or sets the foreground color for the control. Gets the collection of control glyphs (images used to show sorting, checkboxes, and so on). Gets or sets when to highlight selected cells. Gets or sets the action to be performed when the user presses the ENTER key. Gets or sets the action to be performed when the user presses the TAB key. Gets or sets the first visible column in the scrollable area. Gets the index of the column under the cursor. Gets the index of the row under the cursor. Gets a GridPrinter object that specifies printing parameters for the grid. Gets or sets whether the grid should paint its contents. Gets the last visible column in the scrollable area. Gets or sets the row that contains the cursor. Gets the collection of Row objects in the grid. Gets or sets the last row in the current selection.

DataMember DataSource DoubleBuffer DragMode DrawMode DropMode EditMask EditOptions Editor ExtendLastCol FocusRect ForeColor Glyphs HighLight KeyActionEnter KeyActionTab LeftCol MouseCol MouseRow PrintParameters Redraw RightCol Row Rows RowSel

C1FlexGridBase.AllowAddNew Property 305

ScrollableRectangle ScrollBars (inherited from ScrollableControl) ScrollBarsVisible (inherited from ScrollableControl) ScrollOptions Selection SelectionMode ShowButtons ShowCellLabels ShowCursor ShowErrors ShowSort ShowThemedHeaders SortColumn Styles SubtotalPosition TopRow Tree UseCompatibleTextRendering Item See Also

Overridden. Gets a rectangle that defines the scrollable portion of the control. Gets or sets which scroll bars should appear on the control. Gets a ScrollBars value that indicates which scrollbars are currently visible. Gets or sets a ScrollFlags value that specifies the grid scrolling behavior. Gets the selected range in normalized form. Gets or sets the grid's selection behavior. Gets or sets when to display combo buttons in cells. Gets or sets whether the grid should display labels over cells whose contents are partially hidden. Gets or sets whether the grid should display a DB-style cursor on the first fixed column. Gets or sets whether the grid should display error information in cells and rows. Gets or sets whether the grid should display sorting glyphs (a triangle) on the headers of sorted columns. Gets or sets whether the control should use Xp themes for displaying row or column headers. Gets a reference to the column that defines the current sort applied to the grid. Gets the collection of cell styles defined in the grid. Gets or sets whether node rows appear above or below the data. Gets or sets the first visible row in the scrollable area. Gets a reference to the GridTree object that controls the appearance of the outline tree in the grid. Specifies whether text rendering should be compatible with previouse releases of WinForms.

C1FlexGridBase Class | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AllowAddNew Property
Gets or sets whether the grid should display a new row template after the last data row. [Visual Basic] Public Property AllowAddNew As Boolean [C#] public bool AllowAddNew {get;set;}

306 C1.Win.C1FlexGrid Namespace

[Delphi] public property AllowAddNew: Boolean read get_AllowAddNew write set_AllowAddNew; Remarks If the user enters data into the new row template, a new row is automatically added to the grid. This property works in bound mode (if the data source supports adding new rows) and also in unbound mode. Note that if this property is set to true, the Rows.Count property will return a value that includes the new row template. If you set the Rows.Count property, the grid will set the number of data rows and will automatically add the new row template. For example: Visual Basic flex.AllowAddNew = True flex.Rows.Count = 10 Console.WriteLine("Row count is {0}.", _flex.Rows.Count) Row count is 11. C# flex.AllowAddNew = true; flex.Rows.Count = 10; Console.WriteLine("Row count is {0}.", _flex.Rows.Count); Row count is 11. Delphi begin flex.AllowAddNew := True; flex.Rows.Count := 10; Console.WriteLine('Row count is {0}.', _flex.Rows.Count); end; Row count is 11.

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AllowDelete Property
Gets or sets whether the grid should monitor the keyboard and handle the DEL key. [Visual Basic] Public Property AllowDelete As Boolean [C#] public bool AllowDelete {get;set;} [Delphi] public property AllowDelete: Boolean read get_AllowDelete write set_AllowDelete; Remarks If this property is set to true, the user can delete rows by selecting them and then pressing the DEL key. This property works in bound mode (if the data source supports deleting rows) and in unbound mode. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AllowDragging Property 307

C1FlexGridBase.AllowDragging Property
Gets or sets whether the user is allowed to drag rows and columns with the mouse. [Visual Basic] Public Property AllowDragging As AllowDraggingEnum [C#] public AllowDraggingEnum AllowDragging {get;set;} [Delphi] public property AllowDragging: AllowDraggingEnum read get_AllowDragging write set_AllowDragging; Remarks Row dragging may not work in bound mode. This is because some data sources do not allow absolute positioning of rows. ADO.NET DataTable object in particular do not support this. Column dragging is supported for any data source, and row dragging is always supported in unbound mode. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AllowEditing Property
Gets or sets whether the user is allowed to edit grid contents. [Visual Basic] Public Property AllowEditing As Boolean [C#] public bool AllowEditing {get;set;} [Delphi] public property AllowEditing: Boolean read get_AllowEditing write set_AllowEditing; Remarks If you set AllowEditing to false, editing is disabled for the entire grid. To enable editing on some rows and columns, set AllowEditing to true for the grid and set the RowCol.AllowEditing or RowCol.AllowEditing properties to false for the rows and columns that should not be editable. You can also disable editing of specific cells by handling the BeforeEdit event and setting the Cancel event parameter to true. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AllowFreezing Property
Gets or sets whether the user is allowed to freeze rows and columns with the mouse.

308 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Property AllowFreezing As AllowFreezingEnum [C#] public AllowFreezingEnum AllowFreezing {get;set;} [Delphi] public property AllowFreezing: AllowFreezingEnum read get_AllowFreezing write set_AllowFreezing; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AllowResizing Property
Gets or sets whether the user is allowed to resize rows and columns with the mouse. [Visual Basic] Public Property AllowResizing As AllowResizingEnum [C#] public AllowResizingEnum AllowResizing {get;set;} [Delphi] public property AllowResizing: AllowResizingEnum read get_AllowResizing write set_AllowResizing; Remarks To resize rows or columns, the mouse must be over the fixed area of the grid, and close to a border between rows or columns. The mouse pointer will change into a sizing pointer and the user can drag the row or column to change the row height or column width. If a group of columns is selected (from first to last row) and the user resizes one of them, all selected columns are resized. The same applies to rows. If column sizing is allowed, users may double-click the resizing area to resize a column so it will automatically fit the longest entry. Rows with zero height and columns with zero width can't be resized by the user. If you want to make them very small but still resizable, set their height or width to one pixel, not to zero. The BeforeResizeRow and BeforeResizeColumn events fire before resizing starts, and may be used to prevent resizing of specific rows and columns. The AfterResizeRow and AfterResizeColumn events fire after resizing, and may be used to validate the user's action and to update the display. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AllowSorting Property
Gets or sets whether the user is allowed to sort columns using the mouse. [Visual Basic] Public Property AllowSorting As AllowSortingEnum

C1FlexGridBase.AutoClipboard Property 309

[C#] public AllowSortingEnum AllowSorting {get;set;} [Delphi] public property AllowSorting: AllowSortingEnum read get_AllowSorting write set_AllowSorting; Remarks When the grid is used in bound mode, the sorting is performed by the DataSource object. If the data source object does not support sorting, this property has no effect. In unbound mode, you can also sort data using the Sort method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AutoClipboard Property
Gets or sets whether the grid should handle the clipboard keys and automatically perform cut, copy, paste, and delete operations. [Visual Basic] Public Property AutoClipboard As Boolean [C#] public bool AutoClipboard {get;set;} [Delphi] public property AutoClipboard: Boolean read get_AutoClipboard write set_AutoClipboard; Remarks Setting this property to true causes the grid to monitor the keyboard for the following clipboard keys: Copy: Cut: Paste: Delete: CTRL-INS, CTRL-C CTRL-X, SHIFT-DEL CTRL-V, SHIFT-INS DEL

Cut, paste, and delete actions are performed only if the AllowEditing property is set to true. If you want to handle only a subset of the supported keys, add a handler to the KeyDown event and set the Handled parameter to true to disable some of the keys. Automatic clipboard operations only affect the grid data. Styles and images are not copied, pasted, or deleted. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AutoGenerateColumns Property
Gets or sets whether columns are automatically created when the grid is bound to a data source. [Visual Basic] Public Property AutoGenerateColumns As Boolean

310 C1.Win.C1FlexGrid Namespace

[C#] public bool AutoGenerateColumns {get;set;} [Delphi] public property AutoGenerateColumns: Boolean read get_AutoGenerateColumns write set_AutoGenerateColumns; Remarks By default, assigning a new DataSource to the grid resets the column collection to reflect the data source schema. If you set AutoGenerateColumns to false, the existing column layout will be preserved. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AutoResize Property
Gets or sets whether column widths are automatically adjusted when data is loaded. [Visual Basic] Public Property AutoResize As Boolean [C#] public bool AutoResize {get;set;} [Delphi] public property AutoResize: Boolean read get_AutoResize write set_AutoResize; Remarks This property works when the control is bound to a DataSource. If AutoResize is set to true, the control automatically resizes its columns to fit the widest entry every time new data is read from the data source. If the data source contains a large number of rows and columns, the automatic resizing may take a relatively long time. In these cases, you should consider setting AutoResize to false and setting the column widths directly in code. You may use the AutoSizeCols method to adjust column widths with code. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AutoSearch Property
Gets or sets whether the grid should move the cursor searching for entries as the user types. [Visual Basic] Public Property AutoSearch As AutoSearchEnum [C#] public AutoSearchEnum AutoSearch {get;set;} [Delphi] public property AutoSearch: AutoSearchEnum read get_AutoSearch write set_AutoSearch;

C1FlexGridBase.AutoSearchDelay Property 311

Remarks If AutoSearch is on, the grid will search the current column as the user types, automatically moving the cursor and highlighting matches using the CellStyleCollection.Search style. The search is case-insensitive. The search is canceled when the user presses the ESC key or moves the selection with the mouse or cursor keys. When the user stops typing for about a second, the search buffer is reset. This amount of time can be changed by setting the AutoSearchDelay property. If AutoSearch is on and AllowEditing is set to true, the user will need to hit ENTER, SPACE, or F2 to start editing cells. Other keys are used for searching. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AutoSearchDelay Property
Gets or sets the delay (in seconds) before the AutoSearch buffer is reset. [Visual Basic] Public Property AutoSearchDelay As Double [C#] public double AutoSearchDelay {get;set;} [Delphi] public property AutoSearchDelay: Double read get_AutoSearchDelay write set_AutoSearchDelay; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BackColor Property
Gets or sets the background color for the control. [Visual Basic] Overrides Public Property BackColor As Color [C#] override public Color BackColor {get;set;} [Delphi] public property BackColor: Color read get_BackColor write set_BackColor; Remarks This is the color used to paint the background of the scrollable cells, also defined by the CellStyleCollection.Normal cell style. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BottomRow Property
Gets the last visible row in the scrollable area.

312 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public ReadOnly Property BottomRow As Integer [C#] public int BottomRow {get;} [Delphi] public property BottomRow: Int32 read get_BottomRow; Remarks The index returned may correspond to a row that is only partially visible. This property is read-only. To scroll the contents of the grid, see the TopRow, LeftCol, and ScrollPosition properties. To ensure that a cell is visible, use the ShowCell method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.CellButtonImage Property
Gets or sets the image to be used in cell buttons. [Visual Basic] Overridable Public Property CellButtonImage As Image [C#] virtual public Image CellButtonImage {get;set;} [Delphi] public property CellButtonImage: Image read get_CellButtonImage write set_CellButtonImage; Remarks This property allows you to customize the appearance of cell buttons. For details on how to create and handle cell buttons, see the CellButtonClick event. If you want to use a single picture for all cell buttons on the grid, assign the picture to the CellButtonImage property at design time. To change pictures depending on the row, column, or cell being edited, set the picture in response to the BeforeEdit event. The pictures used for cell buttons should fit within the button (larger pictures are truncated). They should also be transparent, so the button face can be seen through the empty parts of the picture. For best results, use small icons (16 x 16 pixels) and draw the picture in the upper left 12 x 12 rectangle within the icon. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Clip Property
Gets or sets the contents of the selected range. [Visual Basic] Public Property Clip As String

C1FlexGridBase.ClipSeparators Property 313

[C#] public string Clip {get;set;} [Delphi] public property Clip: String read get_Clip write set_Clip; Remarks The string assigned to (or returned by) the Clip property may contain multiple cells. By default, tab characters (\t) indicate column breaks, and carriage return characters (\n) indicate row breaks. The default row and column delimiters may be changed using the ClipSeparators property. When a string is assigned to the Clip property, only the selected cells are affected. If there are more cells in the selected region than are described in the clip string, the remaining cells are ignored. If there are more cells described in the clip string than in the selected region, the extra portion of the clip string is ignored. Empty entries in the Clip string will clear existing cell contents. To get or set a clip string for an arbitrary range, use a CellRange object. Example The code below puts text into a selected area two rows high and two columns wide. Visual Basic ' build clip string Dim s As String = "r1 c1" + ControlChars.Tab + "r1 c2" + ControlChars.Lf + "r2 c1" + ControlChars.Tab + "r2 c2" ' select a 2 x 2 range and apply clip string to selection flex.Select(2, 2, 4, 4) flex.Clip = s C# // build clip string string s = "r1 c1\tr1 c2\nr2 c1\tr2 c2"; // select a 2 x 2 range and apply clip string to selection flex.Select(2, 2, 4, 4); flex.Clip = s; Delphi var s: string; begin // build clip string s := 'r1 c1'#9'r1 c2'#10'r2 c1'#9'r2 c2'; // select a 2 x 2 range and apply clip string to selection flex.Select(2, 2, 4, 4); flex.Clip := s; end; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ClipSeparators Property
Gets or sets the characters used as row and column separators in clip strings.

314 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Property ClipSeparators As String [C#] public string ClipSeparators {get;set;} [Delphi] public property ClipSeparators: String read get_ClipSeparators write set_ClipSeparators; Remarks For details and an example, see the Clip property. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Col Property
Gets or sets the column that contains the cursor. [Visual Basic] Public Property Col As Integer [C#] public int Col {get;set;} [Delphi] public property Col: Int32 read get_Col write set_Col; Remarks Use the Row and Col properties to make a cell current or to find out which row or column contains the current cell. Columns and rows are numbered from zero, beginning at the top for rows and at the left for columns. The Col property may be set to -1 to hide the selection, to a value between zero and Cols.Fixed-1 to select a cell in a fixed column, or to a value between Cols.Fixed and Cols.Count-1 to select a cell in a scrollable column. Setting the Row and Col properties automatically collapses the selection to a single cell, resetting the RowSel and ColSel properties. To specify a block selection, you must set Row and Col, then RowSel and ColSel. Alternatively, you can use the Select method to select an arbitrary range with a single statement. Setting the Row and Col properties does not ensure that the current cell is visible. To do that, use the ShowCell method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Cols Property
Gets the collection of Column objects in the grid. [Visual Basic] Public Property Cols As ColumnCollection

C1FlexGridBase.ColSel Property 315

[C#] public ColumnCollection Cols {get;set;} [Delphi] public property Cols: ColumnCollection read get_Cols write set_Cols; Remarks The Cols property returns a reference to the list of columns that make up the grid. With this reference, you can add, remove, move, and count the columns. For more information on the tasks that can be performed with this collection, see the ColumnCollection object. This property is read-only. The grid creates and manages the column collection for you. Upgrade Note: In the VSFlexGrid ActiveX control, the Cols and FixedCols properties corresponded to the number of columns and fixed columns on the grid. In C1FlexGrid, use Cols.Count and Cols.Fixed instead. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ColSel Property
Gets or sets the last column in the current selection. [Visual Basic] Public Property ColSel As Integer [C#] public int ColSel {get;set;} [Delphi] public property ColSel: Int32 read get_ColSel write set_ColSel; Remarks Use the RowSel and ColSel properties to modify a selection or to determine which cells are currently selected. Columns and rows are numbered from zero, beginning at the top for rows and at the left for columns. Setting the Row and Col properties automatically collapses the selection to a single cell, resetting the RowSel and ColSel properties. Therefore, to specify a block selection, you must Row and Col, then RowSel and ColSel. Alternatively, you may use the Select method to select a range with a single statement. When a range is selected, the value of Row may be greater than or less than RowSel, and Col may be greater than or less than ColSel. This is inconvenient when you need to set up bounds for loops. In these cases, you can use the Selection property to retrieve a normalized CellRange object, where r1 <= r2 and c1 <= c2. Example The code below loops though the cells in the current selection: Visual Basic Dim rg As CellRange = flex.Selection Dim r As Integer For r = rg.r1 To rg.r2 Dim c As Integer For c = rg.c1 To rg.c2 Console.WriteLine("the value at {0} {1} is {2}", r, c, flex(r, c)) Next c Next r

316 C1.Win.C1FlexGrid Namespace

C# CellRange rg = flex.Selection; for (int r = rg.r1; r <= rg.r2; r++) for (int c = rg.c1; c <= rg.c2; c++) Console.WriteLine("the value at {0} {1} is {2}", r, c, flex[r, c]); Delphi var c: Integer; r: Integer; rg: CellRange; begin rg := flex.Selection; for r := rg.r1 to rg.r2 do for c := rg.c1 to rg.c2 do Console.WriteLine('the value at {0} {1} is {2}', r, c, flex[r]); end;

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ComboBoxEditor Property
Gets a ComboBoxEditor object that provides easy access to properties of the currently active ComboBox editor. [Visual Basic] Public ReadOnly Property ComboBoxEditor As ComboBoxEditor [C#] public ComboBoxEditor ComboBoxEditor {get;} [Delphi] public property ComboBoxEditor: ComboBoxEditor read get_ComboBoxEditor; Remarks The ComboBoxEditor object can be used to get and set properties on the currently active ComboBox editor without casting the Editor property. If no editor is active, or if the editor is not a Windows.Forms.ComboBox, these properties return null or -1, and cannot be set. Example The code below shows two equivalent ways of accessing the selected index of the currently active ComboBox editor: Visual Basic ' with the ComboBoxEditor property: Console.WriteLine("The current combo index is {0}", _flex.ComboBoxEditor.SelectedIndex) ' without the ComboBoxEditor property: Dim cb As ComboBox = CType(ConversionHelpers.AsWorkaround(_flex.Editor, GetType(ComboBox)), ComboBox)

C1FlexGridBase.ComboList Property 317

Dim index As Integer = Microsoft.VisualBasic.IIf((Not (cb Is Nothing)),cb.SelectedIndex,-1) Console.WriteLine("The current combo index is {0}", index) C# // with the ComboBoxEditor property: Console.WriteLine("The current combo index is {0}", _flex.ComboBoxEditor.SelectedIndex); // without the ComboBoxEditor property: ComboBox cb = _flex.Editor as ComboBox; int index = (cb != null) ? cb.SelectedIndex : -1; Console.WriteLine("The current combo index is {0}", index); Delphi -- N/A

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ComboList Property
Gets or sets the list of items to be used by the drop-down editor. [Visual Basic] Public Property ComboList As String [C#] public string ComboList {get;set;} [Delphi] public property ComboList: String read get_ComboList write set_ComboList; Remarks The ComboList property specifies the type of editor to be used when editing a cell. You may use a text box, drop-down list, drop-down combo, or an edit button to pop up custom editor forms. To use the ComboList property, set the AllowEditing property to true and respond to the BeforeEdit event by setting the ComboList property to a string that describes the type of editing you want to use for that cell. The options are described below: 1. To edit the cell using a regular text box, set the ComboList property to an empty string. For example: 2. Visual Basic flex.ComboList = string.Empty C# flex.ComboList = string.Empty; Delphi flex.ComboList := string.Empty;

To edit the cell using a drop-down list, set the ComboList property to a string containing the available options, separated by pipe characters. For example: Visual Basic flex.ComboList = "Item 1|Item 2|Item 3" C# flex.ComboList = "Item 1|Item 2|Item 3";

318 C1.Win.C1FlexGrid Namespace

3.

Delphi flex.ComboList := 'Item 1|Item 2|Item 3';

To edit the cell using a drop-down combo, set the ComboList property to a string containing the available options, separated by pipe characters ("|") and starting with a pipe character. For example: Visual Basic flex.ComboList = "|Item 1|Item 2|Item 3" C# flex.ComboList = "|Item 1|Item 2|Item 3"; Delphi flex.ComboList = '|Item 1|Item 2|Item 3';

4.

To display an edit button, set the ComboList property to a string containing an ellipsis ("..."). Edit buttons look like regular push buttons, aligned to the right of the cell, with an ellipsis as a caption. When the user clicks on the edit button, the grid fires the CellButtonClick event. In this case, the user can't edit the cell contents directly. For example: Visual Basic flex.ComboList = "..." C# flex.ComboList = "..."; Delphi flex.ComboList := '...';

5.

To display an edit button next to an editable cell, set the ComboList property to a string containing a pipe and an ellipsis ("|..."). In this case, you get a regular edit button but the user can also edit the cell contents directly. For example: Visual Basic flex.ComboList = "|..." C# flex.ComboList = "|..."; Delphi flex.ComboList := '|...';

The ComboList property is especially useful in cases where different rows in the same column may contain different types of data (for example a control such as the PropertyGrid). In this case, the ComboList property allows you to adjust the type of editing you want to provide depending on the current row. If all rows in the column contain the same type of data, use the Column's RowCol.ComboList property instead. This way, the grid will automatically select the list depending on the column being edited and you don't need to handle any events. Note that the ComboList allows you to specify lists of strings only. Cells will store and display these strings. If you want to store a certain type of data and display values associated with that data, see the RowCol.DataMap property. The DataMap property allows you to store values in the cells (for example a CustomerID) and display strings assiociated with that data (for example the customer name). Example The code below handles the BeforeEdit event and assigns a value to the ComboList property so that the grid displays buttons on every other row. Visual Basic Private Sub _flex_BeforeEdit(sender As Object, e As RowColEventArgs) _flex.ComboList = String.Empty If e.Row Mod 2 = 0 Then

C1FlexGridBase.CursorCell Property 319

_flex.ComboList = "..." End If End Sub C# private void _flex_BeforeEdit(object sender, RowColEventArgs e) { _flex.ComboList = string.Empty; if (e.Row % 2 == 0) _flex.ComboList = "..."; } Delphi procedure _flex_BeforeEdit(sender: System.Object; e: RowColEventArgs); begin _flex.ComboList := Empty; if ((e.Row mod 2) = 0) then _flex.ComboList := '...'; end;

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.CursorCell Property
Gets a CellRange object that contains the cell at coordinates Row, Col. [Visual Basic] Overridable Public ReadOnly Property CursorCell As CellRange [C#] virtual public CellRange CursorCell {get;} [Delphi] public property CursorCell: CellRange read get_CursorCell; Remarks To get a CellRange object that spans the entire selection, use the Selection property. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.CustomComparer Property
Gets or sets a custom comparer object used by the grid to perform grouping, merging, and searching operations. [Visual Basic] Public Property CustomComparer As IComparer [C#] public IComparer CustomComparer {get;set;} [Delphi] public property CustomComparer: IComparer read get_CustomComparer write set_CustomComparer;

320 C1.Win.C1FlexGrid Namespace

Remarks The grid has a default Collections.IComparer implementation that is used to compare cells and determine if their contents are equivalent. This implementation is used when merging, grouping, or searching for values (see the C1FlexGrid.AllowMerging property and the Subtotal and FindRow methods). The default implementation is case-sensitive and takes leading and trailing blanks into account. If you want to merge cells using a case-insensitive comparison or trimming blanks, write a custom class that implements the Collections.IComparer interface and assign an instance of it to the grid's CustomComparer property. Setting this property to null (Nothing in Visual Basic) restores the default behavior. Example The code below replaces the built-in comparer with a Collections.CaseInsensitiveComparer. This causes the Subtotal method to group items that differ only in case into the same groups: Visual Basic ' use case-insensitive comparer flex.CustomComparer = New CaseInsensitiveComparer() ' add groups ignoring case flex.Subtotal(AggregateEnum.Sum, 0, groupOn, totalOn) ' restore default (case-sensitive) comparer flex.CustomComparer = Nothing C# // use case-insensitive comparer flex.CustomComparer = new CaseInsensitiveComparer(); // add groups ignoring case flex.Subtotal(AggregateEnum.Sum, 0, groupOn, totalOn); // restore default (case-sensitive) comparer flex.CustomComparer = null; Delphi // use case-insensitive comparer flex.CustomComparer := CaseInsensitiveComparer.Create; // add groups ignoring case flex.Subtotal(AggregateEnum.Sum, 0, groupOn, totalOn); // restore default (case-sensitive) comparer flex.CustomComparer := nil; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.DataMember Property
Gets or sets the specific list in a DataSource object that the grid should display. [Visual Basic] Public Property DataMember As String

C1FlexGridBase.DataSource Property 321

[C#] public string DataMember {get;set;} [Delphi] public property DataMember: String read get_DataMember write set_DataMember; Remarks If a DataSource contains multiple sources of data, you should set the DataMember property to one of the sources. For example, if the DataSource is a Data.DataSet contains three tables named Customers, Orders, and OrderDetails, you must specify one of the tables to bind to. If the Data.DataSet contains only one Data.DataTable, you may set the DataMember property to an empty string. You can use the SetDataBinding method to set the DataSource and DataMember properties at the same time. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.DataSource Property
Gets or sets the data source for the grid. [Visual Basic] Public Property DataSource As Object [C#] public object DataSource {get;set;} [Delphi] public property DataSource: Object read get_DataSource write set_DataSource; Remarks Any object that implements the Collections.IList or ComponentModel.IListSource interfaces can be used as a data source. Specifically, the following ADO.NET data sources are valid: DataTable, DataView, DataSet, and DataViewManager. The following ComponentOne DataObjects components are also valid data sources: C1ExpressTable, C1ExpressVew, C1ExpressConnection, C1DataView, C1DataTableSource, and C1DataSet. If the DataSource reference contains more than one table, you must also set the DataMember property a string that specifies the table to bind to. For example, if the DataSource is a DataSet or DataViewManager that contains three tables named Customers, Orders, and OrderDetails, you must specify one of the tables to bind to. You can use the SetDataBinding method to set the DataSource and DataMember properties simultaneously. You can also assign another C1FlexGrid object to the DataSource property. In this case, the controls will share the same grid model, including the data, display styles, selection, and so on. This can be used to implement split views, where different controls display different parts of the same data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

322 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.DoubleBuffer Property
Gets or sets whether the control should use an off-screen buffer when painting to reduce flicker. [Visual Basic] Public Property DoubleBuffer As Boolean [C#] public bool DoubleBuffer {get;set;} [Delphi] public property DoubleBuffer: Boolean read get_DoubleBuffer write set_DoubleBuffer; Remarks This property is set to true by default, and rarely needs to be changed. Setting DoubleBuffer to false may increase performance of applications running under terminal server software. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.DragMode Property
Gets or sets a value that determines if the user can drag data from the control. [Visual Basic] Public Property DragMode As DragModeEnum [C#] public DragModeEnum DragMode {get;set;} [Delphi] public property DragMode: DragModeEnum read get_DragMode write set_DragMode; Remarks This property allows you to use the control as a source for OLE drag-drop operations. If set to any of the automatic settings, the control provides the following services: 1) Detect when the mouse is near the edge of a selected cell or range and display the OLE drag cursor. 2) If the user clicks the mouse while the OLE drag cursor is displayed, initiate a drag operation with a data object containing the current selection. In manual mode, the programmer is responsible for starting drag-drop operations using the DoDragDrop method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.DrawMode Property
Gets or sets whether the control should fire the OwnerDrawCell event.

C1FlexGridBase.DropMode Property 323

[Visual Basic] Public Property DrawMode As DrawModeEnum [C#] public DrawModeEnum DrawMode {get;set;} [Delphi] public property DrawMode: DrawModeEnum read get_DrawMode write set_DrawMode; Remarks If you set this property to DrawModeEnum.OwnerDraw, the grid will fire the OwnerDrawCell event whenever a cell needs to be painted. You can handle the event and customize the way each cell is painted, either by changing the cell contents and style, or by taking over the painting and doing it yourself. For more details and examples, see the OwnerDrawCell event. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.DropMode Property
Gets or sets a value that determines if the control can accept data that the user drags onto it. [Visual Basic] Public Property DropMode As DropModeEnum [C#] public DropModeEnum DropMode {get;set;} [Delphi] public property DropMode: DropModeEnum read get_DropMode write set_DropMode; Remarks This property allows you to use the control as a target for OLE drag-drop operations. If set to DropModeEnum.None (the default value), the control does not act as a drop target. If set to DropModeEnum.Manual, the control fires the standard drag-drop events and the programmer is responsible for handling them. The main events involved are DragOver and DragDrop. These events are provided by the standard System.Windows.Forms.Control object. If set to DropModeEnum.Automatic, the control handles the DragOver and DragDrop events automatically by performing the following actions: 1) Query the data object for data in text or filename formats. 2) Scroll if the user drags an object near the edges of the control. 3) Paste the contents of the data object when the user drops valid data on the control. Note: This property replaces and extends the AllowDrop property provided by the base Windows.Forms.Control object. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

324 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.EditMask Property
Gets or sets the input mask to use when editing cells. [Visual Basic] Public Property EditMask As String [C#] public string EditMask {get;set;} [Delphi] public property EditMask: String read get_EditMask write set_EditMask; Remarks The EditMask specifies an input mask for automatic input formatting and validation. The mask syntax is similar to the one used by the Microsoft MaskedEdit ActiveX control and by Microsoft Access and is described below. Set the EditMask property in response to the BeforeEdit event, in the same way you would set the ComboList property. If the same mask is used to edit all values in a column, use the column's RowCol.EditMask property. This simplifies your code because you don't need to handle the BeforeEdit event. When the user is done editing a cell with a mask, the ValidateEdit event fires. The Cancel event parameter will be set to true if the mask was not filled out properly, so in most cases you don't have to implement the handler. The default behavior ensures that only valid data will be entered. The EditMask string is composed of the following symbols: 1) Wildcards 0 9 # L ? A a & digit digit or space digit, space, or sign letter letter or space letter or digit letter, digit, or space any character

2) Localized characters . , : / localized decimal separator localized thousand separator localized time separator localized date separator

3) Command characters \ next character is taken as a literal

C1FlexGridBase.EditOptions Property 325

> <

translate letters to uppercase translate letters to lowercase

4) Placeholder specification ; next character is used as a placeholder (the default is an underscore) Example The code below sets the edit mask so the user can enter a phone number, with optional area code, and a state in uppercase letters. The spaceholder used is an asterisk ("*"). Visual Basic flex.EditMask = "(###) 000-0000 St\ate\: >LL;*" C# flex.EditMask = "(###) 000-0000 St\ate\: >LL;*"; Delphi flex.EditMask := '(###) 000-0000 St'#7'te >LL;*';

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.EditOptions Property
Gets or sets an EditFlags flags that affect the grid's editing behavior. [Visual Basic] Public Property EditOptions As EditFlags [C#] public EditFlags EditOptions {get;set;} [Delphi] public property EditOptions: EditFlags read get_EditOptions write set_EditOptions; Remarks The default value for this property is EditFlags.All, which enables all editing options. See the EditFlags enumeration for a list of options available. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Editor Property
Gets or sets a reference to the cell editor that is currently active. [Visual Basic] Public Property Editor As Control [C#] public Control Editor {get;set;}

326 C1.Win.C1FlexGrid Namespace

[Delphi] public property Editor: Control read get_Editor write set_Editor; Remarks The Editor property returns a reference to the cell editor that is currently active. This may be one of the built-in editors (a TextBox, a ComboBox, or a DateTimePicker control), a custom editor, or null (if the grid is not in edit mode). You can use this property to programmatically access the editor, or to find out if the grid is in edit mode. If you don't want to use the grid's built-in editors, you can use any other control instead. To do this, either associate the external editor with a specific grid row, column, or CellStyle using the CellStyle.Editor property, which you can get and set at any time. Alternatively, you can handle the StartEdit event and assign any control directly to the Editor property. (Note that the grid's Editor property can only be assigned while handling the StartEdit event, and is automatically reset to null when the grid exits edit mode.) Any control can be used as an external editor, but to achieve complete integration with the grid, the external editor should implement the IC1EmbeddedEditor interface. Some controls implement this interface natively and don't require any extra code to be used as grid editors (like the ones in the C1Input library). Most, however, will require you to implement at least a few of the methods in IC1EmbeddedEditor. For examples of custom editors, please see Using Custom Editors and Creating Custom Editors in this documentation, or visit our on-line sample library at http://helpcentral.componentone.com/ProductResources.aspx and download the "CustomEditors" sample. Example The code below uses the SetupEditor event to customize the current editor by setting two properties. Visual Basic Private Sub _flex_SetupEditor(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.RowColEventArgs) Dim tb As TextBox = _flex.Editor as TextBox If Not tb Is Nothing Then tb.CharacterCasing = CharacterCasing.Upper tb.MaxLength = 12 End If End Sub C# private void _flex_SetupEditor(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { TextBox tb = _flex.Editor as TextBox; if (tb != null) { tb.CharacterCasing = CharacterCasing.Upper; tb.MaxLength = 12; } } Delphi procedure _flex_SetupEditor(sender: object; e: C1.Win.C1FlexGrid.RowColEventArgs); var tb := _flex.Editor; begin if (tb <> nil) then begin

C1FlexGridBase.ExtendLastCol Property 327

tb.CharacterCasing := CharacterCasing.Upper; tb.MaxLength := 12; end; end; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ExtendLastCol Property
Gets or sets whether the last column should be extended to fill the control. [Visual Basic] Public Property ExtendLastCol As Boolean [C#] public bool ExtendLastCol {get;set;} [Delphi] public property ExtendLastCol: Boolean read get_ExtendLastCol write set_ExtendLastCol; Remarks This property only affects painting. It does not modify the Column.Width property of the last column. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.FocusRect Property
Gets or sets the type of focus rectangle to display. [Visual Basic] Public Property FocusRect As FocusRectEnum [C#] public FocusRectEnum FocusRect {get;set;} [Delphi] public property FocusRect: FocusRectEnum read get_FocusRect write set_FocusRect; Remarks If the focus rectangle is drawn, then the current cell is painted using the CellStyleCollection.Focus style, which by default looks like a regular scrollable cell (as in most spreadsheets and grids). If the focus rectangle is hidden (using the FocusRectEnum.None setting), the current cell is painted using the CellStyleCollection.Highlight style. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ForeColor Property
Gets or sets the foreground color for the control.

328 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overrides Public Property ForeColor As Color [C#] override public Color ForeColor {get;set;} [Delphi] public property ForeColor: Color read get_ForeColor write set_ForeColor; Remarks This is the color used to paint the text in scrollable cells, also defined by the CellStyleCollection.Normal cell style. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Glyphs Property
Gets the collection of control glyphs (images used to show sorting, checkboxes, and so on). [Visual Basic] Public ReadOnly Property Glyphs As GridGlyphs [C#] public GridGlyphs Glyphs {get;} [Delphi] public property Glyphs: GridGlyphs read get_Glyphs; Remarks The Glyphs property returns a GridGlyphs collection with an indexer of type GlyphEnum. This collection allows you to get or set the images used to indicate column sorting, collapsed and expanded outline groups, checkboxes, cursors, error information, and so on. Note: Setting a glyph to null restores the default (built-in) image. If you want to make a glyph invisible, set it to a small blank image instead. Example For example, the code below causes the grid to use custom images to display the column sorting order (instead of the built-in hollow triangles): Visual Basic flex.Glyphs(GlyphEnum.Ascending) = imgAscending flex.Glyphs(GlyphEnum.Descending) = imgDescending C# flex.Glyphs[GlyphEnum.Ascending] = imgAscending; flex.Glyphs[GlyphEnum.Descending] = imgDescending; Delphi flex.Glyphs[GlyphEnum.Ascending] := imgAscending; flex.Glyphs[GlyphEnum.Descending] := imgDescending;

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.HighLight Property 329

C1FlexGridBase.HighLight Property
Gets or sets when to highlight selected cells. [Visual Basic] Public Property HighLight As HighLightEnum [C#] public HighLightEnum HighLight {get;set;} [Delphi] public property HighLight: HighLightEnum read get_HighLight write set_HighLight; Remarks You can customize the appearance of highlighted cells by modifying the CellStyleCollection.Highlight property. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Item Property
[Visual Basic] Public Default Property Item( _ ByVal row As Integer, _ ByVal colName As String _ ) As Object [C#] public object this[ int row, string colName ] {get;set;} [Delphi] public property Item[ row: Int32; colName: String ]: Object read get_Item write set_Item; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.KeyActionEnter Property
Gets or sets the action to be performed when the user presses the ENTER key. [Visual Basic] Public Property KeyActionEnter As KeyActionEnum [C#] public KeyActionEnum KeyActionEnter {get;set;}

330 C1.Win.C1FlexGrid Namespace

[Delphi] public property KeyActionEnter: KeyActionEnum read get_KeyActionEnter write set_KeyActionEnter; Remarks By default, the grid will move the selection to the next visible row when the user presses the ENTER key. If the grid is editable, pressing ENTER will cause the grid to enter edit mode, and pressing ENTER while in edit mode will cause the cursor to move down. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.KeyActionTab Property
Gets or sets the action to be performed when the user presses the TAB key. [Visual Basic] Public Property KeyActionTab As KeyActionEnum [C#] public KeyActionEnum KeyActionTab {get;set;} [Delphi] public property KeyActionTab: KeyActionEnum read get_KeyActionTab write set_KeyActionTab; Remarks By default, the grid will ignore the TAB key and it will be handled by the form, moving the focus to the next control in the tab order. If you set the KeyActionTab property to a value other than KeyActionEnum.None, the grid will trap the TAB key and use it for navigating cells. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.LeftCol Property
Gets or sets the first visible column in the scrollable area. [Visual Basic] Public Property LeftCol As Integer [C#] public int LeftCol {get;set;} [Delphi] public property LeftCol: Int32 read get_LeftCol write set_LeftCol; Remarks Setting the LeftCol property causes the grid to scroll horizontally so that the given column becomes the leftmost visible column. This is often useful when you want to synchronize two or more grids so that when one of them scrolls, the other scrolls as well. To scroll vertically, use the TopRow property. When setting this property, the largest possible column number is the total number of columns minus the number of columns that will fit the display. Attempting to set LeftCol to a greater value will cause the grid to set it to the largest possible value (no error will occur).

C1FlexGridBase.MouseCol Property 331

The value returned by the LeftCol and TopRow properties may correspond to partially visible rows or columns. Use the LeftCol and TopRow properties to scroll using cells as units. Use the ScrollPosition property to scroll the grid using pixel units. To ensure that a given cell is visible, use the ShowCell method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.MouseCol Property
Gets the index of the column under the cursor. [Visual Basic] Overridable Public ReadOnly Property MouseCol As Integer [C#] virtual public int MouseCol {get;} [Delphi] public property MouseCol: Int32 read get_MouseCol; Remarks The MouseRow and MouseCol properties are often useful when handling the BeforeMouseDown event, to provide custom mouse handling. They are also useful when handling mouse events that do not change the selection and for detecting clicks on the fixed areas of the grid. Typical uses for these properties include displaying help information or tooltips when the user moves the mouse over a selection, and the implementation of manual drag-and-drop manipulation of OLE objects. MouseRow and MouseCol return -1 if the mouse is not over any rows or columns. To obtain more detailed hit-testing information, use the HitTest method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.MouseRow Property
Gets the index of the row under the cursor. [Visual Basic] Overridable Public ReadOnly Property MouseRow As Integer [C#] virtual public int MouseRow {get;} [Delphi] public property MouseRow: Int32 read get_MouseRow; Remarks The MouseRow and MouseCol properties are often useful when handling the BeforeMouseDown event, to provide custom mouse handling. They are also useful when handling mouse events that do not change the selection and for detecting clicks on the fixed areas of the grid.

332 C1.Win.C1FlexGrid Namespace

Typical uses for these properties include displaying help information or tooltips when the user moves the mouse over a selection, and the implementation of manual drag-and-drop manipulation of OLE objects. MouseRow and MouseCol return -1 if the mouse is not over any rows or columns. To obtain more detailed hit-testing information, use the HitTest method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.PrintParameters Property
Gets a GridPrinter object that specifies printing parameters for the grid. [Visual Basic] Public ReadOnly Property PrintParameters As GridPrinter [C#] public GridPrinter PrintParameters {get;} [Delphi] public property PrintParameters: GridPrinter read get_PrintParameters; Remarks Use the PrintGrid method to print the grid and specify the document name, common printing options, headers and footers. Use the PrintParameters property to specify less common printing options such as header and footer fonts, page margins, and page orientation. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Redraw Property
Gets or sets whether the grid should paint its contents. [Visual Basic] Public Property Redraw As Boolean [C#] public bool Redraw {get;set;} [Delphi] public property Redraw: Boolean read get_Redraw write set_Redraw; Remarks The Redraw property is used to optimize the performance of the grid. Before making extensive changes, set it to false to suspend repainting. When the changes are done, set it back to true. This will reduce flicker and increase performance. This optimization is especially effective when adding large numbers of rows to the grid, because it needs to recalculate ranges and update scrollbars each time a row is added. Example The code below turns repainting off, changes the contents of the grid, and then turns repainting back on to show the results. Note how the code saves the original setting of the Redraw property and restores it inside a 'finally' block to ensure repaining is properly restored.

C1FlexGridBase.RightCol Property 333

Visual Basic Private Function UpdateGrid(flex As c1FlexGrid) As function Dim redraw As Boolean = flex.Redraw ' save original value flex.Redraw = False ' suspend painting to avoid flicker Try flex.Rows.Count = 1 Dim i As Integer For i = 1 To 9999 flex.AddItem(("Row " + i.ToString())) Next i Finally flex.Redraw = redraw ' always restore painting End Try End Function C# private function UpdateGrid(c1FlexGrid flex) { bool redraw = flex.Redraw; // save original value flex.Redraw = false; // suspend painting to avoid flicker try { flex.Rows.Count = 1; for (int i = 1; i < 10000; i++) flex.AddItem("Row " + i.ToString()); } finally { flex.Redraw = redraw; // always restore painting } } Delphi private function UpdateGrid(c1FlexGrid flex) { bool redraw = flex.Redraw; // save original value flex.Redraw = false; // suspend painting to avoid flicker try { flex.Rows.Count = 1; for (int i = 1; i < 10000; i++) flex.AddItem("Row " + i.ToString()); } finally { flex.Redraw = redraw; // always restore painting } }

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.RightCol Property
Gets the last visible column in the scrollable area.

334 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public ReadOnly Property RightCol As Integer [C#] public int RightCol {get;} [Delphi] public property RightCol: Int32 read get_RightCol; Remarks The index returned may correspond to a column that is only partially visible. This property is read-only. To scroll the contents of the grid, see the TopRow, LeftCol, and ScrollPosition properties. To ensure that a cell is visible, use the ShowCell method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Row Property
Gets or sets the row that contains the cursor. [Visual Basic] Public Property Row As Integer [C#] public int Row {get;set;} [Delphi] public property Row: Int32 read get_Row write set_Row; Remarks Use the Row and Col properties to make a cell current or to find out which row or column contains the current cell. Columns and rows are numbered from zero, beginning at the top for rows and at the left for columns. The Row property may be set to -1 to hide the selection, to a value between zero and Rows.Fixed-1 to select a cell in a fixed row, or to a value between Rows.Fixed and Rows.Count-1 to select a cell in a scrollable row. Setting the Row and Col properties automatically collapses the selection to a single cell, resetting the RowSel and ColSel properties. To specify a block selection, you must set Row and Col, then RowSel and ColSel. Alternatively, you can use the Select method to select an arbitrary range with a single statement. Setting the Row and Col properties does not ensure that the current cell is visible. To do that, use the ShowCell method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Rows Property
Gets the collection of Row objects in the grid. [Visual Basic] Public ReadOnly Property Rows As RowCollection

C1FlexGridBase.RowSel Property 335

[C#] public RowCollection Rows {get;} [Delphi] public property Rows: RowCollection read get_Rows; Remarks The Rows property returns a reference to the list of rows that make up the grid. With this reference, you can add, remove, move, and count the rows. For more information on the tasks that can be performed with this collection, see the RowCollection object. This property is read-only. The grid creates and manages the row collection for you. Upgrade Note: In the VSFlexGrid ActiveX control, the Rows and FixedRows properties corresponded to the number of rows and fixed rows on the grid. In C1FlexGrid, use Rows.Count and Rows.Fixed. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.RowSel Property
Gets or sets the last row in the current selection. [Visual Basic] Public Property RowSel As Integer [C#] public int RowSel {get;set;} [Delphi] public property RowSel: Int32 read get_RowSel write set_RowSel; Remarks Use the RowSel and ColSel properties to modify a selection or to determine which cells are currently selected. Columns and rows are numbered from zero, beginning at the top for rows and at the left for columns. Setting the Row and Col properties automatically collapses the selection to a single cell, resetting the RowSel and ColSel properties. Therefore, to specify a block selection, you must Row and Col, then RowSel and ColSel. Alternatively, you may use the Select method to select a range with a single statement. If the SelectionMode property is set to SelectionModeEnum.ListBox, you should use the RowCol.Selected property on individual row objects to select and deselect rows. When a range is selected, the value of Row may be greater than or less than RowSel, and Col may be greater than or less than ColSel. This is inconvenient when you need to set up bounds for loops. In these cases, you can use the Selection property to retrieve a normalized CellRange object, where r1 <= r2 and c1 <= c2. See the ColSel property for an example. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ScrollableRectangle Property
Gets a rectangle that defines the scrollable portion of the control. [Visual Basic] Overrides Public ReadOnly Property ScrollableRectangle As Rectangle

336 C1.Win.C1FlexGrid Namespace

[C#] override public Rectangle ScrollableRectangle {get;} [Delphi] public property ScrollableRectangle: Rectangle read get_ScrollableRectangle; Remarks The value returned corresponds to the control's client area minus any fixed and frozen rows and columns. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ScrollOptions Property
Gets or sets a ScrollFlags value that specifies the grid scrolling behavior. [Visual Basic] Public Property ScrollOptions As ScrollFlags [C#] public ScrollFlags ScrollOptions {get;set;} [Delphi] public property ScrollOptions: ScrollFlags read get_ScrollOptions write set_ScrollOptions; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Selection Property
Gets the selected range in normalized form. [Visual Basic] Overridable Public ReadOnly Property Selection As CellRange [C#] virtual public CellRange Selection {get;} [Delphi] public property Selection: CellRange read get_Selection; Remarks The range returned corresponds to the current selection, defined by the Row, Col, RowSel, and ColSel properties. The range is normalized, so range.r1 <= range.r2 and range.c1 <= range.c2. This makes it easy to loop through the selection. For example: Visual Basic Dim total As Integer = 0 Dim rg As CellRange = flex.Selection Dim r As Integer For r = rg.r1 To rg.r2 Dim c As Integer For c = rg.c1 To rg.c2

C1FlexGridBase.SelectionMode Property 337

total += CInt(flex(r, c)) Next c Next r Console.WriteLine("The total is: {0}", total) C# int total = 0; CellRange rg = flex.Selection; for (int r = rg.r1; r <= rg.r2; r++) for (int c = rg.c1; c <= rg.c2; c++) total += (int)flex[r,c]; Console.WriteLine("The total is: {0}", total); Delphi total := 0; rg := flex.Selection; r := rg.r1; while (r <= rg.r2) do begin c := rg.c1; while (c <= rg.c2) do begin end; end; Console.WriteLine('The total is: {0}', total);

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SelectionMode Property
Gets or sets the grid's selection behavior. [Visual Basic] Public Property SelectionMode As SelectionModeEnum [C#] public SelectionModeEnum SelectionMode {get;set;} [Delphi] public property SelectionMode: SelectionModeEnum read get_SelectionMode write set_SelectionMode; Remarks In most selection modes, you can obtain the current selection using the Selection property. When SelectionMode is set to SelectionModeEnum.ListBox, however, the selection may consist of a noncontinuous range of rows. In this case, you can check the selection state of individual rows using the CellStyleCollection.Highlight property or obtain a collection of selected rows using the RowCollection.Selected property. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

338 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ShowButtons Property
Gets or sets when to display combo buttons in cells. [Visual Basic] Public Property ShowButtons As ShowButtonsEnum [C#] public ShowButtonsEnum ShowButtons {get;set;} [Delphi] public property ShowButtons: ShowButtonsEnum read get_ShowButtons write set_ShowButtons; Remarks By default, the grid will show editing buttons in cells only when they have the focus. This is the same behavior used by the Windows.Forms.PropertyGrid control. If you set ShowButtons to ShowButtonsEnum.Always, the grid will display buttons on any cells that have associated lists, even if they don't have the focus. For details on how to associate lists with cells, see the ComboList, RowCol.ComboList, and RowCol.DataMap properties. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ShowCellLabels Property
Gets or sets whether the grid should display labels over cells whose contents are partially hidden. [Visual Basic] Public Property ShowCellLabels As Boolean [C#] public bool ShowCellLabels {get;set;} [Delphi] public property ShowCellLabels: Boolean read get_ShowCellLabels write set_ShowCellLabels; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ShowCursor Property
Gets or sets whether the grid should display a DB-style cursor on the first fixed column. [Visual Basic] Public Property ShowCursor As Boolean [C#] public bool ShowCursor {get;set;}

C1FlexGridBase.ShowErrors Property 339

[Delphi] public property ShowCursor: Boolean read get_ShowCursor write set_ShowCursor; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ShowErrors Property
Gets or sets whether the grid should display error information in cells and rows. [Visual Basic] Public Property ShowErrors As Boolean [C#] public bool ShowErrors {get;set;} [Delphi] public property ShowErrors: Boolean read get_ShowErrors write set_ShowErrors; Remarks Setting this property to true causes the grid to display error information in cells and rows. Error information is displayes as error icons in the cells or row headers. Moving the mouse over the error icons show tooltips containing an error description. The error information may be supplied directly by data sources that implement the ComponentModel.IDataErrorInfo interface (for example, the DataTable class implements this interface). If the grid is bound to a data source that doesn't support ComponentModel.IDataErrorInfo, you can provide error information using the GetCellErrorInfo and GetRowErrorInfo events. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ShowSort Property
Gets or sets whether the grid should display sorting glyphs (a triangle) on the headers of sorted columns. [Visual Basic] Public Property ShowSort As Boolean [C#] public bool ShowSort {get;set;} [Delphi] public property ShowSort: Boolean read get_ShowSort write set_ShowSort; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ShowThemedHeaders Property
Gets or sets whether the control should use XP themes for displaying row or column headers.

340 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Property ShowThemedHeaders As ShowThemedHeadersEnum [C#] public ShowThemedHeadersEnum ShowThemedHeaders {get;set;} [Delphi] public property ShowThemedHeaders: ShowThemedHeadersEnum read get_ShowThemedHeaders write set_ShowThemedHeaders; Remarks This property only has an effect if the application is themed. To enable themes for an application, you can either call the Application.EnableVisualStyles method or use a manifest file. Please refer to MSDN for details. Setting the Windows.Forms.BorderStyle property to BorderStyleEnum.XpThemes automatically sets this property to ShowThemedHeadersEnum.Both. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SortColumn Property
Gets a reference to the column that defines the current sort applied to the grid. [Visual Basic] Public ReadOnly Property SortColumn As Column [C#] public Column SortColumn {get;} [Delphi] public property SortColumn: Column read get_SortColumn; Remarks The grid may be sorted by a call to the Sort method, by a user clicking a column header, or as a result of sorting applied directly to the object that is being used as the grid's DataSource. To determine the current sort direction, use the sorted column's Column.Sort property. If the grid is not currently sorted, this property returns null. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Styles Property
Gets the collection of cell styles defined in the grid. [Visual Basic] Public Property Styles As CellStyleCollection [C#] public CellStyleCollection Styles {get;set;}

C1FlexGridBase.SubtotalPosition Property 341

[Delphi] public property Styles: CellStyleCollection read get_Styles write set_Styles; Remarks The Styles property enables you to obtain a reference to the list of styles that are currently defined in the grid. With this reference, you can add, remove, and count the styles. For more information on the tasks that can be performed with this collection, see the CellStyleCollection class reference topics. For information on cell formatting, see the CellStyle reference topics. This property is read-only. The grid creates and manages the collection for you. Upgrade Note: The VSFlexGrid ActiveX control had many properties that affected the way the grid was displayed (for example, BackColor, BackColorAlternate, BackColorBkg, BackColorFixed, BackColorFrozen, BackColorSel, and so on). The C1FlexGrid control replaces all these properties with a collection of CellStyle objects. This makes the object model simpler, more consistent, and more powerful. You can change the builtin styles or define your own, and assign them to rows, columns, or arbitrary cell ranges. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SubtotalPosition Property
Gets or sets whether node rows appear above or below the data. [Visual Basic] Public Property SubtotalPosition As SubtotalPositionEnum [C#] public SubtotalPositionEnum SubtotalPosition {get;set;} [Delphi] public property SubtotalPosition: SubtotalPositionEnum read get_SubtotalPosition write set_SubtotalPosition; Remarks This property determines how the outline tree is drawn, and it also determines whether the Subtotal method should add subtotal rows (which are node rows) above or below the data being summarized. Changing this property clears any existing nodes. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.TopRow Property
Gets or sets the first visible row in the scrollable area. [Visual Basic] Public Property TopRow As Integer [C#] public int TopRow {get;set;} [Delphi] public property TopRow: Int32 read get_TopRow write set_TopRow;

342 C1.Win.C1FlexGrid Namespace

Remarks Setting the TopRow property causes the grid to scroll vertically so that the given row becomes the topmost visible row. This is often useful when you want to synchronize two or more grids so that when one of them scrolls, the other scrolls as well. To scroll horizontally, use the LeftCol property. When setting this property, the largest possible row number is the total number of rows minus the number of rows that will fit the display. Attempting to set TopRow to a greater value will cause the grid to set it to the largest possible value (no error will occur). The value returned by the LeftCol and TopRow properties may correspond to partially visible rows or columns. Use the LeftCol and TopRow properties to scroll using cells as units. Use the ScrollPosition property to scroll the grid using pixel units. To ensure that a given cell is visible, use the ShowCell method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Tree Property
Gets a reference to the GridTree object that controls the appearance of the outline tree in the grid. [Visual Basic] Public ReadOnly Property Tree As GridTree [C#] public GridTree Tree {get;} [Delphi] public property Tree: GridTree read get_Tree; Remarks The C1FlexGrid can group data hierarchically and display it with a collapsible tree similar to the one in the Microsoft TreeView control. The GridTree object is used to specify the position and appearance of the outline tree. For details on create outlines, see the Subtotal method and the Row.IsNode property. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.UseCompatibleTextRendering Property
Specifies whether text rendering should be compatible with previouse releases of WinForms. [Visual Basic] Public Property UseCompatibleTextRendering As Boolean [C#] public bool UseCompatibleTextRendering {get;set;} [Delphi] public property UseCompatibleTextRendering: Boolean read get_UseCompatibleTextRendering write set_UseCompatibleTextRendering;

C1FlexGridBase Methods 343

Remarks This property determines whether the control should render text using the Drawing.Graphics class (compatible with previous versions), or the new Windows.Forms.TextRenderer class (available in .NET 2.0 and later). The Windows.Forms.TextRenderer class supports complex scripts and Uniscribe APIs, making it better suited for some international applications. However, the Windows.Forms.TextRenderer class seems to render about 25% slower than the traditional method. You may want to try both modes and select the one that matches the appearance of other controls and forms in your application. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase Methods
The methods of the C1FlexGridBase class are listed here. For a complete list of C1FlexGridBase class members, see the C1FlexGridBase Members topic. Public Methods AddItem Aggregate AutoSizeCol AutoSizeCols AutoSizeRow AutoSizeRows BeginInit Clear CreateImage EndInit FindRow FinishEditing GetCellCheck GetCellImage GetCellRange GetCellRect GetCellStyle Overloaded. Adds a row to the grid and populates the new row with data. Overloaded. Calculates aggregate statistics for the current selection. Overloaded. Adjusts the width of a column to fit the data. Overloaded. Adjusts the width of all columns to fit the data. Adjusts the height of a row to fit the data. Overloaded. Adjusts the height of all rows to fit the data. Signals the object that initialization is starting. Overloaded. Clears the grid. Overloaded. Creates an image of the entire grid. Signals the object that initialization is complete. Overloaded. Finds a row that contains a specified RowCol.UserData value. Overloaded. Finishes editing the current cell and takes the grid out of edit mode. Gets the state of the checkbox in a grid cell. Gets the image displayed in a grid cell. Overloaded. Gets a CellRange object that can be used to format and manipulate a cell. Overloaded. Gets a Drawing.Rectangle object with the coordinates of the cell within the control. Gets a custom CellStyle associated with a cell.

344 C1.Win.C1FlexGrid Namespace

GetCellStyleDisplay GetData GetDataDisplay GetUserData HitTest Invalidate IsCellCheckBox IsCellCursor IsCellFixed IsCellHighlighted IsCellSelected IsCellValid LoadExcel LoadExcelSheetNames LoadGrid PrintGrid ReadXml RemoveItem SaveExcel SaveGrid Select SetCellCheck SetCellImage SetCellStyle SetData SetDataBinding SetUserData

Gets the style used to render a cell. Overloaded. Gets the value of a grid cell. Overloaded. Gets the value in a grid cell, formatted as a string. Overloaded. Gets user data associated with a cell. Overloaded. Returns information about the control at the current mouse position. Overloaded. Overridden. Invalidates a cell range, causing it to be repainted. Gets a value that determines whether the cell contents are displayed as a checkbox. Gets a value that determines if a cell contains the grid cursor. Gets a value that determines if a cell belongs to a fixed row or column. Gets a value that determines if a cell is part of the selection and should be highlighted. Gets a value that determines if a cell is selected. Gets a value that determines if a pair of cell coordinates are valid. Overloaded. Loads the grid from the first worksheet in a Microsoft Excel (.xls) file. Gets a list with the names of the worksheets in a Microsoft Excel (.xls) file. Overloaded. Loads the grid from a file. Overloaded. Prints the grid, optionally showing a page setup or print preview dialog. Overloaded. Loads the grid from an XML document. Overloaded. Removes the last row from the grid. Overloaded. Saves the grid contents to a Microsoft Excel (.xls) file. Overloaded. Saves the grid contents to a file. Overloaded. Selects a range of cells and scrolls it into view. Sets the state of the checkbox in a grid cell. Sets the image displayed in a grid cell. Overloaded. Assigns a custom CellStyle to a cell. Overloaded. Assigns a value to a range of cells, coercing the value into each cell's specified DataType. Overloaded. Sets the DataSource and DataMember properties. Overloaded. Assigns user data to a cell.

C1FlexGridBase Methods 345

ShowCell ShowSortAt Sort StartEditing Subtotal WriteXml Protected Methods BuildScrollableRectangle

Scrolls a cell into view. Shows the sorting glyph on a column header. Overloaded. Sorts a range of cells in the grid. Overloaded. Puts the grid in edit mode and starts editing the current cell. Overloaded. Groups rows based on cell contents and calculates aggregate values. Overloaded. Saves the grid contents to an XML document. Overridden. Builds a rectangle that defines the scrollable portion of the control for a given pair of scroll offsets. Overridden. Creates a new accessibility object for the control. Overloaded. Overridden. Releases all resources used by the Control. Draws a grid cell. Draws a grid row. Gets the state for a Windows Xp theme while the mouse moves over a cell. Overridden. Determines if a character is an input character that the control recognizes. Overridden. Determines whether the specified key is a regular input key or a special key that requires preprocessing. Overridden. Raises the BackColorChanged event. Overridden. Raises the BindingContextChanged event. Overridden. Calculates the new position of a scrollbar in response to a user command. Overridden. Raises the DoubleClick event. Overridden. Raises the DragDrop event. Overridden. Raises the DragEnter event. Overridden. Raises the DragOver event. Overridden. Raises the FontChanged event. Overridden. Raises the ForeColorChanged event. Overridden. Raises the GotFocus event. Overridden. Raises the HandleDestroyed event. Overridden. Raises the KeyDown event. Overridden. Raises the KeyPress event. Overridden. Raises the Leave event.

CreateAccessibilityInstance Dispose DrawCell DrawRow GetHeaderThemeState IsInputChar IsInputKey

OnBackColorChanged OnBindingContextChanged OnChangeScrollBarPosition OnDoubleClick OnDragDrop OnDragEnter OnDragOver OnFontChanged OnForeColorChanged OnGotFocus OnHandleDestroyed OnKeyDown OnKeyPress OnLeave

346 C1.Win.C1FlexGrid Namespace

OnLostFocus OnMouseDown OnMouseLeave OnMouseMove OnMouseUp OnPaint OnPaintBackground OnScroll OnScrollTip OnSizeChanged OnThemeChanged OnValidating OnVisibleChanged See Also

Overridden. Raises the LostFocus event. Overridden. Raises the MouseDown event. Overridden. Raises the MouseLeave event. Overridden. Raises the MouseMove event. Overridden. Raises the MouseUp event. Overridden. Raises the Paint event. Overridden. Paints the control background. Overridden. Called when the grid contents scroll. Overridden. Called when the grid contents scroll vertically, to update the value of the scroll tip. Overridden. Raises the SizeChanged event. Overridden. Called when the control receives a WM_THEMECHANGED message. Overridden. Raises the Validating event. Overridden. Raises the VisibleChanged event.

C1FlexGridBase Class | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AddItem Method
Overload List Adds a row to the grid and populates the new row with data. [Visual Basic] Overloads Public Function AddItem(Object()) As Row [C#] public Row AddItem(object[]); [Delphi] public function AddItem(array of Object) : Row; overload; Adds a row to the grid and populates the new row with data. [Visual Basic] Overloads Public Function AddItem(String) As Row [C#] public Row AddItem(string); [Delphi] public function AddItem(String) : Row; overload; Adds a row to the grid at a specified position and populates the new row with data. [Visual Basic] Overloads Public Function AddItem(String, Integer) As Row [C#] public Row AddItem(string, int); [Delphi] public function AddItem(String; Int32) : Row; overload; Adds a row to the grid at a specified position and populates the new row with data. [Visual Basic] Overloads Public Function AddItem(Object(), Integer, Integer) As Row [C#] public Row AddItem(object[], int, int); [Delphi] public function AddItem(array of Object; Int32; Int32) : Row; overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AddItem Method 347

C1FlexGridBase.AddItem Method (Object[])


Adds a row to the grid and populates the new row with data. [Visual Basic] Overloads Public Function AddItem( _ ByVal items As Object() _ ) As Row [C#] public Row AddItem( object[] items ); [Delphi] public function AddItem( items: Object() ): Row; overload; Parameters items Array of objects that will be assigned to the new row. Return Value A reference to the new row. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.AddItem Overload List

C1FlexGridBase.AddItem Method (String)


Adds a row to the grid and populates the new row with data. [Visual Basic] Overloads Public Function AddItem( _ ByVal item As String _ ) As Row [C#] public Row AddItem( string item ); [Delphi] public function AddItem( item: String ): Row; overload; Parameters item String containing the data for the new row. Items are separated by tab characters by default. You can change the separator character using the ClipSeparators property.

348 C1.Win.C1FlexGrid Namespace

Return Value A reference to the new row. Remarks You can also add and remove rows using the Rows collection. The AddItem method provides a concise syntax for creating the row, populating it with data, and then adding it to the grid. Before using AddItem to add a large number of rows to the grid, remember to set the Redraw property to false. When finished adding the rows, set Redraw back to its original value. This will significantly improve performance. Example The code bellows adds 300 rows to the grid. Visual Basic ' suspend painting to improve performance Dim redraw As Boolean = flex.Redraw flex.Redraw = False ' append 100 rows, using tabs as separators flex.ClipSeparators = ControlChars.Tab + ControlChars.Lf Dim i As Integer For i = 0 To 99 flex.AddItem(ControlChars.Tab + "col1" + ControlChars.Tab + "col2" + ControlChars.Tab + "col3") Next i ' add 100 rows at the top, using pipes as separators flex.ClipSeparators = "|;" Dim i As Integer For i = 0 To 99 flex.AddItem("|col1|col2|col3", 0) Next i ' append 100 rows at the bottom, using an object array Dim items As Object() = {"col1", "col2", "col3"} Dim i As Integer For i = 0 To 99 flex.AddItem(items, flex.Rows.Count, flex.Cols.Fixed) Next i ' restore painting flex.Redraw = redraw C# // suspend painting to improve performance bool redraw = flex.Redraw; flex.Redraw = false; // append 100 rows, using tabs as separators flex.ClipSeparators = "\t\n"; for (int i = 0; i < 100; i++) flex.AddItem("\tcol1\tcol2\tcol3"); // add 100 rows at the top, using pipes as separators flex.ClipSeparators = "|;"; for (int i = 0; i < 100; i++)

C1FlexGridBase.AddItem Method 349

flex.AddItem("|col1|col2|col3", 0); // append 100 rows at the bottom, using an object array object[] items = { "col1", "col2", "col3" }; for (int i = 0; i < 100; i++) flex.AddItem(items, flex.Rows.Count, flex.Cols.Fixed); // restore painting flex.Redraw = redraw; Delphi // suspend painting to improve performance redraw := flex.Redraw; flex.Redraw := False; // add 100 rows, using tabs as separators flex.ClipSeparators := ''#9#10; i := 0; while (i < 100) do begin flex.AddItem(''#9'col1'#9'col2'#9'col3'); end; // add 100 rows at the top, using pipes as separators flex.ClipSeparators := '|;'; i := 0; while (i < 100) do begin flex.AddItem('|col1|col2|col3', 0); // append 100 rows at the bottom, using an object array i := 0; while (i < 100) do begin flex.AddItem(items, flex.Rows.Count, flex.Cols.Fixed); end; // restore painting flex.Redraw := redraw; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.AddItem Overload List

C1FlexGridBase.AddItem Method (String, Int32)


Adds a row to the grid at a specified position and populates the new row with data. [Visual Basic] Overloads Public Function AddItem( _ ByVal item As String, _ ByVal index As Integer _ ) As Row

350 C1.Win.C1FlexGrid Namespace

[C#] public Row AddItem( string item, int index ); [Delphi] public function AddItem( item: String; index: Int32 ): Row; overload; Parameters item String containing the data for the new row. Items are separated by tab characters by default. You can change the separator character using the ClipSeparators property. index Position where the new row will be inserted. Return Value A reference to the new row. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.AddItem Overload List

C1FlexGridBase.AddItem Method (Object[], Int32, Int32)


Adds a row to the grid at a specified position and populates the new row with data. [Visual Basic] Overloads Public Function AddItem( _ ByVal items As Object(), _ ByVal rowIndex As Integer, _ ByVal colIndex As Integer _ ) As Row [C#] public Row AddItem( object[] items, int rowIndex, int colIndex ); [Delphi] public function AddItem( items: Object(); rowIndex: Int32; colIndex: Int32 ): Row; overload;

C1FlexGridBase.Aggregate Method 351

Parameters items Array of objects that will be assigned to the new row. rowIndex Position where the new row will be inserted. colIndex First column to populate with the items in the items array. This parameter is usually set to the index of the first scrollable column. Return Value A reference to the new row. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.AddItem Overload List

C1FlexGridBase.Aggregate Method
Overload List Calculates aggregate statistics for the current selection. [Visual Basic] Overloads Public Function Aggregate(AggregateEnum) As Double [C#] public double Aggregate(AggregateEnum); [Delphi] public function Aggregate(AggregateEnum) : Double; overload; Calculates aggregate statistics for the current selection. [Visual Basic] Overloads Public Function Aggregate(AggregateEnum, AggregateFlags) As Double [C#] public double Aggregate(AggregateEnum, AggregateFlags); [Delphi] public function Aggregate(AggregateEnum; AggregateFlags) : Double; overload; Calculates aggregate statistics for a range. [Visual Basic] Overloads Public Function Aggregate(AggregateEnum, CellRange) As Double [C#] public double Aggregate(AggregateEnum, CellRange); [Delphi] public function Aggregate(AggregateEnum; CellRange) : Double; overload; Calculates aggregate statistics for a range. [Visual Basic] Overloads Public Function Aggregate(AggregateEnum, CellRange, AggregateFlags) As Double [C#] public double Aggregate(AggregateEnum, CellRange, AggregateFlags); [Delphi] public function Aggregate(AggregateEnum; CellRange; AggregateFlags) : Double; overload; Calculates aggregate statistics for a range. [Visual Basic] Overloads Public Function Aggregate(AggregateEnum, Integer, Integer, Integer, Integer) As Double [C#] public double Aggregate(AggregateEnum, int, int, int, int); [Delphi] public function Aggregate(AggregateEnum; Int32; Int32; Int32; Int32) : Double; overload;

352 C1.Win.C1FlexGrid Namespace

Calculates aggregate statistics for a range. [Visual Basic] Overloads Public Function Aggregate(AggregateEnum, Integer, Integer, Integer, Integer, AggregateFlags) As Double [C#] public double Aggregate(AggregateEnum, int, int, int, int, AggregateFlags); [Delphi] public function Aggregate(AggregateEnum; Int32; Int32; Int32; Int32; AggregateFlags) : Double; overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Aggregate Method (AggregateEnum)


Calculates aggregate statistics for the current selection. [Visual Basic] Overloads Public Function Aggregate( _ ByVal aggType As AggregateEnum _ ) As Double [C#] public double Aggregate( AggregateEnum aggType ); [Delphi] public function Aggregate( aggType: AggregateEnum ): Double; overload; Parameters aggType AggregateEnum value that specifies the type of aggregate to calculate. Return Value A Double that represents the aggregate value. Example The code below Aggregate method to calculate aggregate statistics for the current selection. Whenever the selection changes, new aggregates are calculated and written to the console. Visual Basic Private Sub flex_SelChange(sender As Object, e As System.EventArgs) Dim fmt As String = "Count {0:0}, Sum {1:#,##0.00}, " + "Avg {2:#,##0.00}, Stdev {3:#,##0.00}" Console.WriteLine(fmt, flex.Aggregate(AggregateEnum.Count), flex.Aggregate(AggregateEnum.Sum), flex.Aggregate(AggregateEnum.Average), flex.Aggregate(AggregateEnum.Std)) End Sub C# private void flex_SelChange(object sender, System.EventArgs e) { string fmt = "Count {0:0}, Sum {1:#,##0.00}, " +

C1FlexGridBase.Aggregate Method 353

"Avg {2:#,##0.00}, Stdev {3:#,##0.00}"; Console.WriteLine(fmt, flex.Aggregate(AggregateEnum.Count), flex.Aggregate(AggregateEnum.Sum), flex.Aggregate(AggregateEnum.Average), flex.Aggregate(AggregateEnum.Std)); } Delphi procedure flex_SelChange(sender: System.Object; e: System.EventArgs); var fmt: string; begin fmt := ('Count {0:0}, Sum {1:#,##0.00}, ' + 'Avg {2:#,##0.00}, Stdev {3:#,##0.00}'); Console.WriteLine(fmt, flex.Aggregate(AggregateEnum.Count), flex.Aggregate(AggregateEnum.Sum), flex.Aggregate(AggregateEnum.Average), flex.Aggregate(AggregateEnum.Std)); end;

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Aggregate Overload List

C1FlexGridBase.Aggregate Method (AggregateEnum, AggregateFlags)


Calculates aggregate statistics for the current selection. [Visual Basic] Overloads Public Function Aggregate( _ ByVal aggType As AggregateEnum, _ ByVal flags As AggregateFlags _ ) As Double [C#] public double Aggregate( AggregateEnum aggType, AggregateFlags flags ); [Delphi] public function Aggregate( aggType: AggregateEnum; flags: AggregateFlags ): Double; overload; Parameters aggType AggregateEnum value that specifies the type of aggregate to calculate. flags AggregateFlags value that specifies aggregation options.

354 C1.Win.C1FlexGrid Namespace

Return Value A Double that represents the aggregate value. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Aggregate Overload List

C1FlexGridBase.Aggregate Method (AggregateEnum, CellRange)


Calculates aggregate statistics for a range. [Visual Basic] Overloads Public Function Aggregate( _ ByVal aggType As AggregateEnum, _ ByVal rg As CellRange _ ) As Double [C#] public double Aggregate( AggregateEnum aggType, CellRange rg ); [Delphi] public function Aggregate( aggType: AggregateEnum; rg: CellRange ): Double; overload; Parameters aggType AggregateEnum value that specifies the type of aggregate to calculate. rg CellRange object that contains the values to be aggregated. Return Value A Double that represents the aggregate value. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Aggregate Overload List

C1FlexGridBase.Aggregate Method (AggregateEnum, CellRange, AggregateFlags)


Calculates aggregate statistics for a range. [Visual Basic] Overloads Public Function Aggregate( _ ByVal aggType As AggregateEnum, _ ByVal rg As CellRange, _ ByVal flags As AggregateFlags _ ) As Double

C1FlexGridBase.Aggregate Method 355

[C#] public double Aggregate( AggregateEnum aggType, CellRange rg, AggregateFlags flags ); [Delphi] public function Aggregate( aggType: AggregateEnum; rg: CellRange; flags: AggregateFlags ): Double; overload; Parameters aggType AggregateEnum value that specifies the type of aggregate to calculate. rg CellRange object that contains the values to be aggregated. flags AggregateFlags value that specifies aggregation options. Return Value A Double that represents the aggregate value. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Aggregate Overload List

C1FlexGridBase.Aggregate Method (AggregateEnum, Int32, Int32, Int32, Int32)


Calculates aggregate statistics for a range. [Visual Basic] Overloads Public Function Aggregate( _ ByVal aggType As AggregateEnum, _ ByVal topRow As Integer, _ ByVal leftCol As Integer, _ ByVal bottomRow As Integer, _ ByVal rightCol As Integer _ ) As Double [C#] public double Aggregate( AggregateEnum aggType, int topRow, int leftCol, int bottomRow, int rightCol );

356 C1.Win.C1FlexGrid Namespace

[Delphi] public function Aggregate( aggType: AggregateEnum; topRow: Int32; leftCol: Int32; bottomRow: Int32; rightCol: Int32 ): Double; overload; Parameters aggType AggregateEnum value that specifies the type of aggregate to calculate. topRow Top row in the range. leftCol Left column in the range. bottomRow Bottom row in the range. rightCol Right column in the range. Return Value A Double that represents the aggregate value. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Aggregate Overload List

C1FlexGridBase.Aggregate Method (AggregateEnum, Int32, Int32, Int32, Int32, AggregateFlags)


Calculates aggregate statistics for a range. [Visual Basic] Overloads Public Function Aggregate( _ ByVal aggType As AggregateEnum, _ ByVal topRow As Integer, _ ByVal leftCol As Integer, _ ByVal bottomRow As Integer, _ ByVal rightCol As Integer, _ ByVal flags As AggregateFlags _ ) As Double

C1FlexGridBase.AutoSizeCol Method 357

[C#] public double Aggregate( AggregateEnum aggType, int topRow, int leftCol, int bottomRow, int rightCol, AggregateFlags flags ); [Delphi] public function Aggregate( aggType: AggregateEnum; topRow: Int32; leftCol: Int32; bottomRow: Int32; rightCol: Int32; flags: AggregateFlags ): Double; overload; Parameters aggType AggregateEnum value that specifies the type of aggregate to calculate. topRow Top row in the range. leftCol Left column in the range. bottomRow Bottom row in the range. rightCol Right column in the range. flags AggregateFlags value that specifies aggregation options. Return Value A Double that represents the aggregate value. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Aggregate Overload List

C1FlexGridBase.AutoSizeCol Method
Overload List Adjusts the width of a column to fit the data. [Visual Basic] Overloads Overridable Public Sub AutoSizeCol(Integer) [C#] virtual public void AutoSizeCol(int); [Delphi] public procedure AutoSizeCol(Int32); overload; virtual;

358 C1.Win.C1FlexGrid Namespace

Adjusts the width of a column to fit the data. [Visual Basic] Overloads Overridable Public Sub AutoSizeCol(Integer, Integer) [C#] virtual public void AutoSizeCol(int, int); [Delphi] public procedure AutoSizeCol(Int32; Int32); overload; virtual; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AutoSizeCol Method (Int32)


Adjusts the width of a column to fit the data. [Visual Basic] Overloads Overridable Public Sub AutoSizeCol( _ ByVal col As Integer _ ) [C#] virtual public void AutoSizeCol( int col ); [Delphi] public procedure AutoSizeCol( col: Int32 ); overload; virtual; Parameters col Column index. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.AutoSizeCol Overload List

C1FlexGridBase.AutoSizeCol Method (Int32, Int32)


Adjusts the width of a column to fit the data. [Visual Basic] Overloads Overridable Public Sub AutoSizeCol( _ ByVal col As Integer, _ ByVal extraSpace As Integer _ ) [C#] virtual public void AutoSizeCol( int col, int extraSpace );

C1FlexGridBase.AutoSizeCols Method 359

[Delphi] public procedure AutoSizeCol( col: Int32; extraSpace: Int32 ); overload; virtual; Parameters col Column index. extraSpace Amount of extra space, in pixels, to add to the column widths. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.AutoSizeCol Overload List

C1FlexGridBase.AutoSizeCols Method
Overload List Adjusts the width of all columns to fit the data. [Visual Basic] Overloads Overridable Public Sub AutoSizeCols() [C#] virtual public void AutoSizeCols(); [Delphi] public procedure AutoSizeCols(); overload; virtual; Adjusts the width of all columns fit the data. [Visual Basic] Overloads Overridable Public Sub AutoSizeCols(Integer) [C#] virtual public void AutoSizeCols(int); [Delphi] public procedure AutoSizeCols(Int32); overload; virtual; Adjusts the width of columns in a range to fit the data. [Visual Basic] Overloads Overridable Public Sub AutoSizeCols(Integer, Integer, Integer) [C#] virtual public void AutoSizeCols(int, int, int); [Delphi] public procedure AutoSizeCols(Int32; Int32; Int32); overload; virtual; Adjusts the width of a column range to fit the data in a cell range. [Visual Basic] Overloads Overridable Public Sub AutoSizeCols(Integer, Integer, Integer, Integer, Integer, AutoSizeFlags) [C#] virtual public void AutoSizeCols(int, int, int, int, int, AutoSizeFlags); [Delphi] public procedure AutoSizeCols(Int32; Int32; Int32; Int32; Int32; AutoSizeFlags); overload; virtual; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AutoSizeCols Method ()
Adjusts the width of all columns to fit the data.

360 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overloads Overridable Public Sub AutoSizeCols() [C#] virtual public void AutoSizeCols() [Delphi] public procedure AutoSizeCols(); overload; virtual; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.AutoSizeCols Overload List

C1FlexGridBase.AutoSizeCols Method (Int32)


Adjusts the width of all columns fit the data. [Visual Basic] Overloads Overridable Public Sub AutoSizeCols( _ ByVal extraSpace As Integer _ ) [C#] virtual public void AutoSizeCols( int extraSpace ); [Delphi] public procedure AutoSizeCols( extraSpace: Int32 ); overload; virtual; Parameters extraSpace Amount of extra space, in pixels, to add to the column widths. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.AutoSizeCols Overload List

C1FlexGridBase.AutoSizeCols Method (Int32, Int32, Int32)


Adjusts the width of columns in a range to fit the data. [Visual Basic] Overloads Overridable Public Sub AutoSizeCols( _ ByVal leftCol As Integer, _ ByVal rightCol As Integer, _ ByVal extraSpace As Integer _ )

C1FlexGridBase.AutoSizeCols Method 361

[C#] virtual public void AutoSizeCols( int leftCol, int rightCol, int extraSpace ); [Delphi] public procedure AutoSizeCols( leftCol: Int32; rightCol: Int32; extraSpace: Int32 ); overload; virtual; Parameters leftCol Left column in the range. rightCol Right column in the range. extraSpace Amount of extra space, in pixels, to add to the column widths. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.AutoSizeCols Overload List

C1FlexGridBase.AutoSizeCols Method (Int32, Int32, Int32, Int32, Int32, AutoSizeFlags)


Adjusts the width of a column range to fit the data in a cell range. [Visual Basic] Overloads Overridable Public Sub AutoSizeCols( _ ByVal topRow As Integer, _ ByVal leftCol As Integer, _ ByVal bottomRow As Integer, _ ByVal rightCol As Integer, _ ByVal extraSpace As Integer, _ ByVal flags As AutoSizeFlags _ ) [C#] virtual public void AutoSizeCols( int topRow, int leftCol, int bottomRow, int rightCol, int extraSpace, AutoSizeFlags flags );

362 C1.Win.C1FlexGrid Namespace

[Delphi] public procedure AutoSizeCols( topRow: Int32; leftCol: Int32; bottomRow: Int32; rightCol: Int32; extraSpace: Int32; flags: AutoSizeFlags ); overload; virtual; Parameters topRow Top row in the range. leftCol Left column in the range. bottomRow Bottom row in the range. rightCol Right column in the range. extraSpace Amount of extra space, in pixels, to add to the column widths. flags Flags that control autosizing options. Remarks By default, the AutoSizeCols method measures every cell in each column, taking into account the cell contents and style. If the grid has a large number of rows, you can improve performance by using the topRow and bottomRow parameters to specify a row range. You can include only a few hundred rows in the process, and add some extra spacing for safety. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.AutoSizeCols Overload List

C1FlexGridBase.AutoSizeRow Method
Adjusts the height of a row to fit the data. [Visual Basic] Overridable Public Sub AutoSizeRow( _ ByVal row As Integer _ ) [C#] virtual public void AutoSizeRow( int row );

C1FlexGridBase.AutoSizeRows Method 363

[Delphi] public procedure AutoSizeRow( row: Int32 ); virtual; Parameters row Row index. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AutoSizeRows Method
Overload List Adjusts the height of all rows to fit the data. [Visual Basic] Overloads Overridable Public Sub AutoSizeRows() [C#] virtual public void AutoSizeRows(); [Delphi] public procedure AutoSizeRows(); overload; virtual; Adjusts the height of a row range to fit the data in a cell range. [Visual Basic] Overloads Overridable Public Sub AutoSizeRows(Integer, Integer, Integer, Integer, Integer, AutoSizeFlags) [C#] virtual public void AutoSizeRows(int, int, int, int, int, AutoSizeFlags); [Delphi] public procedure AutoSizeRows(Int32; Int32; Int32; Int32; Int32; AutoSizeFlags); overload; virtual; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AutoSizeRows Method ()
Adjusts the height of all rows to fit the data. [Visual Basic] Overloads Overridable Public Sub AutoSizeRows() [C#] virtual public void AutoSizeRows() [Delphi] public procedure AutoSizeRows(); overload; virtual; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.AutoSizeRows Overload List

C1FlexGridBase.AutoSizeRows Method (Int32, Int32, Int32, Int32, Int32, AutoSizeFlags)


Adjusts the height of a row range to fit the data in a cell range.

364 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overloads Overridable Public Sub AutoSizeRows( _ ByVal topRow As Integer, _ ByVal leftCol As Integer, _ ByVal bottomRow As Integer, _ ByVal rightCol As Integer, _ ByVal extraSpace As Integer, _ ByVal flags As AutoSizeFlags _ ) [C#] virtual public void AutoSizeRows( int topRow, int leftCol, int bottomRow, int rightCol, int extraSpace, AutoSizeFlags flags ); [Delphi] public procedure AutoSizeRows( topRow: Int32; leftCol: Int32; bottomRow: Int32; rightCol: Int32; extraSpace: Int32; flags: AutoSizeFlags ); overload; virtual; Parameters topRow Top row in the range. leftCol Left column in the range. bottomRow Bottom row in the range. rightCol Right column in the range. extraSpace Amount of extra space, in pixels, to add to the column widths. flags Flags that control autosizing options. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.AutoSizeRows Overload List

C1FlexGridBase.BeginInit Method 365

C1FlexGridBase.BeginInit Method
Signals the object that initialization is starting. [Visual Basic] Overridable Public Sub BeginInit() Implements ISupportInitialize.BeginInit [C#] virtual public void BeginInit() [Delphi] public procedure BeginInit(); virtual; Implements ISupportInitialize.BeginInit See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BuildScrollableRectangle Method
Builds a rectangle that defines the scrollable portion of the control for a given pair of scroll offsets. [Visual Basic] Overrides Protected Function BuildScrollableRectangle( _ ByVal dx As Integer, _ ByVal dy As Integer _ ) As Rectangle [C#] override protected Rectangle BuildScrollableRectangle( int dx, int dy ); [Delphi] strict protected function BuildScrollableRectangle( dx: Int32; dy: Int32 ): Rectangle; override; Parameters dx Horizontal scroll offset. dy Vertical scroll offset. Return Value A Drawing.Rectangle that defines the scrollable portion of the control. Remarks This method is for internal use. It allows derived classes to customize the control scrolling behavior.

366 C1.Win.C1FlexGrid Namespace

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Clear Method
Overload List Clears the grid. [Visual Basic] Overloads Public Sub Clear() [C#] public void Clear(); [Delphi] public procedure Clear(); overload; Clears the grid. [Visual Basic] Overloads Public Sub Clear(ClearFlags) [C#] public void Clear(ClearFlags); [Delphi] public procedure Clear(ClearFlags); overload; Clears a range. [Visual Basic] Overloads Public Sub Clear(ClearFlags, CellRange) [C#] public void Clear(ClearFlags, CellRange); [Delphi] public procedure Clear(ClearFlags; CellRange); overload; Clears a cell. [Visual Basic] Overloads Public Sub Clear(ClearFlags, Integer, Integer) [C#] public void Clear(ClearFlags, int, int); [Delphi] public procedure Clear(ClearFlags; Int32; Int32); overload; Clears a range. [Visual Basic] Overloads Public Sub Clear(ClearFlags, Integer, Integer, Integer, Integer) [C#] public void Clear(ClearFlags, int, int, int, int); [Delphi] public procedure Clear(ClearFlags; Int32; Int32; Int32; Int32); overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Clear Method ()
Clears the grid. [Visual Basic] Overloads Public Sub Clear() [C#] public void Clear() [Delphi] public procedure Clear(); overload; Remarks This method removes all data, styles, and user data from all cells, rows, and columns on the grid.

C1FlexGridBase.Clear Method 367

The Clear method does not affect the number of rows and columns on the grid, and can't be used to clear data when the grid is bound to a data source. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Clear Overload List

C1FlexGridBase.Clear Method (ClearFlags)


Clears the grid. [Visual Basic] Overloads Public Sub Clear( _ ByVal clearFlags As ClearFlags _ ) [C#] public void Clear( ClearFlags clearFlags ); [Delphi] public procedure Clear( clearFlags: ClearFlags ); overload; Parameters clearFlags ClearFlags value that specifies the elements to clear. Remarks The Clear method does not affect the number of rows and columns on the grid, and can't be used to clear data when the grid is bound to a data source. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Clear Overload List

C1FlexGridBase.Clear Method (ClearFlags, CellRange)


Clears a range. [Visual Basic] Overloads Public Sub Clear( _ ByVal clearFlags As ClearFlags, _ ByVal rg As CellRange _ ) [C#] public void Clear( ClearFlags clearFlags, CellRange rg );

368 C1.Win.C1FlexGrid Namespace

[Delphi] public procedure Clear( clearFlags: ClearFlags; rg: CellRange ); overload; Parameters clearFlags ClearFlags value that specifies the elements to clear. rg Range to clear. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Clear Overload List

C1FlexGridBase.Clear Method (ClearFlags, Int32, Int32)


Clears a cell. [Visual Basic] Overloads Public Sub Clear( _ ByVal clearFlags As ClearFlags, _ ByVal row As Integer, _ ByVal col As Integer _ ) [C#] public void Clear( ClearFlags clearFlags, int row, int col ); [Delphi] public procedure Clear( clearFlags: ClearFlags; row: Int32; col: Int32 ); overload; Parameters clearFlags ClearFlags value that specifies the elements to clear. row Row index. col Column index.

C1FlexGridBase.Clear Method 369

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Clear Overload List

C1FlexGridBase.Clear Method (ClearFlags, Int32, Int32, Int32, Int32)


Clears a range. [Visual Basic] Overloads Public Sub Clear( _ ByVal clearFlags As ClearFlags, _ ByVal topRow As Integer, _ ByVal leftCol As Integer, _ ByVal bottomRow As Integer, _ ByVal rightCol As Integer _ ) [C#] public void Clear( ClearFlags clearFlags, int topRow, int leftCol, int bottomRow, int rightCol ); [Delphi] public procedure Clear( clearFlags: ClearFlags; topRow: Int32; leftCol: Int32; bottomRow: Int32; rightCol: Int32 ); overload; Parameters clearFlags ClearFlags value that specifies the elements to clear. topRow Top row in the range. leftCol Left column in the range. bottomRow Bottom row in the range. rightCol Right column in the range. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Clear Overload List

370 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.CreateAccessibilityInstance Method
Creates a new accessibility object for the control. [Visual Basic] Overrides Protected Function CreateAccessibilityInstance() As AccessibleObject [C#] override protected AccessibleObject CreateAccessibilityInstance() [Delphi] strict protected function CreateAccessibilityInstance(): AccessibleObject; override; Return Value A new Windows.Forms.AccessibleObject for the control. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.CreateImage Method
Overload List Creates an image of the entire grid. [Visual Basic] Overloads Public Function CreateImage() As Image [C#] public Image CreateImage(); [Delphi] public function CreateImage() : Image; overload; Creates an image of a portion of the grid. [Visual Basic] Overloads Public Function CreateImage(CellRange) As Image [C#] public Image CreateImage(CellRange); [Delphi] public function CreateImage(CellRange) : Image; overload; Creates an image of a portion of the grid. [Visual Basic] Overloads Public Function CreateImage(CellRange, EmfType) As Image [C#] public Image CreateImage(CellRange, EmfType); [Delphi] public function CreateImage(CellRange; EmfType) : Image; overload; Creates an image of a portion of the grid. [Visual Basic] Overloads Public Function CreateImage(Integer, Integer, Integer, Integer) As Image [C#] public Image CreateImage(int, int, int, int); [Delphi] public function CreateImage(Int32; Int32; Int32; Int32) : Image; overload; Creates an image of a portion of the grid. [Visual Basic] Overloads Public Function CreateImage(Integer, Integer, Integer, Integer, EmfType) As Image [C#] public Image CreateImage(int, int, int, int, EmfType); [Delphi] public function CreateImage(Int32; Int32; Int32; Int32; EmfType) : Image; overload;

C1FlexGridBase.CreateImage Method 371

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.CreateImage Method ()
Creates an image of the entire grid. [Visual Basic] Overloads Public Function CreateImage() As Image [C#] public Image CreateImage() [Delphi] public function CreateImage(): Image; overload; Return Value An Drawing.Image object containing a metafile image of the grid. Remarks Use this method to copy grid images to the clipboard so you can paste them into documents or other applications. Example The code below creates an image of a grid range and saves it to a PNG file that can be included in other documents such as web pages: Visual Basic Dim img As Image = flex.CreateImage(0, 0, 10, 5) img.Save("c:\temp\grid.png", System.Drawing.Imaging.ImageFormat.Png) C# Image img = flex.CreateImage(0,0,10,5); img.Save(@"c:\temp\grid.png", System.Drawing.Imaging.ImageFormat.Png); Delphi var img : Image; img := flex.CreateImage(0, 0, 10, 5); img.Save('c:\temp\grid.png', System.Drawing.Imaging.ImageFormat.Png);

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.CreateImage Overload List

C1FlexGridBase.CreateImage Method (CellRange)


Creates an image of a portion of the grid. [Visual Basic] Overloads Public Function CreateImage( _ ByVal rg As CellRange _ ) As Image

372 C1.Win.C1FlexGrid Namespace

[C#] public Image CreateImage( CellRange rg ); [Delphi] public function CreateImage( rg: CellRange ): Image; overload; Parameters rg CellRange that specifies which cells should be included in the image. Return Value An Drawing.Image object containing a metafile image of the grid. Remarks The image returned includes any fixed and frozen cells in addition to the specified range. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.CreateImage Overload List

C1FlexGridBase.CreateImage Method (CellRange, EmfType)


Creates an image of a portion of the grid. [Visual Basic] Overloads Public Function CreateImage( _ ByVal rg As CellRange, _ ByVal emfType As EmfType _ ) As Image [C#] public Image CreateImage( CellRange rg, EmfType emfType ); [Delphi] public function CreateImage( rg: CellRange; emfType: EmfType ): Image; overload; Parameters rg CellRange that specifies which cells should be included in the image. emfType Drawing.Imaging.EmfType value that determines the type of metafile to create.

C1FlexGridBase.CreateImage Method 373

Return Value An Drawing.Image object containing a metafile image of the grid. Remarks The image returned includes any fixed and frozen cells in addition to the specified range. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.CreateImage Overload List

C1FlexGridBase.CreateImage Method (Int32, Int32, Int32, Int32)


Creates an image of a portion of the grid. [Visual Basic] Overloads Public Function CreateImage( _ ByVal topRow As Integer, _ ByVal leftCol As Integer, _ ByVal bottomRow As Integer, _ ByVal rightCol As Integer _ ) As Image [C#] public int int int int );

Image CreateImage( topRow, leftCol, bottomRow, rightCol

[Delphi] public function CreateImage( topRow: Int32; leftCol: Int32; bottomRow: Int32; rightCol: Int32 ): Image; overload; Parameters topRow Top row in the range. leftCol Left column in the range. bottomRow Bottom row in the range. rightCol Right column in the range. Return Value An Drawing.Image object containing a metafile image of the grid.

374 C1.Win.C1FlexGrid Namespace

Remarks The image returned includes any fixed and frozen cells in addition to the specified range. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.CreateImage Overload List

C1FlexGridBase.CreateImage Method (Int32, Int32, Int32, Int32, EmfType)


Creates an image of a portion of the grid. [Visual Basic] Overloads Public Function CreateImage( _ ByVal topRow As Integer, _ ByVal leftCol As Integer, _ ByVal bottomRow As Integer, _ ByVal rightCol As Integer, _ ByVal emfType As EmfType _ ) As Image [C#] public Image CreateImage( int topRow, int leftCol, int bottomRow, int rightCol, EmfType emfType ); [Delphi] public function CreateImage( topRow: Int32; leftCol: Int32; bottomRow: Int32; rightCol: Int32; emfType: EmfType ): Image; overload; Parameters topRow Top row in the range. leftCol Left column in the range. bottomRow Bottom row in the range. rightCol Right column in the range. emfType Drawing.Imaging.EmfType value that determines the type of metafile to create.

C1FlexGridBase.Dispose Method 375

Return Value An Drawing.Image object containing a metafile image of the grid. Remarks The image returned includes any fixed and frozen cells in addition to the specified range. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.CreateImage Overload List

C1FlexGridBase.Dispose Method
Releases all resources used by the Control. [Visual Basic] Overrides Protected Sub Dispose( _ ByVal disposing As Boolean _ ) [C#] override protected void Dispose( bool disposing ); [Delphi] strict protected procedure Dispose( disposing: Boolean ); overload; override; Parameters disposing True to release both managed and unmanaged resources; False to release only unmanaged resources. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.DrawCell Method
Draws a grid cell. [Visual Basic] Overridable Protected Function DrawCell( _ ByVal e As PaintEventArgs, _ ByVal row As Integer, _ ByVal col As Integer _ ) As Integer [C#] virtual protected int DrawCell( PaintEventArgs e, int row, int col );

376 C1.Win.C1FlexGrid Namespace

[Delphi] strict protected function DrawCell( e: PaintEventArgs; row: Int32; col: Int32 ): Int32; virtual; Parameters e A Windows.Forms.PaintEventArgs that contains a Drawing.Graphics object where the cell will be drawn. row Index of the cell's row. col Index of the cell's column. Return Value The index of the last column painted (may be greater than col if columns are merged). Remarks This method is for internal use. It allows inherited classes to customize the grid appearance. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.DrawRow Method
Draws a grid row. [Visual Basic] Overridable Protected Sub DrawRow( _ ByVal e As PaintEventArgs, _ ByVal row As Integer _ ) [C#] virtual protected void DrawRow( PaintEventArgs e, int row ); [Delphi] strict protected procedure DrawRow( e: PaintEventArgs; row: Int32 ); virtual; Parameters e A Windows.Forms.PaintEventArgs that contains a Drawing.Graphics object where the row will be drawn.

C1FlexGridBase.EndInit Method 377

row Index of the row to draw. Remarks This method is for internal use. It allows inherited classes to customize the grid appearance. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.EndInit Method
Signals the object that initialization is complete. [Visual Basic] Overridable Public Sub EndInit() Implements ISupportInitialize.EndInit [C#] virtual public void EndInit() [Delphi] public procedure EndInit(); virtual; Implements ISupportInitialize.EndInit See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.FindRow Method
Overload List Finds a row that contains a specified RowCol.UserData value. [Visual Basic] Overloads Overridable Public Function FindRow(Object, Integer, Integer, Boolean) As Integer [C#] virtual public int FindRow(object, int, int, bool); [Delphi] public function FindRow(Object; Int32; Int32; Boolean) : Int32; overload; virtual; Finds a row that contains a specified string. [Visual Basic] Overloads Overridable Public Function FindRow(String, Integer, Integer, Boolean, Boolean, Boolean) As Integer [C#] virtual public int FindRow(string, int, int, bool, bool, bool); [Delphi] public function FindRow(String; Int32; Int32; Boolean; Boolean; Boolean) : Int32; overload; virtual; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.FindRow Method (Object, Int32, Int32, Boolean)


Finds a row that contains a specified RowCol.UserData value.

378 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overloads Overridable Public Function FindRow( _ ByVal objFind As Object, _ ByVal rowStart As Integer, _ ByVal col As Integer, _ ByVal wrap As Boolean _ ) As Integer [C#] virtual public int FindRow( object objFind, int rowStart, int col, bool wrap ); [Delphi] public function FindRow( objFind: Object; rowStart: Int32; col: Int32; wrap: Boolean ): Int32; overload; virtual; Parameters objFind Object to look for. rowStart Index of the row where the search should start. col Column that contains the objects to be searched. wrap Whether the search should stop at the bottom of the grid or wrap around and restart from the first scrollable row. Return Value The index of the row that contains the data, or -1 if the data is not found. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.FindRow Overload List

C1FlexGridBase.FindRow Method (String, Int32, Int32, Boolean, Boolean, Boolean)


Finds a row that contains a specified string.

C1FlexGridBase.FindRow Method 379

[Visual Basic] Overloads Overridable Public Function FindRow( _ ByVal strFind As String, _ ByVal rowStart As Integer, _ ByVal col As Integer, _ ByVal caseSensitive As Boolean, _ ByVal fullMatch As Boolean, _ ByVal wrap As Boolean _ ) As Integer [C#] virtual public int FindRow( string strFind, int rowStart, int col, bool caseSensitive, bool fullMatch, bool wrap ); [Delphi] public function FindRow( strFind: String; rowStart: Int32; col: Int32; caseSensitive: Boolean; fullMatch: Boolean; wrap: Boolean ): Int32; overload; virtual; Parameters strFind String to look for. rowStart Index of the row where the search should start. col Column that contains the data to be searched. caseSensitive Whether the search should be case-sensitive. fullMatch Whether a full match is required. If this parameter is set to false, searching for "John" may return a row that contains "Johnson". wrap Whether the search should stop at the bottom of the grid or wrap around and restart from the first scrollable row. Return Value The index of the row that contains the string, or -1 if the string is not found.

380 C1.Win.C1FlexGrid Namespace

Remarks To allow users to search for data as they type, use the AutoSearch property. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.FindRow Overload List

C1FlexGridBase.FinishEditing Method
Overload List Finishes editing the current cell and takes the grid out of edit mode. [Visual Basic] Overloads Public Function FinishEditing() As Boolean [C#] public bool FinishEditing(); [Delphi] public function FinishEditing() : Boolean; overload; Finishes editing the current cell and takes the grid out of edit mode, optionally canceling the edits. [Visual Basic] Overloads Public Function FinishEditing(Boolean) As Boolean [C#] public bool FinishEditing(bool); [Delphi] public function FinishEditing(Boolean) : Boolean; overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.FinishEditing Method ()
Finishes editing the current cell and takes the grid out of edit mode. [Visual Basic] Overloads Public Function FinishEditing() As Boolean [C#] public bool FinishEditing() [Delphi] public function FinishEditing(): Boolean; overload; Return Value True if the grid left edit mode successfully, false otherwise. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.FinishEditing Overload List

C1FlexGridBase.FinishEditing Method (Boolean)


Finishes editing the current cell and takes the grid out of edit mode, optionally canceling the edits. [Visual Basic] Overloads Public Function FinishEditing( _ ByVal cancel As Boolean _ ) As Boolean

C1FlexGridBase.GetCellCheck Method 381

[C#] public bool FinishEditing( bool cancel ); [Delphi] public function FinishEditing( cancel: Boolean ): Boolean; overload; Parameters cancel Whether to cancel the current edits and revert the cell to its original value. Return Value True if the grid left edit mode successfully, false otherwise. Remarks If the cancel parameter is set to false, the grid tries to apply the edits, and fires the ValidateEdit, LeaveEdit, and AfterEdit events as usual. If validation fails, the grid stays in edit mode (and FinishEditing returns false). If the cancel parameter is set to true, the original cell value is restored and the grid is guaranteed to leave the edit mode. In this case, only the LeaveEdit event fires. To determine whether the grid is in edit mode, check whether the Editor property is null. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.FinishEditing Overload List

C1FlexGridBase.GetCellCheck Method
Gets the state of the checkbox in a grid cell. [Visual Basic] Overridable Public Function GetCellCheck( _ ByVal row As Integer, _ ByVal col As Integer _ ) As CheckEnum [C#] virtual public CheckEnum GetCellCheck( int row, int col ); [Delphi] public function GetCellCheck( row: Int32; col: Int32 ): CheckEnum; virtual; Parameters row Row index.

382 C1.Win.C1FlexGrid Namespace

col Column index. Return Value One of the values in the CheckEnum enumeration. Remarks By default, the grid displays values in Boolean columns as checkboxes (the column's data type determined by the RowCol.DataType property). If you don't want Boolean values displayed as checkboxes, set the column's RowCol.Format property to a string containing the values that should be displayed for True and False values, separated by a semi-colon. For example: Visual Basic flex.Cols("checkBoxes").DataType = Type.GetType(Boolean) flex.Cols("yesNo").DataType = Type.GetType(Boolean) flex.Cols("yesNo").Format = "Yes;No" C# flex.Cols["checkBoxes"].DataType = typeof(bool); flex.Cols["yesNo"].DataType = typeof(bool); flex.Cols["yesNo"].Format := "Yes;No"; Delphi flex.Cols['checkBoxes'].DataType := TypeOf(Boolean); flex.Cols['yesNo'].DataType := TypeOf(Boolean); flex.Cols['yesNo'].Format := 'Yes;No';

In unbound mode, you can use the GetCellCheck and SetCellCheck methods to add checkboxes to any cells. The checkboxes will be displayed along with any text in the cell, and you can set their position using the column's RowCol.ImageAlign property. There are two types of check boxes: Boolean and tri-state. Boolean check boxes toggle between the CheckEnum.Checked and CheckEnum.Unchecked states. Tri-state check boxes cycle through the settings CheckEnum.TSChecked, CheckEnum.TSUnchecked, and CheckEnum.TSGrayed. For example, the code below creates a Boolean checkbox in cell (3,3) and a tri-state checkbox in cell (4,3): Visual Basic flex.SetCellCheck(3, 3, CheckEnum.Unchecked) ' boolean flex.SetCellCheck(4, 3, CheckEnum.TSUnchecked) ' tri-state C# flex.SetCellCheck(3, 3, CheckEnum.Unchecked); // boolean flex.SetCellCheck(4, 3, CheckEnum.TSUnchecked); // tri-state Delphi flex.SetCellCheck(3, 3, CheckEnum.Unchecked); // boolean flex.SetCellCheck(4, 3, CheckEnum.TSUnchecked); // tri-state

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GetCellImage Method
Gets the image displayed in a grid cell.

C1FlexGridBase.GetCellRange Method 383

[Visual Basic] Public Function GetCellImage( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Image [C#] public Image GetCellImage( int row, int col ); [Delphi] public function GetCellImage( row: Int32; col: Int32 ): Image; Parameters row Row index. col Column index. Return Value An Drawing.Image object previously assigned to the cell using the SetCellImage method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GetCellRange Method
Overload List Gets a CellRange object that can be used to format and manipulate a cell. [Visual Basic] Overloads Public Function GetCellRange(Integer, Integer) As CellRange [C#] public CellRange GetCellRange(int, int); [Delphi] public function GetCellRange(Int32; Int32) : CellRange; overload; Gets a CellRange object that can be used to format and manipulate a range. [Visual Basic] Overloads Public Function GetCellRange(Integer, Integer, Integer, Integer) As CellRange [C#] public CellRange GetCellRange(int, int, int, int); [Delphi] public function GetCellRange(Int32; Int32; Int32; Int32) : CellRange; overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GetCellRange Method (Int32, Int32)


Gets a CellRange object that can be used to format and manipulate a cell.

384 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overloads Public Function GetCellRange( _ ByVal row As Integer, _ ByVal col As Integer _ ) As CellRange [C#] public CellRange GetCellRange( int row, int col ); [Delphi] public function GetCellRange( row: Int32; col: Int32 ): CellRange; overload; Parameters row Row index. col Column index. Return Value A CellRange object that can be used to format and manipulate the cell. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.GetCellRange Overload List

C1FlexGridBase.GetCellRange Method (Int32, Int32, Int32, Int32)


Gets a CellRange object that can be used to format and manipulate a range. [Visual Basic] Overloads Public Function GetCellRange( _ ByVal topRow As Integer, _ ByVal leftCol As Integer, _ ByVal bottomRow As Integer, _ ByVal rightCol As Integer _ ) As CellRange [C#] public int int int int );

CellRange GetCellRange( topRow, leftCol, bottomRow, rightCol

C1FlexGridBase.GetCellRange Method 385

[Delphi] public function GetCellRange( topRow: Int32; leftCol: Int32; bottomRow: Int32; rightCol: Int32 ): CellRange; overload; Parameters topRow Top row in the range. leftCol Left column in the range. bottomRow Bottom row in the range. rightCol Right column in the range. Return Value A CellRange object that can be used to format and manipulate the range. Remarks The CellRange object provides access to properties of the cells in the range. For example, the code below sets the style of a range: Visual Basic Dim rg As CellRange = flex.GetCellRange(5, 5, 20, 8) rg.Style = flex.Styles("MyStyle") C# CellRange rg = flex.GetCellRange(5, 5, 20, 8); rg.Style = flex.Styles["MyStyle"]; Delphi CellRange rg = flex.GetCellRange(5, 5, 20, 8); rg.Style = flex.Styles["MyStyle"];

Note: CellRange is a class, not a struct. Because of this, you have to assign the value to a variable and then use the variable. For example, the following code will not compile: Visual Basic ' this does not compile flex.GetCellRange(5, 5, 20, 8).Style = flex.Styles("MyStyle") C# // this does not compile flex.GetCellRange(5, 5, 20, 8).Style = flex.Styles["MyStyle"]; Delphi // this does not compile flex.GetCellRange(5, 5, 20, 8).Style := flex.Styles['MyStyle'];

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.GetCellRange Overload List

386 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GetCellRect Method
Overload List Gets a Drawing.Rectangle object with the coordinates of the cell within the control. [Visual Basic] Overloads Public Function GetCellRect(Integer, Integer) As Rectangle [C#] public Rectangle GetCellRect(int, int); [Delphi] public function GetCellRect(Int32; Int32) : Rectangle; overload; Gets a Drawing.Rectangle object with the coordinates of the cell within the control. [Visual Basic] Overloads Public Function GetCellRect(Integer, Integer, Boolean) As Rectangle [C#] public Rectangle GetCellRect(int, int, bool); [Delphi] public function GetCellRect(Int32; Int32; Boolean) : Rectangle; overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GetCellRect Method (Int32, Int32)


Gets a Drawing.Rectangle object with the coordinates of the cell within the control. [Visual Basic] Overloads Public Function GetCellRect( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Rectangle [C#] public Rectangle GetCellRect( int row, int col ); [Delphi] public function GetCellRect( row: Int32; col: Int32 ): Rectangle; overload; Parameters row Row index. col Column index. Remarks This property is useful if you need to implement custom editors or other elements that need to be positioned over cells. This method does not ensure the cell is visible.

C1FlexGridBase.GetCellStyle Method 387

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.GetCellRect Overload List

C1FlexGridBase.GetCellRect Method (Int32, Int32, Boolean)


Gets a Drawing.Rectangle object with the coordinates of the cell within the control. [Visual Basic] Overloads Public Function GetCellRect( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal show As Boolean _ ) As Rectangle [C#] public Rectangle GetCellRect( int row, int col, bool show ); [Delphi] public function GetCellRect( row: Int32; col: Int32; show: Boolean ): Rectangle; overload; Parameters row Row index. col Column index. show Whether to scroll the cell into view before calculating the rectangle. Return Value A Drawing.Rectangle object with the coordinates of the cell, in pixels and relative to the control's client area. Remarks This property is useful if you need to implement custom editors or other elements that need to be positioned over cells. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.GetCellRect Overload List

C1FlexGridBase.GetCellStyle Method
Gets a custom CellStyle associated with a cell.

388 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Function GetCellStyle( _ ByVal row As Integer, _ ByVal col As Integer _ ) As CellStyle [C#] public CellStyle GetCellStyle( int row, int col ); [Delphi] public function GetCellStyle( row: Int32; col: Int32 ): CellStyle; Parameters row Row index. col Column index Return Value CellStyle object associated with the cell, or null if the cell doesn't have a custom style. Remarks If the cell doesn't have a custom style, the grid paints it using one of the built-in styles. The built-in style is selected based on the cell position and state (fixed, scrollable, highlighted, and so on). To retrieve the style that will be used to paint the cell (custom or built-in) use the GetCellStyleDisplay method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GetCellStyleDisplay Method
Gets the style used to render a cell. [Visual Basic] Public Function GetCellStyleDisplay( _ ByVal row As Integer, _ ByVal col As Integer _ ) As CellStyle [C#] public CellStyle GetCellStyleDisplay( int row, int col );

C1FlexGridBase.GetData Method 389

[Delphi] public function GetCellStyleDisplay( row: Int32; col: Int32 ): CellStyle; Parameters row Row index. col Column index Return Value CellStyle object used to display the cell. Remarks The CellStyle object returned may be a composite with elements from several styles. For example, a cell with the focus is painted with a style that contains elements from the CellStyleCollection.Focus, a custom style associated with the cell, row, and column (if available), and the CellStyleCollection.Normal style. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GetData Method
Overload List Gets the value of a grid cell. [Visual Basic] Overloads Overridable Public Function GetData(Integer, Integer) As Object [C#] virtual public object GetData(int, int); [Delphi] public function GetData(Int32; Int32) : Object; overload; virtual; Gets the value of a grid cell. [Visual Basic] Overloads Overridable Public Function GetData(Integer, String) As Object [C#] virtual public object GetData(int, string); [Delphi] public function GetData(Int32; String) : Object; overload; virtual; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GetData Method (Int32, Int32)


Gets the value of a grid cell. [Visual Basic] Overloads Overridable Public Function GetData( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Object

390 C1.Win.C1FlexGrid Namespace

[C#] virtual public object GetData( int row, int col ); [Delphi] public function GetData( row: Int32; col: Int32 ): Object; overload; virtual; Parameters row Row index. col Column index. Return Value The value of the cell. Remarks The GetData method returns the raw data stored in a specific grid cell. It is equivalent to using the grid's indexer. For example: Visual Basic Dim o1 As Object = flex.GetData(1, 1) Dim o2 As Object = flex(1, 1) ' same thing C# object o1 = flex.GetData(1, 1); object o2 = flex[1, 1]; // same thing Delphi o1 := flex.GetData(1, 1); o2 := flex[1, 1]; // same thing

The data displayed on the grid might be different from the raw data, depending on the setting of the RowCol.Format and RowCol.DataMap properties. To obtain the display value (which is always a string), use the GetDataDisplay method instead. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.GetData Overload List

C1FlexGridBase.GetData Method (Int32, String)


Gets the value of a grid cell. [Visual Basic] Overloads Overridable Public Function GetData( _ ByVal row As Integer, _ ByVal colName As String _ ) As Object

C1FlexGridBase.GetDataDisplay Method 391

[C#] virtual public object GetData( int row, string colName ); [Delphi] public function GetData( row: Int32; colName: String ): Object; overload; virtual; Parameters row Row index. colName Column name. Return Value The value of the cell. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.GetData Overload List

C1FlexGridBase.GetDataDisplay Method
Overload List Gets the value in a grid cell, formatted as a string. [Visual Basic] Overloads Overridable Public Function GetDataDisplay(Integer, Integer) As String [C#] virtual public string GetDataDisplay(int, int); [Delphi] public function GetDataDisplay(Int32; Int32) : String; overload; virtual; Gets the value in a grid cell, formatted as a string. [Visual Basic] Overloads Overridable Public Function GetDataDisplay(Integer, String) As String [C#] virtual public string GetDataDisplay(int, string); [Delphi] public function GetDataDisplay(Int32; String) : String; overload; virtual; Gets the value in a grid cell, formatted as a string, and the image or checkbox in the cell. [Visual Basic] Overloads Overridable Public Function GetDataDisplay(Integer, Integer, ByRef Image, ByRef CheckEnum) As String [C#] virtual public string GetDataDisplay(int, int, ref Image, ref CheckEnum); [Delphi] public function GetDataDisplay(Int32; Int32; out Image; out CheckEnum) : String; overload; virtual;

392 C1.Win.C1FlexGrid Namespace

Gets the value in a grid cell, formatted as a string, and the image or checkbox in the cell. [Visual Basic] Overloads Overridable Public Function GetDataDisplay(Integer, String, ByRef Image, ByRef CheckEnum) As String [C#] virtual public string GetDataDisplay(int, string, ref Image, ref CheckEnum); [Delphi] public function GetDataDisplay(Int32; String; out Image; out CheckEnum) : String; overload; virtual; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GetDataDisplay Method (Int32, Int32)


Gets the value in a grid cell, formatted as a string. [Visual Basic] Overloads Overridable Public Function GetDataDisplay( _ ByVal row As Integer, _ ByVal col As Integer _ ) As String [C#] virtual public string GetDataDisplay( int row, int col ); [Delphi] public function GetDataDisplay( row: Int32; col: Int32 ): String; overload; virtual; Parameters row Row index. col Column index. Return Value A string containing the data displayed in the given grid cell. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.GetDataDisplay Overload List

C1FlexGridBase.GetDataDisplay Method (Int32, String)


Gets the value in a grid cell, formatted as a string.

C1FlexGridBase.GetDataDisplay Method 393

[Visual Basic] Overloads Overridable Public Function GetDataDisplay( _ ByVal row As Integer, _ ByVal colName As String _ ) As String [C#] virtual public string GetDataDisplay( int row, string colName ); [Delphi] public function GetDataDisplay( row: Int32; colName: String ): String; overload; virtual; Parameters row Row index. colName Column name. Return Value A string containing the data displayed in the given grid cell. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.GetDataDisplay Overload List

C1FlexGridBase.GetDataDisplay Method (Int32, Int32, ByRef Image, ByRef CheckEnum)


Gets the value in a grid cell, formatted as a string, and the image or checkbox in the cell. [Visual Basic] Overloads Overridable Public Function GetDataDisplay( _ ByVal row As Integer, _ ByVal col As Integer, _ ByRef img As Image, _ ByRef chk As CheckEnum _ ) As String [C#] virtual public string GetDataDisplay( int row, int col, out Image img, out CheckEnum chk );

394 C1.Win.C1FlexGrid Namespace

[Delphi] public function GetDataDisplay( row: Int32; col: Int32; out img: Image; out chk: CheckEnum ): String; overload; virtual; Parameters row Row index. col Column index. img Returns the image in the cell. chk Returns the checkbox value in the cell. Return Value A string containing the data displayed in the given grid cell. Remarks This method provides a way to retrieve all the data that is displayed in a cell with a single call. The image returned in the img parameter may be an image assigned to the cell using the SetCellImage method, a mapped value obtained through an RowCol.ImageMap, or an image stored as cell data (when the cell's RowCol.DataType is set to Image). The CheckEnum value returned in the chk parameter is the value returned by the GetCellCheck method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.GetDataDisplay Overload List

C1FlexGridBase.GetDataDisplay Method (Int32, String, ByRef Image, ByRef CheckEnum)


Gets the value in a grid cell, formatted as a string, and the image or checkbox in the cell. [Visual Basic] Overloads Overridable Public Function GetDataDisplay( _ ByVal row As Integer, _ ByVal colName As String, _ ByRef img As Image, _ ByRef chk As CheckEnum _ ) As String [C#] virtual public string GetDataDisplay( int row, string colName, out Image img, out CheckEnum chk );

C1FlexGridBase.GetHeaderThemeState Method 395

[Delphi] public function GetDataDisplay( row: Int32; colName: String; out img: Image; out chk: CheckEnum ): String; overload; virtual; Parameters row Row index. colName Column name. img Returns the image in the cell. chk Returns the checkbox value in the cell. Return Value A string containing the data displayed in the given grid cell. Remarks This method provides a way to retrieve all the data that is displayed in a cell with a single call. The image returned in the img parameter may be an image assigned to the cell using the SetCellImage method, a mapped value obtained through an RowCol.ImageMap, or an image stored as cell data (when the cell's RowCol.DataType is set to Image). The CheckEnum value returned in the chk parameter is the value returned by the GetCellCheck method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.GetDataDisplay Overload List

C1FlexGridBase.GetHeaderThemeState Method
Gets the state for a Windows Xp theme while the mouse moves over a cell. [Visual Basic] Overridable Protected Function GetHeaderThemeState( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Integer [C#] virtual protected int GetHeaderThemeState( int row, int col );

396 C1.Win.C1FlexGrid Namespace

[Delphi] strict protected function GetHeaderThemeState( row: Int32; col: Int32 ): Int32; virtual; Parameters row Row under the mouse. col Column under the mouse. Return Value An integer representing the item state (2 for hot-tracking, 1 for normal). Remarks This method is for internal use. It allows inherited classes to customize the hot-tracking behavior. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GetUserData Method
Overload List Gets user data associated with a cell. [Visual Basic] Overloads Overridable Public Function GetUserData(Integer, Integer) As Object [C#] virtual public object GetUserData(int, int); [Delphi] public function GetUserData(Int32; Int32) : Object; overload; virtual; Gets user data associated with a cell. [Visual Basic] Overloads Overridable Public Function GetUserData(Integer, String) As Object [C#] virtual public object GetUserData(int, string); [Delphi] public function GetUserData(Int32; String) : Object; overload; virtual; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GetUserData Method (Int32, Int32)


Gets user data associated with a cell. [Visual Basic] Overloads Overridable Public Function GetUserData( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Object

C1FlexGridBase.GetUserData Method 397

[C#] virtual public object GetUserData( int row, int col ); [Delphi] public function GetUserData( row: Int32; col: Int32 ): Object; overload; virtual; Parameters row Row index. col Column index. Return Value Object associated with the cell. Remarks The user data is not used internally by the grid. It is reserved for additional data that you may want to associate with a cell. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.GetUserData Overload List

C1FlexGridBase.GetUserData Method (Int32, String)


Gets user data associated with a cell. [Visual Basic] Overloads Overridable Public Function GetUserData( _ ByVal row As Integer, _ ByVal colName As String _ ) As Object [C#] virtual public object GetUserData( int row, string colName ); [Delphi] public function GetUserData( row: Int32; colName: String ): Object; overload; virtual;

398 C1.Win.C1FlexGrid Namespace

Parameters row Row index. colName Column name. Return Value Object associated with the cell. Remarks The user data is not used internally by the grid. It is reserved for additional data that you may want to associate with a cell. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.GetUserData Overload List

C1FlexGridBase.HitTest Method
Overload List Returns information about the control at the current mouse position. [Visual Basic] Overloads Public Function HitTest() As HitTestInfo [C#] public HitTestInfo HitTest(); [Delphi] public function HitTest() : HitTestInfo; overload; Returns information about the control at a specified point on the control surface. [Visual Basic] Overloads Public Function HitTest(Point) As HitTestInfo [C#] public HitTestInfo HitTest(Point); [Delphi] public function HitTest(Point) : HitTestInfo; overload; Returns information about the control at a specified point on the control surface. [Visual Basic] Overloads Public Function HitTest(Integer, Integer) As HitTestInfo [C#] public HitTestInfo HitTest(int, int); [Delphi] public function HitTest(Int32; Int32) : HitTestInfo; overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.HitTest Method ()
Returns information about the control at the current mouse position. [Visual Basic] Overloads Public Function HitTest() As HitTestInfo [C#] public HitTestInfo HitTest()

C1FlexGridBase.HitTest Method 399

[Delphi] public function HitTest(): HitTestInfo; overload; Return Value A HitTestInfo object that contains information about the point. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.HitTest Overload List

C1FlexGridBase.HitTest Method (Point)


Returns information about the control at a specified point on the control surface. [Visual Basic] Overloads Public Function HitTest( _ ByVal pt As Point _ ) As HitTestInfo [C#] public HitTestInfo HitTest( Point pt ); [Delphi] public function HitTest( pt: Point ): HitTestInfo; overload; Parameters pt Drawing.Point in client coordinates. Return Value A HitTestInfo object that contains information about the point. Remarks This method is especially useful when handling the BeforeMouseDown event. It allows you to determine whether the mouse is over a specific cell, grid buttons, resizing elements, and so on. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.HitTest Overload List

C1FlexGridBase.HitTest Method (Int32, Int32)


Returns information about the control at a specified point on the control surface. [Visual Basic] Overloads Public Function HitTest( _ ByVal x As Integer, _ ByVal y As Integer _ ) As HitTestInfo

400 C1.Win.C1FlexGrid Namespace

[C#] public HitTestInfo HitTest( int x, int y ); [Delphi] public function HitTest( x: Int32; y: Int32 ): HitTestInfo; overload; Parameters x The horizontal position of the client coordinate. y The vertical position of the client coordinate. Return Value A HitTestInfo object that contains information about the point. Remarks This method is especially useful when handling the BeforeMouseDown event. It allows you to determine whether the mouse is over a specific cell, grid buttons, resizing elements, and so on. Example The code below shows hit test information whenever the user clicks the mouse: Visual Basic Private Sub _flex_BeforeMouseDown(sender As Object, e As BeforeMouseDownEventArgs) Dim hti As HitTestInfo = _flex.HitTest(e.X, e.Y) Console.WriteLine("at {0},{1}: row {2} col {3} type {4}", _ hti.X, hti.Y, hti.Row, hti.Column, hti.Type) End Sub C# private void _flex_BeforeMouseDown(object sender, BeforeMouseDownEventArgs e) { HitTestInfo hti = _flex.HitTest(e.X, e.Y); Console.WriteLine("at {0},{1}: row {2} col {3} type {4}", hti.X, hti.Y, hti.Row, hti.Column, hti.Type); } Delphi procedure _flex_BeforeMouseDown(sender: object; e: BeforeMouseDownEventArgs); var hti: HitTestInfo; items: array of object; begin hti := _flex.HitTest(e.X, e.Y); SetLength(items, 5); items[0] := System.Object(hti.X);

C1FlexGridBase.Invalidate Method 401

items[1] := System.Object(hti.Y); items[2] := System.Object(hti.Row); items[3] := System.Object(hti.Column); items[4] := System.Object(hti.Type); Console.WriteLine('at {0},{1}: row {2} col {3} type {4}', items); end; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.HitTest Overload List

C1FlexGridBase.Invalidate Method
Overload List Invalidates a cell range, causing it to be repainted. [Visual Basic] Overloads Overrides Public Sub Invalidate(CellRange) [C#] override public void Invalidate(CellRange); [Delphi] public procedure Invalidate(CellRange); overload; override; Invalidates a cell, causing it to be repainted. [Visual Basic] Overloads Public Sub Invalidate(Integer, Integer) [C#] public void Invalidate(int, int); [Delphi] public procedure Invalidate(Int32; Int32); overload; Invalidates a cell range, causing it to be repainted. [Visual Basic] Overloads Public Sub Invalidate(Integer, Integer, Integer, Integer) [C#] public void Invalidate(int, int, int, int); [Delphi] public procedure Invalidate(Int32; Int32; Int32; Int32); overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Invalidate Method (CellRange)


Invalidates a cell range, causing it to be repainted. [Visual Basic] Overloads Overrides Public Sub Invalidate( _ ByVal rg As CellRange _ ) [C#] override public void Invalidate( CellRange rg ); [Delphi] public procedure Invalidate( rg: CellRange ); overload; override;

402 C1.Win.C1FlexGrid Namespace

Parameters rg CellRange that will be invalidated. Remarks This method is rarely used by the programmer, since the grid automatically performs invalidation as needed. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Invalidate Overload List

C1FlexGridBase.Invalidate Method (Int32, Int32)


Invalidates a cell, causing it to be repainted. [Visual Basic] Overloads Public Sub Invalidate( _ ByVal row As Integer, _ ByVal col As Integer _ ) [C#] public void Invalidate( int row, int col ); [Delphi] public procedure Invalidate( row: Int32; col: Int32 ); overload; Parameters row Row index. col Column index. Remarks This method is rarely used by the programmer, since the grid automatically performs invalidation as needed. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Invalidate Overload List

C1FlexGridBase.Invalidate Method (Int32, Int32, Int32, Int32)


Invalidates a cell range, causing it to be repainted.

C1FlexGridBase.IsCellCheckBox Method 403

[Visual Basic] Overloads Public Sub Invalidate( _ ByVal topRow As Integer, _ ByVal leftCol As Integer, _ ByVal bottomRow As Integer, _ ByVal rightCol As Integer _ ) [C#] public int int int int );

void Invalidate( topRow, leftCol, bottomRow, rightCol

[Delphi] public procedure Invalidate( topRow: Int32; leftCol: Int32; bottomRow: Int32; rightCol: Int32 ); overload; Parameters topRow Top row in the range. leftCol Left column in the range. bottomRow Bottom row in the range. rightCol Right column in the range. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Invalidate Overload List

C1FlexGridBase.IsCellCheckBox Method
Gets a value that determines whether the cell contents are displayed as a checkbox. [Visual Basic] Overridable Public Function IsCellCheckBox( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Boolean

404 C1.Win.C1FlexGrid Namespace

[C#] virtual public bool IsCellCheckBox( int row, int col ); [Delphi] public function IsCellCheckBox( row: Int32; col: Int32 ): Boolean; virtual; Parameters row Row index. col Column index. Return Value True if the cell contents should be displayed as a checkbox, false otherwise. Remarks Boolean values are displayed as checkboxes unless one of the following conditions is true: 1) The cell has an associated RowCol.DataMap. In this case the values specified in the DataMap are displayed instead of checkboxes. 2) The cell has a multi-part RowCol.Format string (such as "yes;no"). In this case the Format is used instead of checkboxes. 3) The cell belongs to a subtotal row and does not contain a Boolean value. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.IsCellCursor Method
Gets a value that determines if a cell contains the grid cursor. [Visual Basic] Overridable Public Function IsCellCursor( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Boolean [C#] virtual public bool IsCellCursor( int row, int col );

C1FlexGridBase.IsCellFixed Method 405

[Delphi] public function IsCellCursor( row: Int32; col: Int32 ): Boolean; virtual; Parameters row Row index. col Column index. Return Value True if the cell contains the cursor, false otherwise. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.IsCellFixed Method
Gets a value that determines if a cell belongs to a fixed row or column. [Visual Basic] Overridable Public Function IsCellFixed( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Boolean [C#] virtual public bool IsCellFixed( int row, int col ); [Delphi] public function IsCellFixed( row: Int32; col: Int32 ): Boolean; virtual; Parameters row Row index. col Column index. Return Value True if the cell is fixed, false othwerwise. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

406 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.IsCellHighlighted Method
Gets a value that determines if a cell is part of the selection and should be highlighted. [Visual Basic] Overridable Public Function IsCellHighlighted( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Boolean [C#] virtual public bool IsCellHighlighted( int row, int col ); [Delphi] public function IsCellHighlighted( row: Int32; col: Int32 ): Boolean; virtual; Parameters row Row index. col Column index. Return Value True if the cell should be highlighted, false otherwise. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.IsCellSelected Method
Gets a value that determines if a cell is selected. [Visual Basic] Overridable Public Function IsCellSelected( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Boolean [C#] virtual public bool IsCellSelected( int row, int col );

C1FlexGridBase.IsCellValid Method 407

[Delphi] public function IsCellSelected( row: Int32; col: Int32 ): Boolean; virtual; Parameters row Row index. col Column index. Return Value True if the cell is selected, false othwerwise. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.IsCellValid Method
Gets a value that determines if a pair of cell coordinates are valid. [Visual Basic] Overridable Public Function IsCellValid( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Boolean [C#] virtual public bool IsCellValid( int row, int col ); [Delphi] public function IsCellValid( row: Int32; col: Int32 ): Boolean; virtual; Parameters row Row index. col Column index. Return Value True if the cell coordinates are valid, false othwerwise. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

408 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.IsInputChar Method
Determines if a character is an input character that the control recognizes. [Visual Basic] Overrides Protected Function IsInputChar( _ ByVal charCode As Char _ ) As Boolean [C#] override protected bool IsInputChar( char charCode ); [Delphi] strict protected function IsInputChar( charCode: Char ): Boolean; override; Parameters charCode The character to test. Return Value True if the character should be sent directly to the control and not preprocessed, False otherwise. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.IsInputKey Method
Determines whether the specified key is a regular input key or a special key that requires preprocessing. [Visual Basic] Overrides Protected Function IsInputKey( _ ByVal keyData As Keys _ ) As Boolean [C#] override protected bool IsInputKey( Keys keyData ); [Delphi] strict protected function IsInputKey( keyData: Keys ): Boolean; override; Parameters keyData One of the Windows.Forms.Keys values. Return Value True if the specified key is a regular input key, False otherwise.

C1FlexGridBase.LoadExcel Method 409

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.LoadExcel Method
Overload List Loads the grid from the first worksheet in a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub LoadExcel(String) [C#] public void LoadExcel(string); [Delphi] public procedure LoadExcel(String); overload; Loads the grid from the first worksheet in a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub LoadExcel(String, FileFlags) [C#] public void LoadExcel(string, FileFlags); [Delphi] public procedure LoadExcel(String; FileFlags); overload; Loads the grid from a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub LoadExcel(String, String) [C#] public void LoadExcel(string, string); [Delphi] public procedure LoadExcel(String; String); overload; Loads the grid from a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub LoadExcel(String, String, FileFlags) [C#] public void LoadExcel(string, string, FileFlags); [Delphi] public procedure LoadExcel(String; String; FileFlags); overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.LoadExcel Method (String)


Loads the grid from the first worksheet in a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub LoadExcel( _ ByVal fileName As String _ ) [C#] public void LoadExcel( string fileName ); [Delphi] public procedure LoadExcel( fileName: String ); overload;

410 C1.Win.C1FlexGrid Namespace

Parameters fileName Name of the file to load, including the path. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.LoadExcel Overload List

C1FlexGridBase.LoadExcel Method (String, FileFlags)


Loads the grid from the first worksheet in a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub LoadExcel( _ ByVal fileName As String, _ ByVal flags As FileFlags _ ) [C#] public void LoadExcel( string fileName, FileFlags flags ); [Delphi] public procedure LoadExcel( fileName: String; flags: FileFlags ); overload; Parameters fileName Name of the file to load, including the path. flags Options to use when loading the file. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.LoadExcel Overload List

C1FlexGridBase.LoadExcel Method (String, String)


Loads the grid from a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub LoadExcel( _ ByVal fileName As String, _ ByVal sheetName As String _ )

C1FlexGridBase.LoadExcel Method 411

[C#] public void LoadExcel( string fileName, string sheetName ); [Delphi] public procedure LoadExcel( fileName: String; sheetName: String ); overload; Parameters fileName Name of the file to load, including the path. sheetName Name of the worksheet to load. Remarks Use the LoadExcelSheetNames method to obtain a list of the worksheets in an .xls file. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.LoadExcel Overload List

C1FlexGridBase.LoadExcel Method (String, String, FileFlags)


Loads the grid from a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub LoadExcel( _ ByVal fileName As String, _ ByVal sheetName As String, _ ByVal flags As FileFlags _ ) [C#] public void LoadExcel( string fileName, string sheetName, FileFlags flags ); [Delphi] public procedure LoadExcel( fileName: String; sheetName: String; flags: FileFlags ); overload; Parameters fileName Name of the file to load, including the path.

412 C1.Win.C1FlexGrid Namespace

sheetName Name of the worksheet to load. flags Options to use when loading the file. Remarks Use the LoadExcelSheetNames method to obtain a list of the worksheets in an .xls file. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.LoadExcel Overload List

C1FlexGridBase.LoadExcelSheetNames Method
Gets a list with the names of the worksheets in a Microsoft Excel (.xls) file. [Visual Basic] Public Function LoadExcelSheetNames( _ ByVal fileName As String _ ) As String() [C#] public string[] LoadExcelSheetNames( string fileName ); [Delphi] public function LoadExcelSheetNames( fileName: String ): array of String; Parameters fileName Name of the Excel file, including the path. Return Value An array containing the names of the worksheets defined in the file. Remarks This method is used to obtain a list of sheet names that can later be used to load and save specific sheets using the LoadExcel and SaveExcel methods. Example The code below loads all sheets in an Excel workbook into a collection of grids in a TabControl: Visual Basic ' clear tabControl tabControl.TabPages.Clear() ' load sheet names Dim fileName As String = Dim sheets() As String =

"c:\book1.xls" _flexGrid.LoadExcelSheetNames(fileName)

C1FlexGridBase.LoadGrid Method 413

' load each sheet Dim sheetName As String For Each sheetName In sheets ' create a new grid for this sheet Dim flex As C1FlexGrid = New C1FlexGrid() flex.Dock = DockStyle.Fill ' load sheet into new grid flex.LoadExcel(fileName, sheetName) ' add grid to the tabControl Dim page As TabPage = New TabPage() page.Controls.Add(flex) page.Text = sheetName tabControl.TabPages.Add(page) Next C# // clear tabControl tabControl.TabPages.Clear(); // load sheet names string fileName = "c:\book1.xls"; string[] sheets = _flexGrid.LoadExcelSheetNames(fileName); // load each sheet foreach (string sheetName in sheets) { // create a new grid for this sheet C1FlexGrid flex = new C1FlexGrid(); flex.Dock = DockStyle.Fill; // load sheet into new grid flex.LoadExcel(fileName, sheetName); // add grid to the tabControl TabPage page = new TabPage(); page.Controls.Add(flex); page.Text = sheetName; tabControl.TabPages.Add(page); } Delphi -- N/A

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.LoadGrid Method
Overload List Loads the grid from a file. [Visual Basic] Overloads Public Sub LoadGrid(String, FileFormatEnum) [C#] public void LoadGrid(string, FileFormatEnum); [Delphi] public procedure LoadGrid(String; FileFormatEnum); overload;

414 C1.Win.C1FlexGrid Namespace

Loads the grid from a file. [Visual Basic] Overloads Public Sub LoadGrid(String, FileFormatEnum, FileFlags) [C#] public void LoadGrid(string, FileFormatEnum, FileFlags); [Delphi] public procedure LoadGrid(String; FileFormatEnum; FileFlags); overload; Loads the grid from a file. [Visual Basic] Overloads Public Sub LoadGrid(String, FileFormatEnum, FileFlags, Encoding) [C#] public void LoadGrid(string, FileFormatEnum, FileFlags, Encoding); [Delphi] public procedure LoadGrid(String; FileFormatEnum; FileFlags; Encoding); overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.LoadGrid Method (String, FileFormatEnum)


Loads the grid from a file. [Visual Basic] Overloads Public Sub LoadGrid( _ ByVal fileName As String, _ ByVal format As FileFormatEnum _ ) [C#] public void LoadGrid( string fileName, FileFormatEnum format ); [Delphi] public procedure LoadGrid( fileName: String; format: FileFormatEnum ); overload; Parameters fileName Name of the file to load, including the path. format File format to use. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.LoadGrid Overload List

C1FlexGridBase.LoadGrid Method (String, FileFormatEnum, FileFlags)


Loads the grid from a file.

C1FlexGridBase.LoadGrid Method 415

[Visual Basic] Overloads Public Sub LoadGrid( _ ByVal fileName As String, _ ByVal format As FileFormatEnum, _ ByVal flags As FileFlags _ ) [C#] public void LoadGrid( string fileName, FileFormatEnum format, FileFlags flags ); [Delphi] public procedure LoadGrid( fileName: String; format: FileFormatEnum; flags: FileFlags ); overload; Parameters fileName Name of the file to load, including the path. format File format to use. flags Options to use when loading the file. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.LoadGrid Overload List

C1FlexGridBase.LoadGrid Method (String, FileFormatEnum, FileFlags, Encoding)


Loads the grid from a file. [Visual Basic] Overloads Public Sub LoadGrid( _ ByVal fileName As String, _ ByVal format As FileFormatEnum, _ ByVal flags As FileFlags, _ ByVal encoding As Encoding _ ) [C#] public void LoadGrid( string fileName, FileFormatEnum format, FileFlags flags, Encoding encoding );

416 C1.Win.C1FlexGrid Namespace

[Delphi] public procedure LoadGrid( fileName: String; format: FileFormatEnum; flags: FileFlags; encoding: Encoding ); overload; Parameters fileName Name of the file to load, including the path. format File format to use. flags Options to use when loading the file. encoding Text.Encoding to use when saving the file. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.LoadGrid Overload List

C1FlexGridBase.OnBackColorChanged Method
Raises the BackColorChanged event. [Visual Basic] Overrides Protected Sub OnBackColorChanged( _ ByVal e As EventArgs _ ) [C#] override protected void OnBackColorChanged( EventArgs e ); [Delphi] strict protected procedure OnBackColorChanged( e: EventArgs ); override; Parameters e An EventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnBindingContextChanged Method 417

C1FlexGridBase.OnBindingContextChanged Method
Raises the BindingContextChanged event. [Visual Basic] Overrides Protected Sub OnBindingContextChanged( _ ByVal e As EventArgs _ ) [C#] override protected void OnBindingContextChanged( EventArgs e ); [Delphi] strict protected procedure OnBindingContextChanged( e: EventArgs ); override; Parameters e An EventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnChangeScrollBarPosition Method
Calculates the new position of a scrollbar in response to a user command. [Visual Basic] Overrides Protected Function OnChangeScrollBarPosition( _ ByVal cmd As Integer, _ ByVal verticalBar As Boolean, _ ByVal curPos As Integer, _ ByVal trackPos As Integer _ ) As Integer [C#] override protected int OnChangeScrollBarPosition( int cmd, bool verticalBar, int curPos, int trackPos ); [Delphi] strict protected function OnChangeScrollBarPosition( cmd: Int32; verticalBar: Boolean; curPos: Int32; trackPos: Int32 ): Int32; override;

418 C1.Win.C1FlexGrid Namespace

Parameters cmd Scroll command (SB_LINEUP, and so on). verticalBar True for the vertical scrollbar, false for the horizontal scrollbar. curPos Current scrollbar position. trackPos Scrollbar thumb position. Return Value The new position for the scrollbar. Remarks Derived classes may override this method to customize the scrolling behavior. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnDoubleClick Method
Raises the DoubleClick event. [Visual Basic] Overrides Protected Sub OnDoubleClick( _ ByVal e As EventArgs _ ) [C#] override protected void OnDoubleClick( EventArgs e ); [Delphi] strict protected procedure OnDoubleClick( e: EventArgs ); override; Parameters e An EventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnDragDrop Method
Raises the DragDrop event.

C1FlexGridBase.OnDragEnter Method 419

[Visual Basic] Overrides Protected Sub OnDragDrop( _ ByVal e As DragEventArgs _ ) [C#] override protected void OnDragDrop( DragEventArgs e ); [Delphi] strict protected procedure OnDragDrop( e: DragEventArgs ); override; Parameters e A Windows.Forms.DragEventArgs that contains event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnDragEnter Method
Raises the DragEnter event. [Visual Basic] Overrides Protected Sub OnDragEnter( _ ByVal e As DragEventArgs _ ) [C#] override protected void OnDragEnter( DragEventArgs e ); [Delphi] strict protected procedure OnDragEnter( e: DragEventArgs ); override; Parameters e A Windows.Forms.DragEventArgs that contains event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnDragOver Method
Raises the DragOver event.

420 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overrides Protected Sub OnDragOver( _ ByVal e As DragEventArgs _ ) [C#] override protected void OnDragOver( DragEventArgs e ); [Delphi] strict protected procedure OnDragOver( e: DragEventArgs ); override; Parameters e A Windows.Forms.DragEventArgs that contains event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnFontChanged Method
Raises the FontChanged event. [Visual Basic] Overrides Protected Sub OnFontChanged( _ ByVal e As EventArgs _ ) [C#] override protected void OnFontChanged( EventArgs e ); [Delphi] strict protected procedure OnFontChanged( e: EventArgs ); override; Parameters e An EventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnForeColorChanged Method
Raises the ForeColorChanged event.

C1FlexGridBase.OnGotFocus Method 421

[Visual Basic] Overrides Protected Sub OnForeColorChanged( _ ByVal e As EventArgs _ ) [C#] override protected void OnForeColorChanged( EventArgs e ); [Delphi] strict protected procedure OnForeColorChanged( e: EventArgs ); override; Parameters e An EventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnGotFocus Method
Raises the GotFocus event. [Visual Basic] Overrides Protected Sub OnGotFocus( _ ByVal e As EventArgs _ ) [C#] override protected void OnGotFocus( EventArgs e ); [Delphi] strict protected procedure OnGotFocus( e: EventArgs ); override; Parameters e An EventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnHandleDestroyed Method
Raises the HandleDestroyed event.

422 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overrides Protected Sub OnHandleDestroyed( _ ByVal e As EventArgs _ ) [C#] override protected void OnHandleDestroyed( EventArgs e ); [Delphi] strict protected procedure OnHandleDestroyed( e: EventArgs ); override; Parameters e An EventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnKeyDown Method
Raises the KeyDown event. [Visual Basic] Overrides Protected Sub OnKeyDown( _ ByVal e As KeyEventArgs _ ) [C#] override protected void OnKeyDown( KeyEventArgs e ); [Delphi] strict protected procedure OnKeyDown( e: KeyEventArgs ); override; Parameters e A Windows.Forms.KeyEventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnKeyPress Method
Raises the KeyPress event.

C1FlexGridBase.OnLeave Method 423

[Visual Basic] Overrides Protected Sub OnKeyPress( _ ByVal e As KeyPressEventArgs _ ) [C#] override protected void OnKeyPress( KeyPressEventArgs e ); [Delphi] strict protected procedure OnKeyPress( e: KeyPressEventArgs ); override; Parameters e A Windows.Forms.KeyPressEventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnLeave Method
Raises the Leave event. [Visual Basic] Overrides Protected Sub OnLeave( _ ByVal e As EventArgs _ ) [C#] override protected void OnLeave( EventArgs e ); [Delphi] strict protected procedure OnLeave( e: EventArgs ); override; Parameters e An EventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnLostFocus Method
Raises the LostFocus event.

424 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overrides Protected Sub OnLostFocus( _ ByVal e As EventArgs _ ) [C#] override protected void OnLostFocus( EventArgs e ); [Delphi] strict protected procedure OnLostFocus( e: EventArgs ); override; Parameters e An EventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnMouseDown Method
Raises the MouseDown event. [Visual Basic] Overrides Protected Sub OnMouseDown( _ ByVal e As MouseEventArgs _ ) [C#] override protected void OnMouseDown( MouseEventArgs e ); [Delphi] strict protected procedure OnMouseDown( e: MouseEventArgs ); override; Parameters e A Windows.Forms.MouseEventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnMouseLeave Method
Raises the MouseLeave event.

C1FlexGridBase.OnMouseMove Method 425

[Visual Basic] Overrides Protected Sub OnMouseLeave( _ ByVal e As EventArgs _ ) [C#] override protected void OnMouseLeave( EventArgs e ); [Delphi] strict protected procedure OnMouseLeave( e: EventArgs ); override; Parameters e An EventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnMouseMove Method
Raises the MouseMove event. [Visual Basic] Overrides Protected Sub OnMouseMove( _ ByVal e As MouseEventArgs _ ) [C#] override protected void OnMouseMove( MouseEventArgs e ); [Delphi] strict protected procedure OnMouseMove( e: MouseEventArgs ); override; Parameters e A Windows.Forms.MouseEventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnMouseUp Method
Raises the MouseUp event.

426 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overrides Protected Sub OnMouseUp( _ ByVal e As MouseEventArgs _ ) [C#] override protected void OnMouseUp( MouseEventArgs e ); [Delphi] strict protected procedure OnMouseUp( e: MouseEventArgs ); override; Parameters e A Windows.Forms.MouseEventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnPaint Method
Raises the Paint event. [Visual Basic] Overrides Protected Sub OnPaint( _ ByVal e As PaintEventArgs _ ) [C#] override protected void OnPaint( PaintEventArgs e ); [Delphi] strict protected procedure OnPaint( e: PaintEventArgs ); override; Parameters e A Windows.Forms.PaintEventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnPaintBackground Method
Paints the control background.

C1FlexGridBase.OnScroll Method 427

[Visual Basic] Overrides Protected Sub OnPaintBackground( _ ByVal e As PaintEventArgs _ ) [C#] override protected void OnPaintBackground( PaintEventArgs e ); [Delphi] strict protected procedure OnPaintBackground( e: PaintEventArgs ); override; Parameters e A Windows.Forms.PaintEventArgs that contains information about the control to paint. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnScroll Method
Called when the grid contents scroll. [Visual Basic] Overrides Protected Sub OnScroll( _ ByVal sb As ScrollBars _ ) [C#] override protected void OnScroll( ScrollBars sb ); [Delphi] strict protected procedure OnScroll( sb: ScrollBars ); override; Parameters sb Windows.Forms.ScrollBars value that specifies the scroll direction. Remarks This method is for internal use. It allows inherited classes to customize the grid scrolling behavior. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

428 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnScrollTip Method
Called when the grid contents scroll vertically, to update the value of the scroll tip. [Visual Basic] Overrides Protected Sub OnScrollTip( _ ByVal newValue As Integer _ ) [C#] override protected void OnScrollTip( int newValue ); [Delphi] strict protected procedure OnScrollTip( newValue: Int32 ); override; Parameters newValue New value for the vertical scroll bar. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnSizeChanged Method
Raises the SizeChanged event. [Visual Basic] Overrides Protected Sub OnSizeChanged( _ ByVal e As EventArgs _ ) [C#] override protected void OnSizeChanged( EventArgs e ); [Delphi] strict protected procedure OnSizeChanged( e: EventArgs ); override; Parameters e An EventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnThemeChanged Method
Called when the control receives a WM_THEMECHANGED message.

C1FlexGridBase.OnValidating Method 429

[Visual Basic] Overrides Protected Sub OnThemeChanged() [C#] override protected void OnThemeChanged() [Delphi] strict protected procedure OnThemeChanged(); override; Remarks The WM_THEMECHANGED message is broadcast to every window following a theme change event. Examples of theme change events are the activation of a theme, the deactivation of a theme, or a transition from one theme to another. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnValidating Method
Raises the Validating event. [Visual Basic] Overrides Protected Sub OnValidating( _ ByVal e As CancelEventArgs _ ) [C#] override protected void OnValidating( CancelEventArgs e ); [Delphi] strict protected procedure OnValidating( e: CancelEventArgs ); override; Parameters e A ComponentModel.CancelEventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OnVisibleChanged Method
Raises the VisibleChanged event. [Visual Basic] Overrides Protected Sub OnVisibleChanged( _ ByVal e As EventArgs _ )

430 C1.Win.C1FlexGrid Namespace

[C#] override protected void OnVisibleChanged( EventArgs e ); [Delphi] strict protected procedure OnVisibleChanged( e: EventArgs ); override; Parameters e An EventArgs that contains the event data. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.PrintGrid Method
Overload List Prints the grid, optionally showing a page setup or print preview dialog. [Visual Basic] Overloads Public Function PrintGrid(String) As Boolean [C#] public bool PrintGrid(string); [Delphi] public function PrintGrid(String) : Boolean; overload; Prints the grid, optionally showing a page setup or print preview dialog. [Visual Basic] Overloads Public Function PrintGrid(String, PrintGridFlags) As Boolean [C#] public bool PrintGrid(string, PrintGridFlags); [Delphi] public function PrintGrid(String; PrintGridFlags) : Boolean; overload; Prints the grid, optionally showing a page setup or print preview dialog. [Visual Basic] Overloads Public Function PrintGrid(String, PrintGridFlags, String, String) As Boolean [C#] public bool PrintGrid(string, PrintGridFlags, string, string); [Delphi] public function PrintGrid(String; PrintGridFlags; String; String) : Boolean; overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.PrintGrid Method (String)


Prints the grid, optionally showing a page setup or print preview dialog. [Visual Basic] Overloads Public Function PrintGrid( _ ByVal docName As String _ ) As Boolean [C#] public bool PrintGrid( string docName );

C1FlexGridBase.PrintGrid Method 431

[Delphi] public function PrintGrid( docName: String ): Boolean; overload; Parameters docName The document name, which appears on the progress dialogs and on the print job windows. Return Value True if the grid was printed, false if the user canceled the operation. Remarks Use the PrintParameters property to set up options such as page orientation and margins, header and footer fonts, and so on. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.PrintGrid Overload List

C1FlexGridBase.PrintGrid Method (String, PrintGridFlags)


Prints the grid, optionally showing a page setup or print preview dialog. [Visual Basic] Overloads Public Function PrintGrid( _ ByVal docName As String, _ ByVal flags As PrintGridFlags _ ) As Boolean [C#] public bool PrintGrid( string docName, PrintGridFlags flags ); [Delphi] public function PrintGrid( docName: String; flags: PrintGridFlags ): Boolean; overload; Parameters docName The document name, which appears on the progress dialogs and on the print job windows. flags Flags that select printing options. Return Value True if the grid was printed, false if the user canceled the operation.

432 C1.Win.C1FlexGrid Namespace

Remarks Use the PrintParameters property to set up options such as page orientation and margins, header and footer fonts, and so on. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.PrintGrid Overload List

C1FlexGridBase.PrintGrid Method (String, PrintGridFlags, String, String)


Prints the grid, optionally showing a page setup or print preview dialog. [Visual Basic] Overloads Public Function PrintGrid( _ ByVal docName As String, _ ByVal flags As PrintGridFlags, _ ByVal header As String, _ ByVal footer As String _ ) As Boolean [C#] public bool PrintGrid( string docName, PrintGridFlags flags, string header, string footer ); [Delphi] public function PrintGrid( docName: String; flags: PrintGridFlags; header: String; footer: String ): Boolean; overload; Parameters docName The document name, which appears on the progress dialogs and on the print job windows. flags Flags that select printing options. header String that appears on the top of every page. footer String that appears on the bottom of every page. Return Value True if the grid was printed, false if the user canceled the operation.

C1FlexGridBase.ReadXml Method 433

Remarks The header and footer strings may contain up to three tab-delimited sections, which are aligned to the left, center, and right of the page. The strings may also contain placeholders that are replaced with the current page number and total number of pages ("{0}" and "{1}"). Use the PrintParameters property to set up options such as page orientation and margins, header and footer fonts, and so on. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.PrintGrid Overload List

C1FlexGridBase.ReadXml Method
Overload List Loads the grid from an XML document. [Visual Basic] Overloads Public Sub ReadXml(Stream) [C#] public void ReadXml(Stream); [Delphi] public procedure ReadXml(Stream); overload; Loads the grid from an XML document. [Visual Basic] Overloads Public Sub ReadXml(String) [C#] public void ReadXml(string); [Delphi] public procedure ReadXml(String); overload; Loads the grid from an XML document. [Visual Basic] Overloads Public Sub ReadXml(TextReader) [C#] public void ReadXml(TextReader); [Delphi] public procedure ReadXml(TextReader); overload; Loads the grid from an XML document. [Visual Basic] Overloads Public Sub ReadXml(XmlDocument) [C#] public void ReadXml(XmlDocument); [Delphi] public procedure ReadXml(XmlDocument); overload; Loads the grid from an XML document. [Visual Basic] Overloads Public Sub ReadXml(XmlNode) [C#] public void ReadXml(XmlNode); [Delphi] public procedure ReadXml(XmlNode); overload; Loads the grid from an XML document. [Visual Basic] Overloads Public Sub ReadXml(XmlReader) [C#] public void ReadXml(XmlReader); [Delphi] public procedure ReadXml(XmlReader); overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

434 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ReadXml Method (Stream)


Loads the grid from an XML document. [Visual Basic] Overloads Public Sub ReadXml( _ ByVal stream As Stream _ ) [C#] public void ReadXml( Stream stream ); [Delphi] public procedure ReadXml( stream: Stream ); overload; Parameters stream IO.Stream object to use for loading the grid. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.ReadXml Overload List

C1FlexGridBase.ReadXml Method (String)


Loads the grid from an XML document. [Visual Basic] Overloads Public Sub ReadXml( _ ByVal fileName As String _ ) [C#] public void ReadXml( string fileName ); [Delphi] public procedure ReadXml( fileName: String ); overload; Parameters fileName Name of the file to load, including the path. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.ReadXml Overload List

C1FlexGridBase.ReadXml Method 435

C1FlexGridBase.ReadXml Method (TextReader)


Loads the grid from an XML document. [Visual Basic] Overloads Public Sub ReadXml( _ ByVal tr As TextReader _ ) [C#] public void ReadXml( TextReader tr ); [Delphi] public procedure ReadXml( tr: TextReader ); overload; Parameters tr IO.TextReader object to use for loading the grid. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.ReadXml Overload List

C1FlexGridBase.ReadXml Method (XmlDocument)


Loads the grid from an XML document. [Visual Basic] Overloads Public Sub ReadXml( _ ByVal doc As XmlDocument _ ) [C#] public void ReadXml( XmlDocument doc ); [Delphi] public procedure ReadXml( doc: XmlDocument ); overload; Parameters doc Xml.XmlDocument object to use for loading the grid. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.ReadXml Overload List

436 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ReadXml Method (XmlNode)


Loads the grid from an XML document. [Visual Basic] Overloads Public Sub ReadXml( _ ByVal node As XmlNode _ ) [C#] public void ReadXml( XmlNode node ); [Delphi] public procedure ReadXml( node: XmlNode ); overload; Parameters node Xml.XmlNode object to use for loading the grid. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.ReadXml Overload List

C1FlexGridBase.ReadXml Method (XmlReader)


Loads the grid from an XML document. [Visual Basic] Overloads Public Sub ReadXml( _ ByVal xr As XmlReader _ ) [C#] public void ReadXml( XmlReader xr ); [Delphi] public procedure ReadXml( xr: XmlReader ); overload; Parameters xr Xml.XmlReader object to use for loading the grid. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.ReadXml Overload List

C1FlexGridBase.RemoveItem Method 437

C1FlexGridBase.RemoveItem Method
Overload List Removes the last row from the grid. [Visual Basic] Overloads Public Sub RemoveItem() [C#] public void RemoveItem(); [Delphi] public procedure RemoveItem(); overload; Removes a row at a specified position from the grid. [Visual Basic] Overloads Public Sub RemoveItem(Integer) [C#] public void RemoveItem(int); [Delphi] public procedure RemoveItem(Int32); overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.RemoveItem Method ()
Removes the last row from the grid. [Visual Basic] Overloads Public Sub RemoveItem() [C#] public void RemoveItem() [Delphi] public procedure RemoveItem(); overload; Remarks You can also add and remove rows using the Rows collection. The RemoveItem method is provided for consistency, since the grid also has an AddItem method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.RemoveItem Overload List

C1FlexGridBase.RemoveItem Method (Int32)


Removes a row at a specified position from the grid. [Visual Basic] Overloads Public Sub RemoveItem( _ ByVal index As Integer _ ) [C#] public void RemoveItem( int index );

438 C1.Win.C1FlexGrid Namespace

[Delphi] public procedure RemoveItem( index: Int32 ); overload; Parameters index Index of the row to be removed. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.RemoveItem Overload List

C1FlexGridBase.SaveExcel Method
Overload List Saves the grid contents to a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub SaveExcel(String) [C#] public void SaveExcel(string); [Delphi] public procedure SaveExcel(String); overload; Saves the grid contents to a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub SaveExcel(String, FileFlags) [C#] public void SaveExcel(string, FileFlags); [Delphi] public procedure SaveExcel(String; FileFlags); overload; Saves the grid contents to a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub SaveExcel(String, String) [C#] public void SaveExcel(string, string); [Delphi] public procedure SaveExcel(String; String); overload; Saves the grid contents to a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub SaveExcel(String, String, FileFlags) [C#] public void SaveExcel(string, string, FileFlags); [Delphi] public procedure SaveExcel(String; String; FileFlags); overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SaveExcel Method (String)


Saves the grid contents to a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub SaveExcel( _ ByVal fileName As String _ )

C1FlexGridBase.SaveExcel Method 439

[C#] public void SaveExcel( string fileName ); [Delphi] public procedure SaveExcel( fileName: String ); overload; Parameters fileName Name of the file to save, including the path. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SaveExcel Overload List

C1FlexGridBase.SaveExcel Method (String, FileFlags)


Saves the grid contents to a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub SaveExcel( _ ByVal fileName As String, _ ByVal flags As FileFlags _ ) [C#] public void SaveExcel( string fileName, FileFlags flags ); [Delphi] public procedure SaveExcel( fileName: String; flags: FileFlags ); overload; Parameters fileName Name of the file to save, including the path. flags See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SaveExcel Overload List

C1FlexGridBase.SaveExcel Method (String, String)


Saves the grid contents to a Microsoft Excel (.xls) file.

440 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overloads Public Sub SaveExcel( _ ByVal fileName As String, _ ByVal sheetName As String _ ) [C#] public void SaveExcel( string fileName, string sheetName ); [Delphi] public procedure SaveExcel( fileName: String; sheetName: String ); overload; Parameters fileName Name of the file to save, including the path. sheetName Name of the sheet to add to the Excel workbook. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SaveExcel Overload List

C1FlexGridBase.SaveExcel Method (String, String, FileFlags)


Saves the grid contents to a Microsoft Excel (.xls) file. [Visual Basic] Overloads Public Sub SaveExcel( _ ByVal fileName As String, _ ByVal sheetName As String, _ ByVal flags As FileFlags _ ) [C#] public void SaveExcel( string fileName, string sheetName, FileFlags flags ); [Delphi] public procedure SaveExcel( fileName: String; sheetName: String; flags: FileFlags ); overload;

C1FlexGridBase.SaveGrid Method 441

Parameters fileName Name of the file to save, including the path. sheetName Name of the sheet to add to the Excel workbook. flags Options to use when saving the file. Remarks If the specified file exists, the control will add or replace a single worksheet in it. Existing sheets will be preserved if possible. The worksheet to add or replace is identified by the sheetName parameter. If the specified file is in use by another application (usually Excel), the method will fail. This method does not require Microsoft Excel to be installed on the machine. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SaveExcel Overload List

C1FlexGridBase.SaveGrid Method
Overload List Saves the grid contents to a file. [Visual Basic] Overloads Public Sub SaveGrid(String, FileFormatEnum) [C#] public void SaveGrid(string, FileFormatEnum); [Delphi] public procedure SaveGrid(String; FileFormatEnum); overload; Saves the grid contents to a file. [Visual Basic] Overloads Public Sub SaveGrid(String, FileFormatEnum, FileFlags) [C#] public void SaveGrid(string, FileFormatEnum, FileFlags); [Delphi] public procedure SaveGrid(String; FileFormatEnum; FileFlags); overload; Saves the grid contents to a file. [Visual Basic] Overloads Public Sub SaveGrid(String, FileFormatEnum, FileFlags, Encoding) [C#] public void SaveGrid(string, FileFormatEnum, FileFlags, Encoding); [Delphi] public procedure SaveGrid(String; FileFormatEnum; FileFlags; Encoding); overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SaveGrid Method (String, FileFormatEnum)


Saves the grid contents to a file.

442 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overloads Public Sub SaveGrid( _ ByVal fileName As String, _ ByVal format As FileFormatEnum _ ) [C#] public void SaveGrid( string fileName, FileFormatEnum format ); [Delphi] public procedure SaveGrid( fileName: String; format: FileFormatEnum ); overload; Parameters fileName Name of the file to save, including the path. format File format to use. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SaveGrid Overload List

C1FlexGridBase.SaveGrid Method (String, FileFormatEnum, FileFlags)


Saves the grid contents to a file. [Visual Basic] Overloads Public Sub SaveGrid( _ ByVal fileName As String, _ ByVal format As FileFormatEnum, _ ByVal flags As FileFlags _ ) [C#] public void SaveGrid( string fileName, FileFormatEnum format, FileFlags flags ); [Delphi] public procedure SaveGrid( fileName: String; format: FileFormatEnum; flags: FileFlags ); overload;

C1FlexGridBase.SaveGrid Method 443

Parameters fileName Name of the file to save, including the path. format File format to use. flags Options to use when saving the file. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SaveGrid Overload List

C1FlexGridBase.SaveGrid Method (String, FileFormatEnum, FileFlags, Encoding)


Saves the grid contents to a file. [Visual Basic] Overloads Public Sub SaveGrid( _ ByVal fileName As String, _ ByVal format As FileFormatEnum, _ ByVal flags As FileFlags, _ ByVal encoding As Encoding _ ) [C#] public void SaveGrid( string fileName, FileFormatEnum format, FileFlags flags, Encoding encoding ); [Delphi] public procedure SaveGrid( fileName: String; format: FileFormatEnum; flags: FileFlags; encoding: Encoding ); overload; Parameters fileName Name of the file to save, including the path. format File format to use. flags Options to use when saving the file. encoding Text.Encoding to use when saving the file.

444 C1.Win.C1FlexGrid Namespace

Remarks Grids saved to CSV and other text files include data only (no formatting information is saved). Grids saved to Excel files include data and formatting information. Images are not saved. Grids can also be persisted to XML format using the WriteXml and ReadXml methods. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SaveGrid Overload List

C1FlexGridBase.Select Method
Overload List Selects a range of cells and scrolls it into view. [Visual Basic] Overloads Public Sub Select(CellRange) [C#] public void Select(CellRange); [Delphi] public procedure Select(CellRange); overload; Selects a range of cells. [Visual Basic] Overloads Public Sub Select(CellRange, Boolean) [C#] public void Select(CellRange, bool); [Delphi] public procedure Select(CellRange; Boolean); overload; Selects a cell and scrolls it into view. [Visual Basic] Overloads Public Sub Select(Integer, Integer) [C#] public void Select(int, int); [Delphi] public procedure Select(Int32; Int32); overload; Selects a cell. [Visual Basic] Overloads Public Sub Select(Integer, Integer, Boolean) [C#] public void Select(int, int, bool); [Delphi] public procedure Select(Int32; Int32; Boolean); overload; Selects a range of cells and scrolls it into view. [Visual Basic] Overloads Public Sub Select(Integer, Integer, Integer, Integer) [C#] public void Select(int, int, int, int); [Delphi] public procedure Select(Int32; Int32; Int32; Int32); overload; Selects a range of cells. [Visual Basic] Overloads Public Sub Select(Integer, Integer, Integer, Integer, Boolean) [C#] public void Select(int, int, int, int, bool); [Delphi] public procedure Select(Int32; Int32; Int32; Int32; Boolean); overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Select Method (CellRange)


Selects a range of cells and scrolls it into view.

C1FlexGridBase.Select Method 445

[Visual Basic] Overloads Public Sub Select( _ ByVal rg As CellRange _ ) [C#] public void Select( CellRange rg ); [Delphi] public procedure Select( rg: CellRange ); overload; Parameters rg CellRange that specifies the cells that will be selected. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Select Overload List

C1FlexGridBase.Select Method (CellRange, Boolean)


Selects a range of cells. [Visual Basic] Overloads Public Sub Select( _ ByVal rg As CellRange, _ ByVal show As Boolean _ ) [C#] public void Select( CellRange rg, bool show ); [Delphi] public procedure Select( rg: CellRange; show: Boolean ); overload; Parameters rg CellRange that specifies the cells that will be selected. show Whether to scroll the new selection into view.

446 C1.Win.C1FlexGrid Namespace

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Select Overload List

C1FlexGridBase.Select Method (Int32, Int32)


Selects a cell and scrolls it into view. [Visual Basic] Overloads Public Sub Select( _ ByVal row As Integer, _ ByVal col As Integer _ ) [C#] public void Select( int row, int col ); [Delphi] public procedure Select( row: Int32; col: Int32 ); overload; Parameters row New value for the Row property. col New value for the Col property. Remarks Using the Select method is equivalent to setting the Row and Col properties. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Select Overload List

C1FlexGridBase.Select Method (Int32, Int32, Boolean)


Selects a cell. [Visual Basic] Overloads Public Sub Select( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal show As Boolean _ )

C1FlexGridBase.Select Method 447

[C#] public void Select( int row, int col, bool show ); [Delphi] public procedure Select( row: Int32; col: Int32; show: Boolean ); overload; Parameters row New value for the Row property. col New value for the Col property. show Whether to scroll the new selection into view. Remarks Using the Select method is equivalent to setting the Row and Col properties. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Select Overload List

C1FlexGridBase.Select Method (Int32, Int32, Int32, Int32)


Selects a range of cells and scrolls it into view. [Visual Basic] Overloads Public Sub Select( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal rowSel As Integer, _ ByVal colSel As Integer _ ) [C#] public int int int int );

void Select( row, col, rowSel, colSel

448 C1.Win.C1FlexGrid Namespace

[Delphi] public procedure Select( row: Int32; col: Int32; rowSel: Int32; colSel: Int32 ); overload; Parameters row New value for the Row property. col New value for the Col property. rowSel New value for the RowSel property. colSel New value for the ColSel property. Remarks Using the Select method is equivalent to setting the Row, Col, RowSel, and ColSel properties. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Select Overload List

C1FlexGridBase.Select Method (Int32, Int32, Int32, Int32, Boolean)


Selects a range of cells. [Visual Basic] Overloads Public Sub Select( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal rowSel As Integer, _ ByVal colSel As Integer, _ ByVal show As Boolean _ ) [C#] public void Select( int row, int col, int rowSel, int colSel, bool show );

C1FlexGridBase.SetCellCheck Method 449

[Delphi] public procedure Select( row: Int32; col: Int32; rowSel: Int32; colSel: Int32; show: Boolean ); overload; Parameters row New value for the Row property. col New value for the Col property. rowSel New value for the RowSel property. colSel New value for the ColSel property. show Whether to scroll the new selection into view. Remarks Using the Select method is equivalent to setting the Row, Col, RowSel, and ColSel properties. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Select Overload List

C1FlexGridBase.SetCellCheck Method
Sets the state of the checkbox in a grid cell. [Visual Basic] Overridable Public Sub SetCellCheck( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal check As CheckEnum _ ) [C#] virtual public void SetCellCheck( int row, int col, CheckEnum check );

450 C1.Win.C1FlexGrid Namespace

[Delphi] public procedure SetCellCheck( row: Int32; col: Int32; check: CheckEnum ); virtual; Parameters row Row index. col Column index. check CheckEnum value to assign to the cell. Remarks For details and examples, see the GetCellCheck method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SetCellImage Method
Sets the image displayed in a grid cell. [Visual Basic] Public Sub SetCellImage( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal newImage As Image _ ) [C#] public void SetCellImage( int row, int col, Image newImage ); [Delphi] public procedure SetCellImage( row: Int32; col: Int32; newImage: Image ); Parameters row Row index. col Column index.

C1FlexGridBase.SetCellStyle Method 451

newImage An Drawing.Image object containing an image to display in the cell. Remarks In addition to the usual cell contents, you can display images in cells. There are two methods for showing images in cells: 1. You can use the SetCellImage and GetCellImage methods to assign images directly to the cells. In this case, the cell contents and the image are independent. To update the image, you need to call SetCellImage again. 2. You can use the RowCol.ImageMap property to associate images with specific cell values. In this case, images are updated automatically whenever the cell contents change. The RowCol.ImageAndText property allows you to specify whether the control should display the images in addition to or instead of the cell text. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SetCellStyle Method
Overload List Assigns a custom CellStyle to a cell. [Visual Basic] Overloads Public Sub SetCellStyle(Integer, Integer, CellStyle) [C#] public void SetCellStyle(int, int, CellStyle); [Delphi] public procedure SetCellStyle(Int32; Int32; CellStyle); overload; Assigns a custom CellStyle to a cell. [Visual Basic] Overloads Public Sub SetCellStyle(Integer, Integer, String) [C#] public void SetCellStyle(int, int, string); [Delphi] public procedure SetCellStyle(Int32; Int32; String); overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SetCellStyle Method (Int32, Int32, CellStyle)


Assigns a custom CellStyle to a cell. [Visual Basic] Overloads Public Sub SetCellStyle( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal newStyle As CellStyle _ ) [C#] public void SetCellStyle( int row, int col, CellStyle newStyle );

452 C1.Win.C1FlexGrid Namespace

[Delphi] public procedure SetCellStyle( row: Int32; col: Int32; newStyle: CellStyle ); overload; Parameters row Row index. col Column index newStyle The CellStyle to associate with the cell. Remarks The SetCellStyle method is useful is you want to assign a new style to a single cell. You can also reset the cell style by setting it to null (Nothing, in VB). To apply a custom cell style to an entire row or column, set the row or column's RowCol.Style properties. To apply a custom style to a range cells, use a CellRange object. For example: Visual Basic Dim rg As CellRange = _flex.GetCellRange(3, 3, 10, 10) rg.Style = _flex.Styles("MyRangeStyle") C# CellRange rg = _flex.GetCellRange(3, 3, 10, 10); rg.Style = _flex.Styles["MyRangeStyle"]; Delphi var rg: CellRange; begin rg := _flex.GetCellRange(3, 3, 10, 10); rg.Style := _flex.Styles['MyRangeStyle']; end;

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SetCellStyle Overload List

C1FlexGridBase.SetCellStyle Method (Int32, Int32, String)


Assigns a custom CellStyle to a cell. [Visual Basic] Overloads Public Sub SetCellStyle( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal styleName As String _ )

C1FlexGridBase.SetData Method 453

[C#] public void SetCellStyle( int row, int col, string styleName ); [Delphi] public procedure SetCellStyle( row: Int32; col: Int32; styleName: String ); overload; Parameters row Row index. col Column index styleName Name of the new style. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SetCellStyle Overload List

C1FlexGridBase.SetData Method
Overload List Assigns a value to a range of cells, coercing the value into each cell's specified DataType. [Visual Basic] Overloads Overridable Public Function SetData(CellRange, Object) As Boolean [C#] virtual public bool SetData(CellRange, object); [Delphi] public function SetData(CellRange; Object) : Boolean; overload; virtual; Assigns a value to a range of cells. [Visual Basic] Overloads Overridable Public Function SetData(CellRange, Object, Boolean) As Boolean [C#] virtual public bool SetData(CellRange, object, bool); [Delphi] public function SetData(CellRange; Object; Boolean) : Boolean; overload; virtual; Assigns a value to a grid cell, coercing the value into the cell's specified DataType. [Visual Basic] Overloads Overridable Public Function SetData(Integer, Integer, Object) As Boolean [C#] virtual public bool SetData(int, int, object); [Delphi] public function SetData(Int32; Int32; Object) : Boolean; overload; virtual; Assigns a value to a grid cell, coercing the value into the cell's specified data type. [Visual Basic] Overloads Overridable Public Function SetData(Integer, String, Object) As Boolean [C#] virtual public bool SetData(int, string, object); [Delphi] public function SetData(Int32; String; Object) : Boolean; overload; virtual;

454 C1.Win.C1FlexGrid Namespace

Assigns a value to a grid cell. [Visual Basic] Overloads Overridable Public Function SetData(Integer, Integer, Object, Boolean) As Boolean [C#] virtual public bool SetData(int, int, object, bool); [Delphi] public function SetData(Int32; Int32; Object; Boolean) : Boolean; overload; virtual; Assigns a value to a grid cell. [Visual Basic] Overloads Overridable Public Function SetData(Integer, String, Object, Boolean) As Boolean [C#] virtual public bool SetData(int, string, object, bool); [Delphi] public function SetData(Int32; String; Object; Boolean) : Boolean; overload; virtual; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SetData Method (CellRange, Object)


Assigns a value to a range of cells, coercing the value into each cell's specified DataType. [Visual Basic] Overloads Overridable Public Function SetData( _ ByVal rg As CellRange, _ ByVal value As Object _ ) As Boolean [C#] virtual public bool SetData( CellRange rg, object value ); [Delphi] public function SetData( rg: CellRange; value: Object ): Boolean; overload; virtual; Parameters rg CellRange that specifies the cells that will be assigned a new value. value Value that will be assigned to all cells in the range. Return Value True if the value was assigned to all cells in the destination range, false if the value could not be assigned to all cells in the range (usually because it could not be converted to the appropriate type). See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SetData Overload List

C1FlexGridBase.SetData Method 455

C1FlexGridBase.SetData Method (CellRange, Object, Boolean)


Assigns a value to a range of cells. [Visual Basic] Overloads Overridable Public Function SetData( _ ByVal rg As CellRange, _ ByVal value As Object, _ ByVal coerce As Boolean _ ) As Boolean [C#] virtual public bool SetData( CellRange rg, object value, bool coerce ); [Delphi] public function SetData( rg: CellRange; value: Object; coerce: Boolean ): Boolean; overload; virtual; Parameters rg CellRange that specifies the cells that will be assigned a new value. value Value that will be assigned to all cells in the range. coerce Whether the value should be converted to the column's data type. Return Value True if the value was assigned to all cells in the destination range. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SetData Overload List

C1FlexGridBase.SetData Method (Int32, Int32, Object)


Assigns a value to a grid cell, coercing the value into the cell's specified DataType. [Visual Basic] Overloads Overridable Public Function SetData( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal value As Object _ ) As Boolean

456 C1.Win.C1FlexGrid Namespace

[C#] virtual public bool SetData( int row, int col, object value ); [Delphi] public function SetData( row: Int32; col: Int32; value: Object ): Boolean; overload; virtual; Parameters row Row index. col Column index. value Value to assign to the cell. Return Value True if the value was assigned to the cell, false if the value could not be assigned (usually because it could not be converted to the appropriate type). See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SetData Overload List

C1FlexGridBase.SetData Method (Int32, String, Object)


Assigns a value to a grid cell, coercing the value into the cell's specified data type. [Visual Basic] Overloads Overridable Public Function SetData( _ ByVal row As Integer, _ ByVal colName As String, _ ByVal value As Object _ ) As Boolean [C#] virtual public bool SetData( int row, string colName, object value );

C1FlexGridBase.SetData Method 457

[Delphi] public function SetData( row: Int32; colName: String; value: Object ): Boolean; overload; virtual; Parameters row Row index. colName Column name. value Value to assign to the cell. Return Value True if the value was assigned to the cell, False otherwise. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SetData Overload List

C1FlexGridBase.SetData Method (Int32, Int32, Object, Boolean)


Assigns a value to a grid cell. [Visual Basic] Overloads Overridable Public Function SetData( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal value As Object, _ ByVal coerce As Boolean _ ) As Boolean [C#] virtual public bool SetData( int row, int col, object value, bool coerce ); [Delphi] public function SetData( row: Int32; col: Int32; value: Object; coerce: Boolean ): Boolean; overload; virtual;

458 C1.Win.C1FlexGrid Namespace

Parameters row Row index. col Column index. value Value to assign to the cell. coerce Whether the value should be converted to the column's data type. Return Value True if the value was assigned to the cell. Remarks If coerce is set to true and the value can't be converted into the proper data type, the grid will fire the GridError event and the cell will retain its original value. Using SetData with coerce set to true is equivalent to setting the grid's indexer. For example, the following lines of code are equivalent: Visual Basic flex.SetData(1, 1, "Hello", True) flex(1, 1) = "Hello" 'same thing C# flex.SetData(1, 1, "Hello", true); flex[1, 1] = "Hello"; // same thing Delphi flex.SetData(1, 1, 'Hello', True); flex[1, 1] := 'Hello'; //same thing

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SetData Overload List

C1FlexGridBase.SetData Method (Int32, String, Object, Boolean)


Assigns a value to a grid cell. [Visual Basic] Overloads Overridable Public Function SetData( _ ByVal row As Integer, _ ByVal colName As String, _ ByVal value As Object, _ ByVal coerce As Boolean _ ) As Boolean

C1FlexGridBase.SetData Method 459

[C#] virtual public bool SetData( int row, string colName, object value, bool coerce ); [Delphi] public function SetData( row: Int32; colName: String; value: Object; coerce: Boolean ): Boolean; overload; virtual; Parameters row Row index. colName Column name. value Value to assign to the cell. coerce Whether the value should be converted to the column's data type. Return Value True if the value was assigned to the cell, False otherwise. Remarks If coerce is set to true and the value can't be converted into the proper data type, the grid will fire the GridError event and the cell will retain its original value. Using SetData with coerce set to true is equivalent to setting the grid's indexer. For example, the following lines of code are equivalent: Visual Basic flex.SetData(1, "ColName", "Hello", True) flex(1, "ColName") = "Hello" ' same thing C# flex.SetData(1, "ColName", "Hello", true); flex[1, "ColName"] = "Hello"; // same thing Delphi flex.SetData(1, 'ColName', 'Hello', True); flex[1, 'ColName'] := 'Hello'; // same thing

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SetData Overload List

460 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SetDataBinding Method
Overload List Sets the DataSource and DataMember properties. [Visual Basic] Overloads Public Sub SetDataBinding(Object, String) [C#] public void SetDataBinding(object, string); [Delphi] public procedure SetDataBinding(Object; String); overload; Sets the DataSource and DataMember properties, optionally keeping the current column layout. [Visual Basic] Overloads Public Sub SetDataBinding(Object, String, Boolean) [C#] public void SetDataBinding(object, string, bool); [Delphi] public procedure SetDataBinding(Object; String; Boolean); overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SetDataBinding Method (Object, String)


Sets the DataSource and DataMember properties. [Visual Basic] Overloads Public Sub SetDataBinding( _ ByVal dataSource As Object, _ ByVal dataMember As String _ ) [C#] public void SetDataBinding( object dataSource, string dataMember ); [Delphi] public procedure SetDataBinding( dataSource: Object; dataMember: String ); overload; Parameters dataSource The new data source object. dataMember The table to bind to within the data source object. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SetDataBinding Overload List

C1FlexGridBase.SetDataBinding Method (Object, String, Boolean)


Sets the DataSource and DataMember properties, optionally keeping the current column layout.

C1FlexGridBase.SetUserData Method 461

[Visual Basic] Overloads Public Sub SetDataBinding( _ ByVal dataSource As Object, _ ByVal dataMember As String, _ ByVal preserveLayout As Boolean _ ) [C#] public void SetDataBinding( object dataSource, string dataMember, bool preserveLayout ); [Delphi] public procedure SetDataBinding( dataSource: Object; dataMember: String; preserveLayout: Boolean ); overload; Parameters dataSource The new data source object. dataMember The table to bind to within the data source object. preserveLayout Whether the current column layout should be preserved or re-generated automatically based on the data source schema. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SetDataBinding Overload List

C1FlexGridBase.SetUserData Method
Overload List Assigns user data to a cell. [Visual Basic] Overloads Overridable Public Sub SetUserData(Integer, Integer, Object) [C#] virtual public void SetUserData(int, int, object); [Delphi] public procedure SetUserData(Int32; Int32; Object); overload; virtual; Assigns user data to a cell. [Visual Basic] Overloads Overridable Public Sub SetUserData(Integer, String, Object) [C#] virtual public void SetUserData(int, string, object); [Delphi] public procedure SetUserData(Int32; String; Object); overload; virtual; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

462 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SetUserData Method (Int32, Int32, Object)


Assigns user data to a cell. [Visual Basic] Overloads Overridable Public Sub SetUserData( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal data As Object _ ) [C#] virtual public void SetUserData( int row, int col, object data ); [Delphi] public procedure SetUserData( row: Int32; col: Int32; data: Object ); overload; virtual; Parameters row Row index. col Column index. data User data to assign to the cell. Remarks The user data is not used internally by the grid. It is reserved for additional data that you may want to associate with a cell. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SetUserData Overload List

C1FlexGridBase.SetUserData Method (Int32, String, Object)


Assigns user data to a cell. [Visual Basic] Overloads Overridable Public Sub SetUserData( _ ByVal row As Integer, _ ByVal colName As String, _ ByVal data As Object _ )

C1FlexGridBase.ShowCell Method 463

[C#] virtual public void SetUserData( int row, string colName, object data ); [Delphi] public procedure SetUserData( row: Int32; colName: String; data: Object ); overload; virtual; Parameters row Row index. colName Column name. data User data to assign to the cell. Remarks The user data is not used internally by the grid. It is reserved for additional data that you may want to associate with a cell. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.SetUserData Overload List

C1FlexGridBase.ShowCell Method
Scrolls a cell into view. [Visual Basic] Overridable Public Sub ShowCell( _ ByVal row As Integer, _ ByVal col As Integer _ ) [C#] virtual public void ShowCell( int row, int col ); [Delphi] public procedure ShowCell( row: Int32; col: Int32 ); virtual;

464 C1.Win.C1FlexGrid Namespace

Parameters row Row index. col Column index. Remarks This method does not affect the current selection. To move the cursor to a specific cell and optionally bring it into view, use the Select method. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ShowSortAt Method
Shows the sorting glyph on a column header. [Visual Basic] Public Sub ShowSortAt( _ ByVal order As SortFlags, _ ByVal col As Integer _ ) [C#] public void ShowSortAt( SortFlags order, int col ); [Delphi] public procedure ShowSortAt( order: SortFlags; col: Int32 ); Parameters order SortFlags value that specifies the glyph to display. col Column index. Remarks This method is useful if you want to perform custom sorting and need control over the appearance and position of the sorting glyph (the little triangle that appears on the header of sorted columns). See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Sort Method 465

C1FlexGridBase.Sort Method
Overload List Sorts the grid using the specified comparer. [Visual Basic] Overloads Overridable Public Sub Sort(IComparer) [C#] virtual public void Sort(IComparer); [Delphi] public procedure Sort(IComparer); overload; virtual; Sorts a range of cells in the grid. [Visual Basic] Overloads Overridable Public Sub Sort(SortFlags, CellRange) [C#] virtual public void Sort(SortFlags, CellRange); [Delphi] public procedure Sort(SortFlags; CellRange); overload; virtual; Sorts the grid contents based on a column. [Visual Basic] Overloads Overridable Public Sub Sort(SortFlags, Integer) [C#] virtual public void Sort(SortFlags, int); [Delphi] public procedure Sort(SortFlags; Int32); overload; virtual; Sorts a group of rows using the specified comparer. [Visual Basic] Overloads Overridable Public Sub Sort(Integer, Integer, IComparer) [C#] virtual public void Sort(int, int, IComparer); [Delphi] public procedure Sort(Int32; Int32; IComparer); overload; virtual; Sorts the grid contents based on a column range. [Visual Basic] Overloads Overridable Public Sub Sort(SortFlags, Integer, Integer) [C#] virtual public void Sort(SortFlags, int, int); [Delphi] public procedure Sort(SortFlags; Int32; Int32); overload; virtual; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Sort Method (IComparer)


Sorts the grid using the specified comparer. [Visual Basic] Overloads Overridable Public Sub Sort( _ ByVal comparer As IComparer _ ) [C#] virtual public void Sort( IComparer comparer ); [Delphi] public procedure Sort( comparer: IComparer ); overload; virtual;

466 C1.Win.C1FlexGrid Namespace

Parameters comparer An Collections.IComparer object that compares Row objects. Remarks The Collections.IComparer interface has a single method called Compare that takes two objects as arguments (in this case, they will be Row objects) and returns -1, 0, or +1. For more details, see the documentation for Collections.IComparer. Custom sorting can only be used when the grid is in unbound mode. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Sort Overload List

C1FlexGridBase.Sort Method (SortFlags, CellRange)


Sorts a range of cells in the grid. [Visual Basic] Overloads Overridable Public Sub Sort( _ ByVal order As SortFlags, _ ByVal rg As CellRange _ ) [C#] virtual public void Sort( SortFlags order, CellRange rg ); [Delphi] public procedure Sort( order: SortFlags; rg: CellRange ); overload; virtual; Parameters order SortFlags value that specifies the sort direction and options. rg CellRange object that specifies the range of cells to sort. Remarks When you sort multiple columns, the same sorting options are applied to each column, starting from the leftmost column in the range and proceeding to the right. To sort multiple columns using a different sorting order for each, you can either call the Sort method multiple times or set each column's Column.Sort property and call the Sort method including the SortFlags.UseColSort flag in the flags parameter.

C1FlexGridBase.Sort Method 467

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Sort Overload List

C1FlexGridBase.Sort Method (SortFlags, Int32)


Sorts the grid contents based on a column. [Visual Basic] Overloads Overridable Public Sub Sort( _ ByVal order As SortFlags, _ ByVal col As Integer _ ) [C#] virtual public void Sort( SortFlags order, int col ); [Delphi] public procedure Sort( order: SortFlags; col: Int32 ); overload; virtual; Parameters order SortFlags value that specifies the sort direction and options. col Column to sort on. Remarks Sorting works differently depending on whether the grid is bound to a data source or not. In bound mode, the grid passes the sort request to the underlying data source object. In this case, the sort settings remain in effect as the grid data changes. Editing values in the sort column will cause the data source to re-sort the data, and grid will show the changes automatically. This is equivalent to setting the Sort property on a Data.DataView object for example. In unbound mode, the Sort method sorts the data that is currently stored in the grid. Changing the data after it has been sorted will not automatically update the sort. When the grid is bound to a new data source, it inherits the sort settings currently applied to the new data source object. Because of this, calling Sort immediately before setting the DataSource property has no effect on the grid. In unbound mode, the grid uses a stable sorting algorithm. This means that the sorting keeps the relative order of records when the sorting key is the same. For example, if you sort a list of files by name, then by extension, the list will still be sorted by name within each extension group. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Sort Overload List

468 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Sort Method (Int32, Int32, IComparer)


Sorts a group of rows using the specified comparer. [Visual Basic] Overloads Overridable Public Sub Sort( _ ByVal rowStart As Integer, _ ByVal rowCount As Integer, _ ByVal comparer As IComparer _ ) [C#] virtual public void Sort( int rowStart, int rowCount, IComparer comparer ); [Delphi] public procedure Sort( rowStart: Int32; rowCount: Int32; comparer: IComparer ); overload; virtual; Parameters rowStart First row in the sort range. rowCount Number of rows in the sort range. comparer An Collections.IComparer object that compares Row objects. Remarks The Collections.IComparer interface has a single method called Compare that takes two objects as arguments (in this case, they will be Row objects) and returns -1, 0, or +1. For more details, see the documentation for Collections.IComparer. Custom sorting can only be used when the grid is in unbound mode. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Sort Overload List

C1FlexGridBase.Sort Method (SortFlags, Int32, Int32)


Sorts the grid contents based on a column range.

C1FlexGridBase.StartEditing Method 469

[Visual Basic] Overloads Overridable Public Sub Sort( _ ByVal order As SortFlags, _ ByVal col1 As Integer, _ ByVal col2 As Integer _ ) [C#] virtual public void Sort( SortFlags order, int col1, int col2 ); [Delphi] public procedure Sort( order: SortFlags; col1: Int32; col2: Int32 ); overload; virtual; Parameters order SortFlags value that specifies the sort direction and options. col1 First column in the range. col2 Last column in the range. Remarks When you sort multiple columns, the same sorting options are applied to each column, starting from the leftmost column in the range and proceeding to the right. To sort multiple columns using a different sorting order for each, you can either call the Sort method multiple times or set each column's Column.Sort property and call the Sort method including the SortFlags.UseColSort flag in the order parameter. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Sort Overload List

C1FlexGridBase.StartEditing Method
Overload List Puts the grid in edit mode and starts editing the current cell. [Visual Basic] Overloads Public Function StartEditing() As Boolean [C#] public bool StartEditing(); [Delphi] public function StartEditing() : Boolean; overload; Puts the grid in edit mode and starts editing a cell. [Visual Basic] Overloads Public Function StartEditing(Integer, Integer) As Boolean

470 C1.Win.C1FlexGrid Namespace

[C#] public bool StartEditing(int, int); [Delphi] public function StartEditing(Int32; Int32) : Boolean; overload; Puts the grid in edit mode and starts editing a cell. [Visual Basic] Overloads Overridable Public Function StartEditing(Integer, Integer, Char) As Boolean [C#] virtual public bool StartEditing(int, int, char); [Delphi] public function StartEditing(Int32; Int32; Char) : Boolean; overload; virtual; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.StartEditing Method ()
Puts the grid in edit mode and starts editing the current cell. [Visual Basic] Overloads Public Function StartEditing() As Boolean [C#] public bool StartEditing() [Delphi] public function StartEditing(): Boolean; overload; Return Value True if the grid entered edit mode successfully, false otherwise. Remarks If the AllowEditing property is set to true, the control goes into edit mode automatically when the user presses the edit key (F2), the space bar, or any printable character. You may use the StartEditing method to force the control into cell-editing mode. The StartEditing method forces the control into editing mode even if AllowEditing is set to False. You may also use it to allow editing of fixed cells. Example The code below uses the StartEditing method to keep the grid in edit mode while the user moves the selection (like the .NET DataGrid control): Visual Basic Private Sub _flex_RowColChange(sender As Object, e As System.EventArgs) _flex.StartEditing() End Sub C# private void _flex_RowColChange(object sender, System.EventArgs e) { _flex.StartEditing(); } Delphi procedure _flex_RowColChange(sender: object; e: System.EventArgs); begin _flex.StartEditing; end;

C1FlexGridBase.StartEditing Method 471

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.StartEditing Overload List

C1FlexGridBase.StartEditing Method (Int32, Int32)


Puts the grid in edit mode and starts editing a cell. [Visual Basic] Overloads Public Function StartEditing( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Boolean [C#] public bool StartEditing( int row, int col ); [Delphi] public function StartEditing( row: Int32; col: Int32 ): Boolean; overload; Parameters row Row index. col Column index. Return Value True if the grid entered edit mode successfully, false otherwise. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.StartEditing Overload List

C1FlexGridBase.StartEditing Method (Int32, Int32, Char)


Puts the grid in edit mode and starts editing a cell. [Visual Basic] Overloads Overridable Public Function StartEditing( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal key As Char _ ) As Boolean

472 C1.Win.C1FlexGrid Namespace

[C#] virtual public bool StartEditing( int row, int col, char key ); [Delphi] public function StartEditing( row: Int32; col: Int32; key: Char ): Boolean; overload; virtual; Parameters row Row index. col Column index. key Initial character to be sent to the editor. Return Value True if the grid entered edit mode successfully, false otherwise. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.StartEditing Overload List

C1FlexGridBase.Subtotal Method
Overload List Groups rows based on cell contents and calculates aggregate values. [Visual Basic] Overloads Public Sub Subtotal(AggregateEnum) [C#] public void Subtotal(AggregateEnum); [Delphi] public procedure Subtotal(AggregateEnum); overload; Groups rows based on cell contents and calculates aggregate values. [Visual Basic] Overloads Public Sub Subtotal(AggregateEnum, Integer, Integer, Integer) [C#] public void Subtotal(AggregateEnum, int, int, int); [Delphi] public procedure Subtotal(AggregateEnum; Int32; Int32; Int32); overload; Groups rows based on cell contents and calculates aggregate values. [Visual Basic] Overloads Public Sub Subtotal(AggregateEnum, Integer, String, String) [C#] public void Subtotal(AggregateEnum, int, string, string); [Delphi] public procedure Subtotal(AggregateEnum; Int32; String; String); overload; Groups rows based on cell contents and calculates aggregate values. [Visual Basic] Overloads Public Sub Subtotal(AggregateEnum, Integer, Integer, Integer, String)

C1FlexGridBase.Subtotal Method 473

[C#] public void Subtotal(AggregateEnum, int, int, int, string); [Delphi] public procedure Subtotal(AggregateEnum; Int32; Int32; Int32; String); overload; Groups rows based on cell contents and calculates aggregate values. [Visual Basic] Overloads Public Sub Subtotal(AggregateEnum, Integer, String, String, String) [C#] public void Subtotal(AggregateEnum, int, string, string, string); [Delphi] public procedure Subtotal(AggregateEnum; Int32; String; String; String); overload; Groups rows based on cell contents and calculates aggregate values. [Visual Basic] Overloads Public Sub Subtotal(AggregateEnum, Integer, Integer, Integer, Integer, String) [C#] public void Subtotal(AggregateEnum, int, int, int, int, string); [Delphi] public procedure Subtotal(AggregateEnum; Int32; Int32; Int32; Int32; String); overload; Groups rows based on cell contents and calculates aggregate values. [Visual Basic] Overloads Public Sub Subtotal(AggregateEnum, Integer, String, String, String, String) [C#] public void Subtotal(AggregateEnum, int, string, string, string, string); [Delphi] public procedure Subtotal(AggregateEnum; Int32; String; String; String; String); overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.Subtotal Method (AggregateEnum)


Groups rows based on cell contents and calculates aggregate values. [Visual Basic] Overloads Public Sub Subtotal( _ ByVal aggType As AggregateEnum _ ) [C#] public void Subtotal( AggregateEnum aggType ); [Delphi] public procedure Subtotal( aggType: AggregateEnum ); overload; Parameters aggType AggregateEnum value that specifies the type of aggregate to calculate. Remarks This version of the Subtotal method does not take any column parameters, and is useful only for clearing the subtotals. For example: Visual Basic flex.Subtotal(AggregateEnum.Clear) ' clear all subtotals

474 C1.Win.C1FlexGrid Namespace

C# flex.Subtotal(AggregateEnum.Clear); // clear all subtotals Delphi flex.Subtotal(AggregateEnum.Clear); // clear all subtotals

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Subtotal Overload List

C1FlexGridBase.Subtotal Method (AggregateEnum, Int32, Int32, Int32)


Groups rows based on cell contents and calculates aggregate values. [Visual Basic] Overloads Public Sub Subtotal( _ ByVal aggType As AggregateEnum, _ ByVal level As Integer, _ ByVal groupOn As Integer, _ ByVal totalOn As Integer _ ) [C#] public void Subtotal( AggregateEnum aggType, int level, int groupOn, int totalOn ); [Delphi] public procedure Subtotal( aggType: AggregateEnum; level: Int32; groupOn: Int32; totalOn: Int32 ); overload; Parameters aggType AggregateEnum value that specifies the type of aggregate to calculate. level Outline level to assign to the new subtotal rows. This parameter allows the creation of multi-level subtotals and affects the display of the outline tree. groupOn Column used to detect group breaks. totalOn Column that contains values to be aggregated (usually numeric). See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Subtotal Overload List

C1FlexGridBase.Subtotal Method 475

C1FlexGridBase.Subtotal Method (AggregateEnum, Int32, String, String)


Groups rows based on cell contents and calculates aggregate values. [Visual Basic] Overloads Public Sub Subtotal( _ ByVal aggType As AggregateEnum, _ ByVal level As Integer, _ ByVal groupOn As String, _ ByVal totalOn As String _ ) [C#] public void Subtotal( AggregateEnum aggType, int level, string groupOn, string totalOn ); [Delphi] public procedure Subtotal( aggType: AggregateEnum; level: Int32; groupOn: String; totalOn: String ); overload; Parameters aggType AggregateEnum value that specifies the type of aggregate to calculate. level Outline level to assign to the new subtotal rows. This parameter allows the creation of multi-level subtotals and affects the display of the outline tree. groupOn Name column used to detect group breaks. totalOn Name of the column that contains values to be aggregated (usually numeric). Remarks This is a variant of the Subtotal method that takes column names instead of indices. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Subtotal Overload List

C1FlexGridBase.Subtotal Method (AggregateEnum, Int32, Int32, Int32, String)


Groups rows based on cell contents and calculates aggregate values.

476 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overloads Public Sub Subtotal( _ ByVal aggType As AggregateEnum, _ ByVal level As Integer, _ ByVal groupOn As Integer, _ ByVal totalOn As Integer, _ ByVal caption As String _ ) [C#] public void Subtotal( AggregateEnum aggType, int level, int groupOn, int totalOn, string caption ); [Delphi] public procedure Subtotal( aggType: AggregateEnum; level: Int32; groupOn: Int32; totalOn: Int32; caption: String ); overload; Parameters aggType AggregateEnum value that specifies the type of aggregate to calculate. level Outline level to assign to the new subtotal rows. This parameter allows the creation of multi-level subtotals and affects the display of the outline tree. groupOn Column used to detect group breaks. totalOn Column that contains values to be aggregated (usually numeric). caption Text to insert in the subtotal rows. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Subtotal Overload List

C1FlexGridBase.Subtotal Method (AggregateEnum, Int32, String, String, String)


Groups rows based on cell contents and calculates aggregate values.

C1FlexGridBase.Subtotal Method 477

[Visual Basic] Overloads Public Sub Subtotal( _ ByVal aggType As AggregateEnum, _ ByVal level As Integer, _ ByVal groupOn As String, _ ByVal totalOn As String, _ ByVal caption As String _ ) [C#] public void Subtotal( AggregateEnum aggType, int level, string groupOn, string totalOn, string caption ); [Delphi] public procedure Subtotal( aggType: AggregateEnum; level: Int32; groupOn: String; totalOn: String; caption: String ); overload; Parameters aggType AggregateEnum value that specifies the type of aggregate to calculate. level Outline level to assign to the new subtotal rows. This parameter allows the creation of multi-level subtotals and affects the display of the outline tree. groupOn Name column used to detect group breaks. totalOn Name of the column that contains values to be aggregated (usually numeric). caption Text to insert in the subtotal rows. Remarks This is a variant of the Subtotal method that takes column names instead of indices. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Subtotal Overload List

C1FlexGridBase.Subtotal Method (AggregateEnum, Int32, Int32, Int32, Int32, String)


Groups rows based on cell contents and calculates aggregate values.

478 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overloads Public Sub Subtotal( _ ByVal aggType As AggregateEnum, _ ByVal level As Integer, _ ByVal groupFrom As Integer, _ ByVal groupTo As Integer, _ ByVal totalOn As Integer, _ ByVal caption As String _ ) [C#] public void Subtotal( AggregateEnum aggType, int level, int groupFrom, int groupTo, int totalOn, string caption ); [Delphi] public procedure Subtotal( aggType: AggregateEnum; level: Int32; groupFrom: Int32; groupTo: Int32; totalOn: Int32; caption: String ); overload; Parameters aggType AggregateEnum value that specifies the type of aggregate to calculate. level Outline level to assign to the new subtotal rows. This parameter allows the creation of multi-level subtotals and affects the display of the outline tree. groupFrom First column in the range used to detect group breaks. groupTo Last column in the range used to detect group breaks. totalOn Column that contains values to be aggregated (usually numeric). caption Text to insert in the subtotal rows. Remarks The Subtotal method inserts rows containing aggregate values. These new rows are set to behave as tree nodes so they can be collapsed and expanded to display a dynamic hierarchical outline. You can control the appearance and behavior of the outline tree using the Tree property.

C1FlexGridBase.Subtotal Method 479

The node rows added by the Subtotal method have their RowCol.Style property automatically set to one of the Styles.Subtotal* styles. You can use the Styles collection to modify the appearance of all subtotal rows on the grid. To create an outline tree manually, insert node rows using the RowCollection.InsertNode method, or convert regular rows into nodes by setting the Row.IsNode property to true for the node rows. Then use the Node.Level property to set the outline level for the new nodes. Example The code below assumes a grid with four columns: "Product", "Region", "Employee", and "Sales". The code groups on the first two columns, calculating total sales for each product and for each region within each product. If the user drags a column to a new position, the tree is automatically rebuilt to show the new grouping (by Employee, Region, and so on). Visual Basic Private Sub UpdateTotals() ' no repainging until we're done _flex.Redraw = False ' clear old subtotals, if any _flex.Subtotal(AggregateEnum.Clear) ' sort the grid on the columns that will be grouped _flex.Sort(SortFlags.Ascending, 0, 3) ' show outline tree on column 0 _flex.Tree.Column = 0 ' get a grand total (use -1 instead of column index) _flex.Subtotal(AggregateEnum.Sum, - 1, - 1, 3, "Grand Total") ' total on column 0 (initially Product) _flex.Subtotal(AggregateEnum.Sum, 0, 0, 3) ' total on column 1 (initially Region) _flex.Subtotal(AggregateEnum.Sum, 1, 1, 3) ' show outline level 1 _flex.Tree.Show(1) ' restore painting _flex.Redraw = True End Sub Private Sub _flex_AfterDragColumn(sender As Object, e As C1.Win.C1FlexGrid.DragRowColEventArgs) UpdateTotals() ' user moved a column, update totals End Sub C# private void UpdateTotals() { // no repainging until we're done _flex.Redraw = false;

480 C1.Win.C1FlexGrid Namespace

// clear old subtotals, if any _flex.Subtotal(AggregateEnum.Clear); // sort the grid on the columns that will be grouped _flex.Sort(SortFlags.Ascending, 0, 3); // show outline tree on column 0 _flex.Tree.Column = 0; // get a grand total (use -1 instead of column index) _flex.Subtotal(AggregateEnum.Sum, -1, -1, 3, "Grand Total"); // total on column 0 (initially Product) _flex.Subtotal(AggregateEnum.Sum, 0, 0, 3); // total on column 1 (initially Region) _flex.Subtotal(AggregateEnum.Sum, 1, 1, 3); // show outline level 1 _flex.Tree.Show(1); // restore painting _flex.Redraw = true; } private void _flex_AfterDragColumn(object sender, C1.Win.C1FlexGrid.DragRowColEventArgs e) { UpdateTotals(); // user moved a column, update totals } Delphi procedure UpdateTotals(); begin // no repainting until we're done _flex.Redraw := False; // clear old subtotals, if any _flex.Subtotal(AggregateEnum.Clear); // sort the grid on the columns that will be grouped _flex.Sort(SortFlags.Ascending, 0, 3); // show outline tree on column 0 _flex.Tree.Column := 0; // get a grand total (use -1 instead of column index) _flex.Subtotal(AggregateEnum.Sum, -1, -1, 3, 'Grand Total'); // total on column 0 (initally Product) _flex.Subtotal(AggregateEnum.Sum, 0, 0, 3); // total on column 1 (initally Region) _flex.Subtotal(AggregateEnum.Sum, 1, 1, 3); // show outline level 1 _flex.Tree.Show(1);

C1FlexGridBase.Subtotal Method 481

// restore painting _flex.Redraw := True; end; procedure _flex_AfterDragColumn(sender: object; e: C1.Win.C1FlexGrid.DragRowColEventArgs); begin UpdateTotals; // user moved a column, update totals end; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Subtotal Overload List

C1FlexGridBase.Subtotal Method (AggregateEnum, Int32, String, String, String, String)


Groups rows based on cell contents and calculates aggregate values. [Visual Basic] Overloads Public Sub Subtotal( _ ByVal aggType As AggregateEnum, _ ByVal level As Integer, _ ByVal groupFrom As String, _ ByVal groupTo As String, _ ByVal totalOn As String, _ ByVal caption As String _ ) [C#] public void Subtotal( AggregateEnum aggType, int level, string groupFrom, string groupTo, string totalOn, string caption ); [Delphi] public procedure Subtotal( aggType: AggregateEnum; level: Int32; groupFrom: String; groupTo: String; totalOn: String; caption: String ); overload; Parameters aggType AggregateEnum value that specifies the type of aggregate to calculate. level Outline level to assign to the new subtotal rows. This parameter allows the creation of multi-level subtotals and affects the display of the outline tree.

482 C1.Win.C1FlexGrid Namespace

groupFrom Name of the first column in the range used to detect group breaks. groupTo Name of the last column in the range used to detect group breaks. totalOn Name of the column that contains values to be aggregated (usually numeric). caption Text to insert in the subtotal rows. Remarks This is a variant of the Subtotal method that takes column names instead of indices. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.Subtotal Overload List

C1FlexGridBase.WriteXml Method
Overload List Saves the grid contents to an XML document. [Visual Basic] Overloads Public Sub WriteXml(Stream) [C#] public void WriteXml(Stream); [Delphi] public procedure WriteXml(Stream); overload; Saves the grid contents to an XML document. [Visual Basic] Overloads Public Sub WriteXml(String) [C#] public void WriteXml(string); [Delphi] public procedure WriteXml(String); overload; Saves the grid contents to an XML document. [Visual Basic] Overloads Public Sub WriteXml(TextWriter) [C#] public void WriteXml(TextWriter); [Delphi] public procedure WriteXml(TextWriter); overload; Saves the grid contents to an XML document. [Visual Basic] Overloads Public Sub WriteXml(XmlTextWriter) [C#] public void WriteXml(XmlTextWriter); [Delphi] public procedure WriteXml(XmlTextWriter); overload; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.WriteXml Method (Stream)


Saves the grid contents to an XML document.

C1FlexGridBase.WriteXml Method 483

[Visual Basic] Overloads Public Sub WriteXml( _ ByVal stream As Stream _ ) [C#] public void WriteXml( Stream stream ); [Delphi] public procedure WriteXml( stream: Stream ); overload; Parameters stream The IO.Stream where the document is saved. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.WriteXml Overload List

C1FlexGridBase.WriteXml Method (String)


Saves the grid contents to an XML document. [Visual Basic] Overloads Public Sub WriteXml( _ ByVal fileName As String _ ) [C#] public void WriteXml( string fileName ); [Delphi] public procedure WriteXml( fileName: String ); overload; Parameters fileName Name of the file to save, including the path. Remarks The grid serializes all its contents into the XML document, including the data stored in the cells, row and column properties, styles, images, and so on. Objects of custom types stored in the grid are also serialized as long as they have an associated ComponentModel.TypeConverter that provides conversions to and from string. The WriteXml method has several overloads that allow you to save several grids into a single XML document, along with other information stored in the XML document.

484 C1.Win.C1FlexGrid Namespace

Example The code below saves a grid into an XML file: Visual Basic ' save a grid into an XML file flex.WriteXml(fileName) C# // save a grid into an XML file flex.WriteXml(fileName); Delphi // save a grid into an XML file flex.WriteXml(fileName); Visual Basic ' prepare XmlTextWriter Dim w As New XmlTextWriter(fileName, New UTF8Encoding(False)) w.Formatting = Formatting.Indented w.WriteStartDocument() w.WriteStartElement("Grids") ' save first grid w.WriteStartElement(c1FlexGrid1.Name) c1FlexGrid1.WriteXml(w) w.WriteEndElement() ' save second grid w.WriteStartElement(c1FlexGrid2.Name) c1FlexGrid2.WriteXml(w) w.WriteEndElement() ' close document w.WriteEndElement() w.Close() ' load document from file Dim doc As New XmlDocument() doc.Load(fileName) Dim n As XmlNode = doc.SelectSingleNode("Grids") ' load grids in reverse order c1FlexGrid2.ReadXml(n.ChildNodes(0)) c1FlexGrid1.ReadXml(n.ChildNodes(1)) C# // prepare XmlTextWriter XmlTextWriter w = new XmlTextWriter(fileName, new UTF8Encoding(false)); w.Formatting = Formatting.Indented; w.WriteStartDocument(); w.WriteStartElement("Grids"); // save first grid w.WriteStartElement(c1FlexGrid1.Name); c1FlexGrid1.WriteXml(w); w.WriteEndElement();

The code below saves two grids into an XML file, then reads them back in reverse order:

C1FlexGridBase.WriteXml Method 485

// save second grid w.WriteStartElement(c1FlexGrid2.Name); c1FlexGrid2.WriteXml(w); w.WriteEndElement(); // close document w.WriteEndElement(); w.Close(); // load document from file XmlDocument doc = new XmlDocument(); doc.Load(fileName); XmlNode n = doc.SelectSingleNode("Grids"); // load grids in reverse order c1FlexGrid2.ReadXml(n.ChildNodes[0]); c1FlexGrid1.ReadXml(n.ChildNodes[1]); Delphi // prepare XmlTextWriter w := XmlTextWriter.Create(fileName, UTF8Encoding.Create(False)); w.Formatting := Formatting.Indented; w.WriteStartDocument; w.WriteStartElement('Grids'); // save first grid w.WriteStartElement(c1FlexGrid1.Name); c1FlexGrid1.WriteXml(w); w.WriteEndElement; // save second grid w.WriteStartElement(c1FlexGrid2.Name); c1FlexGrid2.WriteXml(w); w.WriteEndElement; // close document w.WriteEndElement; w.Close; // load document from file doc := XmlDocument.Create; doc.Load(fileName); n := doc.SelectSingleNode('Grids'); // load grids in reverse order c1FlexGrid2.ReadXml(n.ChildNodes[0]); c1FlexGrid1.ReadXml(n.ChildNodes[1]); See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.WriteXml Overload List

C1FlexGridBase.WriteXml Method (TextWriter)


Saves the grid contents to an XML document.

486 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overloads Public Sub WriteXml( _ ByVal tw As TextWriter _ ) [C#] public void WriteXml( TextWriter tw ); [Delphi] public procedure WriteXml( tw: TextWriter ); overload; Parameters tw The IO.TextWriter where the document is saved. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.WriteXml Overload List

C1FlexGridBase.WriteXml Method (XmlTextWriter)


Saves the grid contents to an XML document. [Visual Basic] Overloads Public Sub WriteXml( _ ByVal w As XmlTextWriter _ ) [C#] public void WriteXml( XmlTextWriter w ); [Delphi] public procedure WriteXml( w: XmlTextWriter ); overload; Parameters w The Xml.XmlTextWriter where the document is saved. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace | C1FlexGridBase.WriteXml Overload List

C1FlexGridBase Events 487

C1FlexGridBase Events
The events of the C1FlexGridBase class are listed here. For a complete list of C1FlexGridBase class members, see the C1FlexGridBase Members topic. Public Events AfterAddRow AfterCollapse AfterDataRefresh AfterDeleteRow AfterDragColumn AfterDragRow AfterEdit AfterFreezeColumn AfterFreezeRow AfterResizeColumn AfterResizeRow AfterRowColChange AfterScroll AfterSelChange AfterSort BeforeAddRow BeforeAutosizeColumn BeforeAutosizeRow BeforeCollapse BeforeDeleteRow BeforeDoubleClick BeforeDragColumn BeforeDragRow BeforeEdit BeforeFreezeColumn Fires after a new row is added by the user. Fires after a node row is collapsed or expanded. Fires after any data source change notifications. Fires after one or more rows are deleted by the user. Fires after the user finishes dragging a column. Fires after the user finishes dragging a row. Fires after a cell has been edited. Fires after columns are frozen by dragging the frozen column divider. Fires after rows are frozen by dragging the frozen row divider. Fires after a column is resized by dragging the column header. Fires after a row is resized by dragging the row header. Fires after the current cell changes ( Row and Col properties). Fires after the grid scrolls. Fires after the selection changes ( Row, Col, RowSel, ColSel properties). Fires after a column is sorted by a click on a column header. Fires before a new row is added by the user. Fires before a column is automatically resized by a double-click on a column header. Fires before a row is automatically resized by a doubleclick on a row header. Fires before a node row is collapsed or expanded. Fires before a row is deleted by the user. Fires before the DoubleClick event is handled by the grid. Fires before the user starts dragging a column. Fires before the user starts dragging a row. Fires before the grid enters edit mode, and also when the cell that has the focus needs to be painted. Fires before columns are frozen by dragging the frozen column divider.

488 C1.Win.C1FlexGrid Namespace

BeforeFreezeRow BeforeMouseDown BeforePageBreak BeforeResizeColumn BeforeResizeRow BeforeRowColChange BeforeScroll BeforeSelChange BeforeSort BeginPrint CancelAddRow CellButtonClick CellChanged ChangeEdit ComboCloseUp ComboDropDown EndPrint EnterCell GetCellErrorInfo GetRowErrorInfo GetUnboundValue GridChanged GridError KeyDownEdit KeyPressEdit

Fires before rows are frozen by dragging the frozen row divider. Fires before the MouseDown event is handled by the grid. Fires while the control is being printed to provide control over page breaks. Fires before a column is resized by dragging the column header. Fires before a row is resized by dragging the row header. Fires before the current cell changes ( Row and Col properties). Fires before the grid scrolls. Fires before the selection changes ( Row, Col, RowSel, ColSel properties). Fires before a column is sorted by a click on a column header. Fires before the grid starts printing. Fires when the cursor leaves the new row without making any changes to it. Fires after the user clicks a cell button. Fires after the contents of a cell have changed. Fires in edit mode, after the contents of the editor change. Fires in edit mode, when the dropdown portion of an editor closes. Fires in edit mode, when the dropdown portion of an editor opens. Fires after the grid finishes printing. Fires after the current cell changes ( Row and Col properties). Fires when ShowErrors is set to true and the control needs error information for a cell. Fires when ShowErrors is set to true and the control needs error information for a row. Fires when the grid needs to retrieve data for an unbound cell. Fires when the grid or its contents change. Fires after the data source reports an error condition. Fires in edit mode, when the user presses a key. Fires in edit mode, when the user presses a character key.

C1FlexGridBase.AfterAddRow Event 489

KeyUpEdit LeaveCell LeaveEdit MouseHoverCell OwnerDrawCell PrintPage RowColChange SelChange SetUnboundValue SetupEditor ShowScrollTip StartDrag StartEdit ValidateEdit See Also

Fires in edit mode, when the user releases a key. Fires before the current cell changes ( Row and Col properties). Fires after the control leaves edit mode. Fires when the mouse enters or leaves a cell. Fires before the grid draws a cell, when the DrawMode property is set to DrawModeEnum.OwnerDraw. Fires after the grid finishes printing a page. Fires after the current cell changes ( Row and Col properties). Fires after the selection changes ( Row, Col, RowSel, ColSel properties). Fires when the grid needs to store data in an unbound cell. Fires after a cell editor has been initialized by the grid, to allow additional custom initialization. Fires before the vertical scrolltip is displayed. Fires before the grid starts an automatic OLE drag operation. Fires before the control enters edit mode. Fires before the control exits cell edit mode, while the editor is still active.

C1FlexGridBase Class | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterAddRow Event
Fires after a new row is added by the user. [Visual Basic] Public Event AfterAddRow As RowColEventHandler [C#] public event RowColEventHandler AfterAddRow [Delphi] public property AfterAddRow: RowColEventHandler read remove_AfterAddRow write add_AfterAddRow; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterCollapse Event
Fires after a node row is collapsed or expanded.

490 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Event AfterCollapse As RowColEventHandler [C#] public event RowColEventHandler AfterCollapse [Delphi] public property AfterCollapse: RowColEventHandler read remove_AfterCollapse write add_AfterCollapse; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterDataRefresh Event
Fires after any data source change notifications. [Visual Basic] Public Event AfterDataRefresh As ListChangedEventHandler [C#] public event ListChangedEventHandler AfterDataRefresh [Delphi] public property AfterDataRefresh: ListChangedEventHandler read remove_AfterDataRefresh write add_AfterDataRefresh; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterDeleteRow Event
Fires after one or more rows are deleted by the user. [Visual Basic] Public Event AfterDeleteRow As RowColEventHandler [C#] public event RowColEventHandler AfterDeleteRow [Delphi] public property AfterDeleteRow: RowColEventHandler read remove_AfterDeleteRow write add_AfterDeleteRow; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterDragColumn Event
Fires after the user finishes dragging a column. [Visual Basic] Public Event AfterDragColumn As DragRowColEventHandler

C1FlexGridBase.AfterDragRow Event 491

[C#] public event DragRowColEventHandler AfterDragColumn [Delphi] public property AfterDragColumn: DragRowColEventHandler read remove_AfterDragColumn write add_AfterDragColumn; Remarks This event only fires when the user drags a column using the mouse. It does not fire when a column is moved using the ColumnCollection.Move method. You can prevent specific columns from being dragged by the user by setting their RowCol.AllowDragging property to false. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterDragRow Event
Fires after the user finishes dragging a row. [Visual Basic] Public Event AfterDragRow As DragRowColEventHandler [C#] public event DragRowColEventHandler AfterDragRow [Delphi] public property AfterDragRow: DragRowColEventHandler read remove_AfterDragRow write add_AfterDragRow; Remarks This event only fires when the user drags a row using the mouse. It does not fire when a row is moved using the RowCollection.Move method. You can prevent specific rows from being dragged by the user by setting their RowCol.AllowDragging property to false. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterEdit Event
Fires after a cell has been edited. [Visual Basic] Public Event AfterEdit As RowColEventHandler [C#] public event RowColEventHandler AfterEdit [Delphi] public property AfterEdit: RowColEventHandler read remove_AfterEdit write add_AfterEdit;

492 C1.Win.C1FlexGrid Namespace

Remarks This event does not fire if the user cancels the edits by pressing the ESC key. The LeaveEdit event fires whenever the grid leaves edit mode, even if the edits were canceled. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterFreezeColumn Event
Fires after columns are frozen by dragging the frozen column divider. [Visual Basic] Public Event AfterFreezeColumn As RowColEventHandler [C#] public event RowColEventHandler AfterFreezeColumn [Delphi] public property AfterFreezeColumn: RowColEventHandler read remove_AfterFreezeColumn write add_AfterFreezeColumn; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterFreezeRow Event
Fires after rows are frozen by dragging the frozen row divider. [Visual Basic] Public Event AfterFreezeRow As RowColEventHandler [C#] public event RowColEventHandler AfterFreezeRow [Delphi] public property AfterFreezeRow: RowColEventHandler read remove_AfterFreezeRow write add_AfterFreezeRow; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterResizeColumn Event
Fires after a column is resized by dragging the column header. [Visual Basic] Public Event AfterResizeColumn As RowColEventHandler [C#] public event RowColEventHandler AfterResizeColumn

C1FlexGridBase.AfterResizeRow Event 493

[Delphi] public property AfterResizeColumn: RowColEventHandler read remove_AfterResizeColumn write add_AfterResizeColumn; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterResizeRow Event
Fires after a row is resized by dragging the row header. [Visual Basic] Public Event AfterResizeRow As RowColEventHandler [C#] public event RowColEventHandler AfterResizeRow [Delphi] public property AfterResizeRow: RowColEventHandler read remove_AfterResizeRow write add_AfterResizeRow; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterRowColChange Event
Fires after the current cell changes ( Row and Col properties). [Visual Basic] Public Event AfterRowColChange As RangeEventHandler [C#] public event RangeEventHandler AfterRowColChange [Delphi] public property AfterRowColChange: RangeEventHandler read remove_AfterRowColChange write add_AfterRowColChange; Remarks This event fires before the Row or Col properties change, either as a result of user actions (mouse or keyboard) or through code. It allows you to display additional information about the currently selected row, column, or cell. To perform validation or prevent certain cells from being selected, use the BeforeRowColChange and BeforeSelChange events instead. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterScroll Event
Fires after the grid scrolls. [Visual Basic] Public Event AfterScroll As RangeEventHandler

494 C1.Win.C1FlexGrid Namespace

[C#] public event RangeEventHandler AfterScroll [Delphi] public property AfterScroll: RangeEventHandler read remove_AfterScroll write add_AfterScroll; Remarks This event allows you to prevent the user from scrolling the grid while an operation is being performed on the current selection. Example The code below prevents the grid from scrolling while the grid is in edit mode. Visual Basic Private Sub _flex_BeforeScroll(sender As Object, e As C1.Win.C1FlexGrid.RangeEventArgs) If Not (_flex.Editor Is Nothing) Then e.Cancel = True End If End Sub C# private void _flex_BeforeScroll(object sender, C1.Win.C1FlexGrid.RangeEventArgs e) { if (_flex.Editor != null) e.Cancel = true; } Delphi procedure _flex_BeforeScroll(sender: object; e: C1.Win.C1FlexGrid.RangeEventArgs); begin if (_flex.Editor <> nil) then e.Cancel := True; end;

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterSelChange Event
Fires after the selection changes ( Row, Col, RowSel, ColSel properties). [Visual Basic] Public Event AfterSelChange As RangeEventHandler [C#] public event RangeEventHandler AfterSelChange [Delphi] public property AfterSelChange: RangeEventHandler read remove_AfterSelChange write add_AfterSelChange;

C1FlexGridBase.AfterSort Event 495

Remarks This event is fired after the RowSel or ColSel properties change, either as a result of user actions (mouse or keyboard) or through code. This event is useful if you want to display additional information about the current selection. To perform validation or prevent certain cells from being selected, use the BeforeRowColChange and BeforeSelChange events instead. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.AfterSort Event
Fires after a column is sorted by a click on a column header. [Visual Basic] Public Event AfterSort As SortColEventHandler [C#] public event SortColEventHandler AfterSort [Delphi] public property AfterSort: SortColEventHandler read remove_AfterSort write add_AfterSort; Remarks This event only fires if the sorting was caused by a click on a column header cell (see the AllowSorting property). It does not fire after sorting with the Sort method. This event is useful if you want to update user interface elements to reflect the new sorting. To prevent certain columns from being sorted, or to alter their default sorting order, use the Column.AllowSorting or handle the BeforeSort event. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeAddRow Event
Fires before a new row is added by the user. [Visual Basic] Public Event BeforeAddRow As RowColEventHandler [C#] public event RowColEventHandler BeforeAddRow [Delphi] public property BeforeAddRow: RowColEventHandler read remove_BeforeAddRow write add_BeforeAddRow; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeAutosizeColumn Event
Fires before a column is automatically resized by a double-click on a column header.

496 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Event BeforeAutosizeColumn As RowColEventHandler [C#] public event RowColEventHandler BeforeAutosizeColumn [Delphi] public property BeforeAutosizeColumn: RowColEventHandler read remove_BeforeAutosizeColumn write add_BeforeAutosizeColumn; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeAutosizeRow Event
Fires before a row is automatically resized by a double-click on a row header. [Visual Basic] Public Event BeforeAutosizeRow As RowColEventHandler [C#] public event RowColEventHandler BeforeAutosizeRow [Delphi] public property BeforeAutosizeRow: RowColEventHandler read remove_BeforeAutosizeRow write add_BeforeAutosizeRow; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeCollapse Event
Fires before a node row is collapsed or expanded. [Visual Basic] Public Event BeforeCollapse As RowColEventHandler [C#] public event RowColEventHandler BeforeCollapse [Delphi] public property BeforeCollapse: RowColEventHandler read remove_BeforeCollapse write add_BeforeCollapse; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeDeleteRow Event
Fires before a row is deleted by the user. [Visual Basic] Public Event BeforeDeleteRow As RowColEventHandler

C1FlexGridBase.BeforeDoubleClick Event 497

[C#] public event RowColEventHandler BeforeDeleteRow [Delphi] public property BeforeDeleteRow: RowColEventHandler read remove_BeforeDeleteRow write add_BeforeDeleteRow; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeDoubleClick Event
Fires before the DoubleClick event is handled by the grid. [Visual Basic] Public Event BeforeDoubleClick As BeforeMouseDownEventHandler [C#] public event BeforeMouseDownEventHandler BeforeDoubleClick [Delphi] public property BeforeDoubleClick: BeforeMouseDownEventHandler read remove_BeforeDoubleClick write add_BeforeDoubleClick; Remarks This event fires before the grid processes the DoubleClick event, and gives the program a chance to customize the behavior of the control and optionally cancel the default handling of the mouse. Example The code below handles the BeforeDoubleClick event to detect double-clicks on cells in a specific column and provide a custom edit dialog instead of using the built-in editor. Visual Basic Private Sub _flex_BeforeDoubleClick(sender As Object, e As C1.Win.C1FlexGrid.BeforeMouseDownEventArgs) ' detect double-clicks on column "Customer" Dim hti As HitTestInfo = _flex.HitTest(e.X, e.Y) If hti.Type = HitTestTypeEnum.Cell And _flex(hti.Column).Name = "Customer" Then e.Cancel = True ' cancel default handling ShowCustomEditDialog(hti.Row, hti.Column) ' handle row drag/drop End If End Sub C# private void _flex_BeforeDoubleClick(object sender, C1.Win.C1FlexGrid.BeforeMouseDownEventArgs e) { // detect double-clicks on column "Customer" HitTestInfo hti = _flex.HitTest(e.X, e.Y); if (hti.Type == HitTestTypeEnum.Cell && _flex[hti.Column].Name == "Customer") {

498 C1.Win.C1FlexGrid Namespace

e.Cancel = true; // cancel default handling ShowCustomEditDialog(hti.Row, hti.Column); // handle row drag/drop } } Delphi procedure _flex_BeforeDoubleClick(sender: object; e: C1.Win.C1FlexGrid.BeforeMouseDownEventArgs); begin // detect double-clicks on column "Customer" hti := _flex.HitTest(e.X, e.Y); if ((hti.&Type = HitTestTypeEnum.Cell) and (_flex[hti.Column].Name = 'Customer')) then begin e.Cancel := True; // cancel default handling ShowCustomEditDialog(hti.Row, hti.Column); // handle row drag/drop end; end; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeDragColumn Event
Fires before the user starts dragging a column. [Visual Basic] Public Event BeforeDragColumn As DragRowColEventHandler [C#] public event DragRowColEventHandler BeforeDragColumn [Delphi] public property BeforeDragColumn: DragRowColEventHandler read remove_BeforeDragColumn write add_BeforeDragColumn; Remarks This event only fires when the user drags a column using the mouse. It is does not fire when a column is moved using the ColumnCollection.Move method. You can prevent specific columns from being dragged by the user by setting their RowCol.AllowDragging property to false. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeDragRow Event
Fires before the user starts dragging a row. [Visual Basic] Public Event BeforeDragRow As DragRowColEventHandler [C#] public event DragRowColEventHandler BeforeDragRow

C1FlexGridBase.BeforeEdit Event 499

[Delphi] public property BeforeDragRow: DragRowColEventHandler read remove_BeforeDragRow write add_BeforeDragRow; Remarks This event only fires when the user drags a row using the mouse. It does not fire when a row is moved using the RowCollection.Move method. You can prevent specific rows from being dragged by the user by setting their RowCol.AllowDragging property to false. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeEdit Event
Fires before the grid enters edit mode, and also when the cell that has the focus needs to be painted. [Visual Basic] Public Event BeforeEdit As RowColEventHandler [C#] public event RowColEventHandler BeforeEdit [Delphi] public property BeforeEdit: RowColEventHandler read remove_BeforeEdit write add_BeforeEdit; Remarks This event doesn't fire only when the grid is about to enter edit mode. It also fires while painting cells, in order to support drawing the editor's drop-down buttons. The StartEdit event fires only when the grid is about to enter edit mode. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeFreezeColumn Event
Fires before columns are frozen by dragging the frozen column divider. [Visual Basic] Public Event BeforeFreezeColumn As RowColEventHandler [C#] public event RowColEventHandler BeforeFreezeColumn [Delphi] public property BeforeFreezeColumn: RowColEventHandler read remove_BeforeFreezeColumn write add_BeforeFreezeColumn; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

500 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeFreezeRow Event
Fires before rows are frozen by dragging the frozen row divider. [Visual Basic] Public Event BeforeFreezeRow As RowColEventHandler [C#] public event RowColEventHandler BeforeFreezeRow [Delphi] public property BeforeFreezeRow: RowColEventHandler read remove_BeforeFreezeRow write add_BeforeFreezeRow; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeMouseDown Event
Fires before the MouseDown event is handled by the grid. [Visual Basic] Public Event BeforeMouseDown As BeforeMouseDownEventHandler [C#] public event BeforeMouseDownEventHandler BeforeMouseDown [Delphi] public property BeforeMouseDown: BeforeMouseDownEventHandler read remove_BeforeMouseDown write add_BeforeMouseDown; Remarks This event fires before the grid processes the MouseDown event, and gives the program a chance to customize the behavior of the control and optionally cancel the default handling of the mouse. Example The code below handles the BeforeMouseDown event to detect clicks on row headers and provide OLE drag and drop functionality. Visual Basic Private Sub _flex_BeforeMouseDown(sender As Object, e As C1.Win.C1FlexGrid.BeforeMouseDownEventArgs) ' start dragging when the user clicks the row headers Dim hti As HitTestInfo = _flex.HitTest(e.X, e.Y) If hti.Type = HitTestTypeEnum.RowHeader Then e.Cancel = True ' cancel default handling HandleRowDragDrop(hti.Row) ' handle row drag/drop End If End Sub C# private void _flex_BeforeMouseDown(object sender, C1.Win.C1FlexGrid.BeforeMouseDownEventArgs e) {

C1FlexGridBase.BeforePageBreak Event 501

// start dragging when the user clicks the row headers HitTestInfo hti = _flex.HitTest(e.X, e.Y); if (hti.Type == HitTestTypeEnum.RowHeader) { e.Cancel = true; // cancel default handling HandleRowDragDrop(hti.Row); // handle row drag/drop } } Delphi procedure _flex_BeforeMouseDown(sender: System.Object; e: C1.Win.C1FlexGrid.BeforeMouseDownEventArgs); begin // start dragging when the user clicks the row headers hti := _flex.HitTest(e.X, e.Y); if (hti.&Type = HitTestTypeEnum.RowHeader) then begin e.Cancel := True; // cancel default handling HandleRowDragDrop(hti.Row); // handle row drag/drop end; end; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforePageBreak Event
Fires while the control is being printed to provide control over page breaks. [Visual Basic] Public Event BeforePageBreak As RowColEventHandler [C#] public event RowColEventHandler BeforePageBreak [Delphi] public property BeforePageBreak: RowColEventHandler read remove_BeforePageBreak write add_BeforePageBreak; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeResizeColumn Event
Fires before a column is resized by dragging the column header. [Visual Basic] Public Event BeforeResizeColumn As RowColEventHandler [C#] public event RowColEventHandler BeforeResizeColumn [Delphi] public property BeforeResizeColumn: RowColEventHandler read remove_BeforeResizeColumn write add_BeforeResizeColumn;

502 C1.Win.C1FlexGrid Namespace

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeResizeRow Event
Fires before a row is resized by dragging the row header. [Visual Basic] Public Event BeforeResizeRow As RowColEventHandler [C#] public event RowColEventHandler BeforeResizeRow [Delphi] public property BeforeResizeRow: RowColEventHandler read remove_BeforeResizeRow write add_BeforeResizeRow; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeRowColChange Event
Fires before the current cell changes ( Row and Col properties). [Visual Basic] Public Event BeforeRowColChange As RangeEventHandler [C#] public event RangeEventHandler BeforeRowColChange [Delphi] public property BeforeRowColChange: RangeEventHandler read remove_BeforeRowColChange write add_BeforeRowColChange; Remarks This event fires before the Row or Col properties change, either as a result of user actions or through code. It allows you to prevent the selection of certain cells, thus creating "protected" ranges on a grid. BeforeRowColChange fires only when the Row or Col properties are about to change. To detect extended selections, you also need to handle the BeforeSelChange event. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeScroll Event
Fires before the grid scrolls. [Visual Basic] Public Event BeforeScroll As RangeEventHandler [C#] public event RangeEventHandler BeforeScroll

C1FlexGridBase.BeforeSelChange Event 503

[Delphi] public property BeforeScroll: RangeEventHandler read remove_BeforeScroll write add_BeforeScroll; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeSelChange Event
Fires before the selection changes ( Row, Col, RowSel, ColSel properties). [Visual Basic] Public Event BeforeSelChange As RangeEventHandler [C#] public event RangeEventHandler BeforeSelChange [Delphi] public property BeforeSelChange: RangeEventHandler read remove_BeforeSelChange write add_BeforeSelChange; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeforeSort Event
Fires before a column is sorted by a click on a column header. [Visual Basic] Public Event BeforeSort As SortColEventHandler [C#] public event SortColEventHandler BeforeSort [Delphi] public property BeforeSort: SortColEventHandler read remove_BeforeSort write add_BeforeSort; Remarks This event only fires if the sorting was caused by a click on a column header. It does not fire before sorting with the Sort method. This event is useful when you want to prevent the user from sorting certain columns or to specify custom sorting orders for specific columns. You may do so by modifying the value of the Order parameter. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.BeginPrint Event
Fires before the grid starts printing. [Visual Basic] Public Event BeginPrint As PrintEventHandler

504 C1.Win.C1FlexGrid Namespace

[C#] public event PrintEventHandler BeginPrint [Delphi] public property BeginPrint: PrintEventHandler read remove_BeginPrint write add_BeginPrint; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.CancelAddRow Event
Fires when the cursor leaves the new row without making any changes to it. [Visual Basic] Public Event CancelAddRow As RowColEventHandler [C#] public event RowColEventHandler CancelAddRow [Delphi] public property CancelAddRow: RowColEventHandler read remove_CancelAddRow write add_CancelAddRow; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.CellButtonClick Event
Fires after the user clicks a cell button. [Visual Basic] Public Event CellButtonClick As RowColEventHandler [C#] public event RowColEventHandler CellButtonClick [Delphi] public property CellButtonClick: RowColEventHandler read remove_CellButtonClick write add_CellButtonClick; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.CellChanged Event
Fires after the contents of a cell have changed. [Visual Basic] Public Event CellChanged As RowColEventHandler [C#] public event RowColEventHandler CellChanged

C1FlexGridBase.ChangeEdit Event 505

[Delphi] public property CellChanged: RowColEventHandler read remove_CellChanged write add_CellChanged; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ChangeEdit Event
Fires in edit mode, after the contents of the editor change. [Visual Basic] Public Event ChangeEdit As EventHandler [C#] public event EventHandler ChangeEdit [Delphi] public property ChangeEdit: EventHandler read remove_ChangeEdit write add_ChangeEdit; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ComboCloseUp Event
Fires in edit mode, when the dropdown portion of an editor closes. [Visual Basic] Public Event ComboCloseUp As RowColEventHandler [C#] public event RowColEventHandler ComboCloseUp [Delphi] public property ComboCloseUp: RowColEventHandler read remove_ComboCloseUp write add_ComboCloseUp; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ComboDropDown Event
Fires in edit mode, when the dropdown portion of an editor opens. [Visual Basic] Public Event ComboDropDown As RowColEventHandler [C#] public event RowColEventHandler ComboDropDown [Delphi] public property ComboDropDown: RowColEventHandler read remove_ComboDropDown write add_ComboDropDown;

506 C1.Win.C1FlexGrid Namespace

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.EndPrint Event
Fires after the grid finishes printing. [Visual Basic] Public Event EndPrint As PrintEventHandler [C#] public event PrintEventHandler EndPrint [Delphi] public property EndPrint: PrintEventHandler read remove_EndPrint write add_EndPrint; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.EnterCell Event
Fires after the current cell changes ( Row and Col properties). [Visual Basic] Public Event EnterCell As EventHandler [C#] public event EventHandler EnterCell [Delphi] public property EnterCell: EventHandler read remove_EnterCell write add_EnterCell; Remarks This event fires after the cursor enters a cell, either as a result of user actions (mouse or keyboard), or through code. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GetCellErrorInfo Event
Fires when ShowErrors is set to true and the control needs error information for a cell. [Visual Basic] Public Event GetCellErrorInfo As GetErrorInfoEventHandler [C#] public event GetErrorInfoEventHandler GetCellErrorInfo [Delphi] public property GetCellErrorInfo: GetErrorInfoEventHandler read remove_GetCellErrorInfo write add_GetCellErrorInfo;

C1FlexGridBase.GetRowErrorInfo Event 507

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GetRowErrorInfo Event
Fires when ShowErrors is set to true and the control needs error information for a row. [Visual Basic] Public Event GetRowErrorInfo As GetErrorInfoEventHandler [C#] public event GetErrorInfoEventHandler GetRowErrorInfo [Delphi] public property GetRowErrorInfo: GetErrorInfoEventHandler read remove_GetRowErrorInfo write add_GetRowErrorInfo; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GetUnboundValue Event
Fires when the grid needs to retrieve data for an unbound cell. [Visual Basic] Public Event GetUnboundValue As UnboundValueEventHandler [C#] public event UnboundValueEventHandler GetUnboundValue [Delphi] public property GetUnboundValue: UnboundValueEventHandler read remove_GetUnboundValue write add_GetUnboundValue; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GridChanged Event
Fires when the grid or its contents change. [Visual Basic] Public Event GridChanged As GridChangedEventHandler [C#] public event GridChangedEventHandler GridChanged [Delphi] public property GridChanged: GridChangedEventHandler read remove_GridChanged write add_GridChanged; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

508 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.GridError Event
Fires after the data source reports an error condition. [Visual Basic] Public Event GridError As GridErrorEventHandler [C#] public event GridErrorEventHandler GridError [Delphi] public property GridError: GridErrorEventHandler read remove_GridError write add_GridError; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.KeyDownEdit Event
Fires in edit mode, when the user presses a key. [Visual Basic] Public Event KeyDownEdit As KeyEditEventHandler [C#] public event KeyEditEventHandler KeyDownEdit [Delphi] public property KeyDownEdit: KeyEditEventHandler read remove_KeyDownEdit write add_KeyDownEdit; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.KeyPressEdit Event
Fires in edit mode, when the user presses a character key. [Visual Basic] Public Event KeyPressEdit As KeyPressEditEventHandler [C#] public event KeyPressEditEventHandler KeyPressEdit [Delphi] public property KeyPressEdit: KeyPressEditEventHandler read remove_KeyPressEdit write add_KeyPressEdit; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.KeyUpEdit Event
Fires in edit mode, when the user releases a key.

C1FlexGridBase.LeaveCell Event 509

[Visual Basic] Public Event KeyUpEdit As KeyEditEventHandler [C#] public event KeyEditEventHandler KeyUpEdit [Delphi] public property KeyUpEdit: KeyEditEventHandler read remove_KeyUpEdit write add_KeyUpEdit; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.LeaveCell Event
Fires before the current cell changes ( Row and Col properties). [Visual Basic] Public Event LeaveCell As EventHandler [C#] public event EventHandler LeaveCell [Delphi] public property LeaveCell: EventHandler read remove_LeaveCell write add_LeaveCell; Remarks This event fires before the cursor leaves the current cell, either as a result of user actions (mouse or keyboard), or through code. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.LeaveEdit Event
Fires after the control leaves edit mode. [Visual Basic] Public Event LeaveEdit As RowColEventHandler [C#] public event RowColEventHandler LeaveEdit [Delphi] public property LeaveEdit: RowColEventHandler read remove_LeaveEdit write add_LeaveEdit; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.MouseHoverCell Event
Fires when the mouse enters or leaves a cell.

510 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Event MouseHoverCell As EventHandler [C#] public event EventHandler MouseHoverCell [Delphi] public property MouseHoverCell: EventHandler read remove_MouseHoverCell write add_MouseHoverCell; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.OwnerDrawCell Event
Fires before the grid draws a cell, when the DrawMode property is set to DrawModeEnum.OwnerDraw. [Visual Basic] Public Event OwnerDrawCell As OwnerDrawCellEventHandler [C#] public event OwnerDrawCellEventHandler OwnerDrawCell [Delphi] public property OwnerDrawCell: OwnerDrawCellEventHandler read remove_OwnerDrawCell write add_OwnerDrawCell; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.PrintPage Event
Fires after the grid finishes printing a page. [Visual Basic] Public Event PrintPage As PrintPageEventHandler [C#] public event PrintPageEventHandler PrintPage [Delphi] public property PrintPage: PrintPageEventHandler read remove_PrintPage write add_PrintPage; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.RowColChange Event
Fires after the current cell changes ( Row and Col properties). [Visual Basic] Public Event RowColChange As EventHandler

C1FlexGridBase.SelChange Event 511

[C#] public event EventHandler RowColChange [Delphi] public property RowColChange: EventHandler read remove_RowColChange write add_RowColChange; Remarks RowColChange fires when the Row or Col properties change, either as a result of user actions (mouse or keyboard) or through code. This event does not fire when the selection changes (RowSel or ColSel properties) but the active cell (Row, Col) remains the same. In this case, the SelChange event fires instead. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SelChange Event
Fires after the selection changes ( Row, Col, RowSel, ColSel properties). [Visual Basic] Public Event SelChange As EventHandler [C#] public event EventHandler SelChange [Delphi] public property SelChange: EventHandler read remove_SelChange write add_SelChange; Remarks SelChange fires after the Row, Col, RowSel, or ColSel properties change, either as a result of user actions (mouse or keyboard) or through code. This event also fires while the user extends the selection with the mouse. See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SetUnboundValue Event
Fires when the grid needs to store data in an unbound cell. [Visual Basic] Public Event SetUnboundValue As UnboundValueEventHandler [C#] public event UnboundValueEventHandler SetUnboundValue [Delphi] public property SetUnboundValue: UnboundValueEventHandler read remove_SetUnboundValue write add_SetUnboundValue;

512 C1.Win.C1FlexGrid Namespace

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.SetupEditor Event
Fires after a cell editor has been initialized by the grid, to allow additional custom initialization. [Visual Basic] Public Event SetupEditor As RowColEventHandler [C#] public event RowColEventHandler SetupEditor [Delphi] public property SetupEditor: RowColEventHandler read remove_SetupEditor write add_SetupEditor; Remarks This event can be used to customize the behavior of the cell editor by setting properties on the editor control. For example, the code below checks to see if the editor being used is a TextBox, and then sets the editor's CharacterCasing and MaxLength properties. Visual Basic Private Sub _flex_SetupEditor(ByVal sender As Object, ByVal e As RowColEventArgs) Dim tb As TextBox = _flex.Editor as TextBox If Not tb Is Nothing Then If _flex.Cols(e.Col).Name = "ID" Then tb.MaxLength = 4 Else tb.MaxLength = 32000 End If End If End Sub C# private void _flex_SetupEditor(object sender, RowColEventArgs e) { TextBox tb = _flex.Editor as TextBox; if (tb != null) { if (_flex.Cols[e.Col].Name == "ID") tb.MaxLength = 4; else tb.MaxLength = 32000; } } Delphi procedure _flex_SetupEditor(sender: System.Object; e: RowColEventArgs); var tb: TextBox; begin tb := _flex.Editor; if (tb <> nil) then if (_flex.Cols[e.Col].Name = 'ID') then

C1FlexGridBase.ShowScrollTip Event 513

tb.MaxLength := 4 else tb.MaxLength := 32000; end; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ShowScrollTip Event
Fires before the vertical scrolltip is displayed. [Visual Basic] Public Event ShowScrollTip As RowColToolTipEventHandler [C#] public event RowColToolTipEventHandler ShowScrollTip [Delphi] public property ShowScrollTip: RowColToolTipEventHandler read remove_ShowScrollTip write add_ShowScrollTip; Remarks This event fires only if the ShowScrollTips flag is set in the ScrollOptions property. It allows you to specify the text that will be displayed in the scroll tip. Example The code below uses the ShowScrollTip event to display a scroll tip showing the value of the first cell that will become visible when the user stops scrolling. Visual Basic _flex.ScrollOptions = ScrollFlags.DelayedScroll Or ScrollFlags.ShowScrollTips Private Sub _flex_ShowScrollTip(ByVal sender As Object, ByVal e As ToolTipEventArgs) Handles _flex.ShowScrollTip e.ToolTipText = String.Format("row {0}", e.Row) End Sub C# _flex.ScrollOptions = ScrollFlags.DelayedScroll | ScrollFlags.ShowScrollTips; private void _flex_ShowScrollTip(object sender, ToolTipEventArgs e) { e.ToolTipText = string.Format("row {0}", e.Row); } Delphi _flex.ScrollOptions := (ScrollFlags.DelayedScroll or ScrollFlags.ShowScrollTips); procedure _flex_ShowScrollTip(sender: System.Object; e: ToolTipEventArgs); begin e.ToolTipText := String.Format('row {0}', e.Row); end;

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

514 C1.Win.C1FlexGrid Namespace

C1FlexGridBase.StartDrag Event
Fires before the grid starts an automatic OLE drag operation. [Visual Basic] Public Event StartDrag As DragEventHandler [C#] public event DragEventHandler StartDrag [Delphi] public property StartDrag: DragEventHandler read remove_StartDrag write add_StartDrag; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.StartEdit Event
Fires before the control enters edit mode. [Visual Basic] Public Event StartEdit As RowColEventHandler [C#] public event RowColEventHandler StartEdit [Delphi] public property StartEdit: RowColEventHandler read remove_StartEdit write add_StartEdit; See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

C1FlexGridBase.ValidateEdit Event
Fires before the control exits cell edit mode, while the editor is still active. [Visual Basic] Public Event ValidateEdit As ValidateEditEventHandler [C#] public event ValidateEditEventHandler ValidateEdit [Delphi] public property ValidateEdit: ValidateEditEventHandler read remove_ValidateEdit write add_ValidateEdit;

C1FlexGridBase.ValidateEdit Event 515

Remarks When this event fires, the contents of the editor have not been applied to the grid. You can validate the editor contents and cancel the edits if necessary. For example, the code below checks to make sure the value entered is an integer between 0 and 100: Visual Basic Private Sub _flex_ValidateEdit(ByVal sender As Object, ByVal e As ValidateEditEventArgs) If _flex.Cols(e.Col).Name = "Score" Then Try Dim value As Integer = Integer.Parse(_flex.Editor.Text) If value >= 0 And value <= 50 Then Return ' accept edits End If End Try ' error or invalid range, refuse edits e.Cancel = True End If End Sub C# private void _flex_ValidateEdit(object sender, ValidateEditEventArgs e) { if (_flex.Cols[e.Col].Name = "Score") { try { int value = int.Parse(_flex.Editor.Text); if (value >= 0 && value <= 50) return; // accept edits } catch {} // error or invalid range, refuse edits e.Cancel = true; } } Delphi procedure _flex_ValidateEdit(sender: object; e: ValidateEditEventArgs); begin if (_flex.Cols[e.Col].Name = 'Score') then try value := Integer.Parse(_flex.Editor.Text); if((value >= 0) and (value <= 50)) then Exit; // accept edits except begin // error or invalid range, refuse edits e.Cancel := True; end; end; end;

See Also C1FlexGridBase Class | C1FlexGridBase Members | C1.Win.C1FlexGrid Namespace

516 C1.Win.C1FlexGrid Namespace

CellBorder Class
The CellBorder class encapsulates properties that control the appearance of borders in CellStyle objects. For a list of all members of this type, see CellBorder Members. System.Object C1.Win.C1FlexGrid.CellBorder [Visual Basic] Public Class CellBorder [C#] public class CellBorder [Delphi] type CellBorder = class; Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also CellBorder Members | C1.Win.C1FlexGrid Namespace

CellBorder Members
CellBorder overview Public Properties Color Direction Style Width See Also CellBorder Class | C1.Win.C1FlexGrid Namespace Gets or sets the border color (except for 3D borders). Gets or sets the border direction. Gets or sets the border style. Gets or sets the border width (except for 3D borders).

CellBorder Properties
The properties of the CellBorder class are listed here. For a complete list of CellBorder class members, see the CellBorder Members topic. Public Properties Color Direction Style Width Gets or sets the border color (except for 3D borders). Gets or sets the border direction. Gets or sets the border style. Gets or sets the border width (except for 3D borders).

CellBorder.Color Property 517

See Also CellBorder Class | C1.Win.C1FlexGrid Namespace

CellBorder.Color Property
Gets or sets the border color (except for 3D borders). [Visual Basic] Public Property Color As Color [C#] public Color Color {get;set;} [Delphi] public property Color: Color read get_Color write set_Color; Remarks 3D borders are always drawn using the system colors defined for highlights and shadows. See Also CellBorder Class | CellBorder Members | C1.Win.C1FlexGrid Namespace

CellBorder.Direction Property
Gets or sets the border direction. [Visual Basic] Public Property Direction As BorderDirEnum [C#] public BorderDirEnum Direction {get;set;} [Delphi] public property Direction: BorderDirEnum read get_Direction write set_Direction; See Also CellBorder Class | CellBorder Members | C1.Win.C1FlexGrid Namespace

CellBorder.Style Property
Gets or sets the border style. [Visual Basic] Public Property Style As C1.Win.C1FlexGrid.BorderStyleEnum [C#] public C1.Win.C1FlexGrid.BorderStyleEnum Style {get;set;} [Delphi] public property Style: C1.Win.C1FlexGrid.BorderStyleEnum read get_Style write set_Style;

518 C1.Win.C1FlexGrid Namespace

See Also CellBorder Class | CellBorder Members | C1.Win.C1FlexGrid Namespace

CellBorder.Width Property
Gets or sets the border width (except for 3D borders). [Visual Basic] Public Property Width As Integer [C#] public int Width {get;set;} [Delphi] public property Width: Int32 read get_Width write set_Width; Remarks 3D borders are always one or two pixels wide. See Also CellBorder Class | CellBorder Members | C1.Win.C1FlexGrid Namespace

CellRange Structure
Represents cell ranges, allowing the caller to set properties for multiple cells with a single statement. For a list of all members of this type, see CellRange Members. System.Object System.ValueType C1.Win.C1FlexGrid.CellRange [Visual Basic] Public Structure CellRange [C#] public struct CellRange [Delphi] type CellRange = record; Remarks The CellRange structure does not have a public constructor. To create a CellRange object, use the C1FlexGridBase.GetCellRange method. Note that CellRange is a structure, not a class. This means the object is used as a value, not as a reference. If you pass a CellRange to a method and change the object within that method, the original value is not modified. Ranges are defined by two rows and two columns (r1, c1, r2, and c2). These values do not have to be in order (r1 may be smaller or greater than r2). To obtain the values in order, use the Normalize method or the TopRow, BottomRow, LeftCol, and RightCol properties. Namespace: C1.Win.C1FlexGrid

CellRange Members 519

Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange Members
CellRange overview Public Fields c1 c2 r1 r2 Public Properties BottomRow Checkbox Clip Data DataDisplay Image IsSingleCell IsValid LeftCol RightCol Style StyleDisplay StyleNew TopRow UserData Public Methods Clear Contains ContainsCol ContainsRow Clears selected elements from the range. Determines whether the range contains a given cell. Determines whether the range contains a given column. Determines whether the range contains a given row. Gets the index of the bottom row in the range. Gets or sets the state of the checkbox in the range. Gets or sets a string containing the values of all cells in the range. Gets or sets the data stored in every cell in the range. Gets the value in cell ( r1, c1), formatted as a string. Gets or sets the Image assigned to cells in the range. Gets a value that indicates if the range contains a single cell. Gets a value that indicates if the range contains valid row and column indices. Gets the index of the left column in the range. Gets the index of the right column in the range. Gets or sets the style used to display every cell in the range. Gets the style used to render cell ( r1, c1). Gets or sets the style used to display every cell in the range, creating a new style if necessary. Gets the index of the top row in the range. Gets or sets arbitrary used data assigned to cells in the range. Gets or sets the range's first column index. Gets or sets the range's last column index. Gets or sets the range's first row index. Gets or sets the range's last row index.

520 C1.Win.C1FlexGrid Namespace

Normalize ToString See Also

Normalizes the range so that r1 is the TopRow, r2 is the BottomRow, c1 is the LeftCol, and c2 is the RightCol. Overridden. Gets a string representation for this object.

CellRange Structure | C1.Win.C1FlexGrid Namespace

CellRange Fields
The fields of the CellRange structure are listed here. For a complete list of CellRange structure members, see the CellRange Members topic. c1 c2 r1 r2 See Also CellRange Structure | C1.Win.C1FlexGrid Namespace Gets or sets the range's first column index. Gets or sets the range's last column index. Gets or sets the range's first row index. Gets or sets the range's last row index.

CellRange.c1 Field
Gets or sets the range's first column index. [Visual Basic] Public c1 As Integer [C#] public int c1 [Delphi] public c1: Int32; See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.c2 Field
Gets or sets the range's last column index. [Visual Basic] Public c2 As Integer [C#] public int c2 [Delphi] public c2: Int32; See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.r1 Field 521

CellRange.r1 Field
Gets or sets the range's first row index. [Visual Basic] Public r1 As Integer [C#] public int r1 [Delphi] public r1: Int32; See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.r2 Field
Gets or sets the range's last row index. [Visual Basic] Public r2 As Integer [C#] public int r2 [Delphi] public r2: Int32; See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange Properties
The properties of the CellRange structure are listed here. For a complete list of CellRange structure members, see the CellRange Members topic. BottomRow Checkbox Clip Data DataDisplay Image IsSingleCell IsValid LeftCol RightCol Gets the index of the bottom row in the range. Gets or sets the state of the checkbox in the range. Gets or sets a string containing the values of all cells in the range. Gets or sets the data stored in every cell in the range. Gets the value in cell ( r1, c1), formatted as a string. Gets or sets the Image assigned to cells in the range. Gets a value that indicates if the range contains a single cell. Gets a value that indicates if the range contains valid row and column indices. Gets the index of the left column in the range. Gets the index of the right column in the range.

522 C1.Win.C1FlexGrid Namespace

Style StyleDisplay StyleNew TopRow UserData See Also

Gets or sets the style used to display every cell in the range. Gets the style used to render cell ( r1, c1). Gets or sets the style used to display every cell in the range, creating a new style if necessary. Gets the index of the top row in the range. Gets or sets arbitrary used data assigned to cells in the range.

CellRange Structure | C1.Win.C1FlexGrid Namespace

CellRange.BottomRow Property
Gets the index of the bottom row in the range. [Visual Basic] Public ReadOnly Property BottomRow As Integer [C#] public int BottomRow {get;} [Delphi] public property BottomRow: Int32 read get_BottomRow; See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.Checkbox Property
Gets or sets the state of the checkbox in the range. [Visual Basic] Public Property Checkbox As CheckEnum [C#] public CheckEnum Checkbox {get;set;} [Delphi] public property Checkbox: CheckEnum read get_Checkbox write set_Checkbox; Remarks When getting, this property returns the checkbox value that corresponds to cell ( r1, c1). When setting, it applies the new value to all cells in the range. See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.Clip Property
Gets or sets a string containing the values of all cells in the range.

CellRange.Data Property 523

[Visual Basic] Public Property Clip As String [C#] public string Clip {get;set;} [Delphi] public property Clip: String read get_Clip write set_Clip; Remarks The cell values are delimited by characters specified by the C1FlexGridBase.ClipSeparators property. By default, columns are separated by tabs (\t or vbTab) and rows by line breaks (\n or vbCr). See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.Data Property
Gets or sets the data stored in every cell in the range. [Visual Basic] Public Property Data As Object [C#] public object Data {get;set;} [Delphi] public property Data: Object read get_Data write set_Data; See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.DataDisplay Property
Gets the value in cell ( r1, c1), formatted as a string. [Visual Basic] Public ReadOnly Property DataDisplay As String [C#] public string DataDisplay {get;} [Delphi] public property DataDisplay: String read get_DataDisplay; See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.Image Property
Gets or sets the Image assigned to cells in the range. [Visual Basic] Public Property Image As Image

524 C1.Win.C1FlexGrid Namespace

[C#] public Image Image {get;set;} [Delphi] public property Image: Image read get_Image write set_Image; Remarks When getting, this property returns the Image assigned to cell ( r1, c1). When setting, it applies the new value to all cells in the range. See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.IsSingleCell Property
Gets a value that indicates if the range contains a single cell. [Visual Basic] Public ReadOnly Property IsSingleCell As Boolean [C#] public bool IsSingleCell {get;} [Delphi] public property IsSingleCell: Boolean read get_IsSingleCell; See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.IsValid Property
Gets a value that indicates if the range contains valid row and column indices. [Visual Basic] Public ReadOnly Property IsValid As Boolean [C#] public bool IsValid {get;} [Delphi] public property IsValid: Boolean read get_IsValid; See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.LeftCol Property
Gets the index of the left column in the range. [Visual Basic] Public ReadOnly Property LeftCol As Integer

CellRange.RightCol Property 525

[C#] public int LeftCol {get;} [Delphi] public property LeftCol: Int32 read get_LeftCol; See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.RightCol Property
Gets the index of the right column in the range. [Visual Basic] Public ReadOnly Property RightCol As Integer [C#] public int RightCol {get;} [Delphi] public property RightCol: Int32 read get_RightCol; See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.Style Property
Gets or sets the style used to display every cell in the range. [Visual Basic] Public Property Style As CellStyle [C#] public CellStyle Style {get;set;} [Delphi] public property Style: CellStyle read get_Style write set_Style; Remarks Getting or setting the range style ensures that every cell in the range has the same style. Example The code below creates a CellRange structure and uses it to apply a custom style to the entire range. Visual Basic ' create a style Dim cs As CellStyle = _flex.Styles.Add("red") cs.BackColor = Color.Red ' create a cell range and assign it a style Dim rg As CellRange = _flex.GetCellRange(1, 1, 5, 5) rg.Style = cs

526 C1.Win.C1FlexGrid Namespace

C# // create a style CellStyle cs = _flex.Styles.Add("red"); cs.BackColor = Color.Red; // create a cell range and assign it a style CellRange rg = _flex.GetCellRange(1, 1, 5, 5); rg.Style = cs;

Delphi var cs := CellStyle; rg := CellRange; begin // create a style cs := _flex.Styles.Add('red'); cs.BackColor := Color.Red; // create a cell range and assign it a style rg := _flex.GetCellRange(1, 1, 5, 5); rg.Style := cs; end;

See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.StyleDisplay Property
Gets the style used to render cell ( r1, c1). [Visual Basic] Public ReadOnly Property StyleDisplay As CellStyle [C#] public CellStyle StyleDisplay {get;} [Delphi] public property StyleDisplay: CellStyle read get_StyleDisplay; Remarks This property never returns null. It will return the custom style assigned to the first cell in the range, to the cell's row, column, or a built-in style. See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.StyleNew Property
Gets or sets the style used to display every cell in the range, creating a new style if necessary. [Visual Basic] Public ReadOnly Property StyleNew As CellStyle [C#] public CellStyle StyleNew {get;}

CellRange.TopRow Property 527

[Delphi] public property StyleNew: CellStyle read get_StyleNew; Remarks This property never returns null. If the range does not have a style assigned to it, a new style will be created automatically. Example The code below creates a CellRange structure and uses it to apply a custom style to the entire range. Visual Basic ' create a cell range Dim rg As CellRange = _flex.GetCellRange(1, 1, 5, 5) ' make sure range is red rg.StyleNew.BackColor = Color.Red C# // create a cell range CellRange rg = _flex.GetCellRange(1, 1, 5, 5); // make sure range is red rg.StyleNew.BackColor = Color.Red; Delphi var rg := CellRange; begin // create a cell range rg := _flex.GetCellRange(1, 1, 5, 5); // make sure range is red rg.StyleNew.BackColor := Color.Red; end; See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.TopRow Property
Gets the index of the top row in the range. [Visual Basic] Public ReadOnly Property TopRow As Integer [C#] public int TopRow {get;} [Delphi] public property TopRow: Int32 read get_TopRow; See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.UserData Property
Gets or sets arbitrary used data assigned to cells in the range.

528 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Property UserData As Object [C#] public object UserData {get;set;} [Delphi] public property UserData: Object read get_UserData write set_UserData; Remarks When getting, this property returns the user data assigned to cell ( r1, c1). When setting, it applies the new value to all cells in the range. See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange Methods
The methods of the CellRange structure are listed here. For a complete list of CellRange structure members, see the CellRange Members topic. Clear Contains ContainsCol ContainsRow Normalize ToString See Also CellRange Structure | C1.Win.C1FlexGrid Namespace Clears selected elements from the range. Determines whether the range contains a given cell. Determines whether the range contains a given column. Determines whether the range contains a given row. Normalizes the range so that r1 is the TopRow, r2 is the BottomRow, c1 is the LeftCol, and c2 is the RightCol. Overridden. Gets a string representation for this object.

CellRange.Clear Method
Clears selected elements from the range. [Visual Basic] Public Sub Clear( _ ByVal clearFlags As ClearFlags _ ) [C#] public void Clear( ClearFlags clearFlags ); [Delphi] public procedure Clear( clearFlags: ClearFlags );

CellRange.Contains Method 529

Parameters clearFlags ClearFlags value that specifies which elements should be cleared. See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.Contains Method
Determines whether the range contains a given cell. [Visual Basic] Public Function Contains( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Boolean [C#] public bool Contains( int row, int col ); [Delphi] public function Contains( row: Int32; col: Int32 ): Boolean; Parameters row Index of the row to check. col Index of the column to check. Return Value True if the range contains the cell, False otherwise. See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.ContainsCol Method
Determines whether the range contains a given column. [Visual Basic] Public Function ContainsCol( _ ByVal col As Integer _ ) As Boolean

530 C1.Win.C1FlexGrid Namespace

[C#] public bool ContainsCol( int col ); [Delphi] public function ContainsCol( col: Int32 ): Boolean; Parameters col Index of the column to check. Return Value True if the range contains the column, False otherwise. See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.ContainsRow Method
Determines whether the range contains a given row. [Visual Basic] Public Function ContainsRow( _ ByVal row As Integer _ ) As Boolean [C#] public bool ContainsRow( int row ); [Delphi] public function ContainsRow( row: Int32 ): Boolean; Parameters row Index of the row to check. Return Value True if the range contains the row, False otherwise. See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.Normalize Method
Normalizes the range so that r1 is the TopRow, r2 is the BottomRow, c1 is the LeftCol, and c2 is the RightCol.

CellRange.ToString Method 531

[Visual Basic] Public Sub Normalize() [C#] public void Normalize() [Delphi] public procedure Normalize(); See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRange.ToString Method
Gets a string representation for this object. [Visual Basic] Overrides Public Function ToString() As String [C#] override public string ToString() [Delphi] public function ToString(): String; override; Return Value A string representation for this object. See Also CellRange Structure | CellRange Members | C1.Win.C1FlexGrid Namespace

CellRangeCollection Class
Collection of CellRange objects. For a list of all members of this type, see CellRangeCollection Members. System.Object C1.Win.C1FlexGrid.CellRangeCollection [Visual Basic] Public Class CellRangeCollection Implements IEnumerable [C#] public class CellRangeCollection : IEnumerable [Delphi] type CellRangeCollection = class (TObject, IEnumerable); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll)

532 C1.Win.C1FlexGrid Namespace

See Also CellRangeCollection Members | C1.Win.C1FlexGrid Namespace

CellRangeCollection Members
CellRangeCollection overview Public Constructors CellRangeCollection Constructor Public Properties Count Item Public Methods Add Clear Contains IndexOf Insert Remove RemoveAt See Also CellRangeCollection Class | C1.Win.C1FlexGrid Namespace Overloaded. Adds a new CellRange object to the collection. Removes all objects from the collection. Determines whether a CellRange object is a member of the collection. Overloaded. Gets the index of a CellRange object in the collection. Inserts a CellRange object in the collection at a specified index. Removes a CellRange object from the collection. Removed the object at a specified index from the collection. Gets the number of CellRange objects in the colletion. Gets or sets the CellRange object at a specified index. Initializes a new instance of a CellRangeCollection.

CellRangeCollection Constructor
Initializes a new instance of a CellRangeCollection. [Visual Basic] Public Function New( _ ByVal flexGrid As C1FlexGrid _ ) [C#] public CellRangeCollection( C1FlexGrid flexGrid ); [Delphi] public constructor Create( flexGrid: C1FlexGrid );

CellRangeCollection Properties 533

Parameters flexGrid Grid that owns the collection. See Also CellRangeCollection Class | CellRangeCollection Members | C1.Win.C1FlexGrid Namespace

CellRangeCollection Properties
The properties of the CellRangeCollection class are listed here. For a complete list of CellRangeCollection class members, see the CellRangeCollection Members topic. Public Properties Count Item See Also CellRangeCollection Class | C1.Win.C1FlexGrid Namespace Gets the number of CellRange objects in the colletion. Gets or sets the CellRange object at a specified index.

CellRangeCollection.Count Property
Gets the number of CellRange objects in the colletion. [Visual Basic] Public ReadOnly Property Count As Integer [C#] public int Count {get;} [Delphi] public property Count: Int32 read get_Count; See Also CellRangeCollection Class | CellRangeCollection Members | C1.Win.C1FlexGrid Namespace

CellRangeCollection.Item Property
Gets or sets the CellRange object at a specified index. [Visual Basic] Public Default ReadOnly Property Item( _ ByVal index As Integer _ ) As CellRange [C#] public CellRange this[ int index ] {get;} [Delphi] public property Item[ index: Int32 ]: CellRange read get_Item;

534 C1.Win.C1FlexGrid Namespace

See Also CellRangeCollection Class | CellRangeCollection Members | C1.Win.C1FlexGrid Namespace

CellRangeCollection Methods
The methods of the CellRangeCollection class are listed here. For a complete list of CellRangeCollection class members, see the CellRangeCollection Members topic. Public Methods Add Clear Contains IndexOf Insert Remove RemoveAt See Also CellRangeCollection Class | C1.Win.C1FlexGrid Namespace Overloaded. Adds a new CellRange object to the collection. Removes all objects from the collection. Determines whether a CellRange object is a member of the collection. Overloaded. Gets the index of a CellRange object in the collection. Inserts a CellRange object in the collection at a specified index. Removes a CellRange object from the collection. Removed the object at a specified index from the collection.

CellRangeCollection.Add Method
Overload List Adds a new CellRange object to the collection. [Visual Basic] Overloads Public Function Add(CellRange) As Integer [C#] public int Add(CellRange); [Delphi] public function Add(CellRange) : Int32; overload; Adds a new CellRange object to the collection, optionally removing other overlapping ranges from the collection. [Visual Basic] Overloads Public Function Add(CellRange, Boolean) As Integer [C#] public int Add(CellRange, bool); [Delphi] public function Add(CellRange; Boolean) : Int32; overload; See Also CellRangeCollection Class | CellRangeCollection Members | C1.Win.C1FlexGrid Namespace

CellRangeCollection.Add Method (CellRange)


Adds a new CellRange object to the collection.

CellRangeCollection.Add Method 535

[Visual Basic] Overloads Public Function Add( _ ByVal value As CellRange _ ) As Integer [C#] public int Add( CellRange value ); [Delphi] public function Add( value: CellRange ): Int32; overload; Parameters value Object to add to the collection. Return Value The index of the object in the collection. See Also CellRangeCollection Class | CellRangeCollection Members | C1.Win.C1FlexGrid Namespace | CellRangeCollection.Add Overload List

CellRangeCollection.Add Method (CellRange, Boolean)


Adds a new CellRange object to the collection, optionally removing other overlapping ranges from the collection. [Visual Basic] Overloads Public Function Add( _ ByVal value As CellRange, _ ByVal clearOverlappingRanges As Boolean _ ) As Integer [C#] public int Add( CellRange value, bool clearOverlappingRanges ); [Delphi] public function Add( value: CellRange; clearOverlappingRanges: Boolean ): Int32; overload; Parameters value Object to add to the collection.

536 C1.Win.C1FlexGrid Namespace

clearOverlappingRanges Whether to remove overlapping ranges from the collection before adding the new range. Return Value The index of the object in the collection. See Also CellRangeCollection Class | CellRangeCollection Members | C1.Win.C1FlexGrid Namespace | CellRangeCollection.Add Overload List

CellRangeCollection.Clear Method
Removes all objects from the collection. [Visual Basic] Public Sub Clear() [C#] public void Clear() [Delphi] public procedure Clear(); See Also CellRangeCollection Class | CellRangeCollection Members | C1.Win.C1FlexGrid Namespace

CellRangeCollection.Contains Method
Determines whether a CellRange object is a member of the collection. [Visual Basic] Public Function Contains( _ ByVal item As CellRange _ ) As Boolean [C#] public bool Contains( CellRange item ); [Delphi] public function Contains( item: CellRange ): Boolean; Parameters item Object to locate in the collection. Return Value True if the object is a memer of the collection, false otherwise. See Also CellRangeCollection Class | CellRangeCollection Members | C1.Win.C1FlexGrid Namespace

CellRangeCollection.IndexOf Method 537

CellRangeCollection.IndexOf Method
Overload List Gets the index of a CellRange object in the collection. [Visual Basic] Overloads Public Function IndexOf(CellRange) As Integer [C#] public int IndexOf(CellRange); [Delphi] public function IndexOf(CellRange) : Int32; overload; Gets the index of the first CellRange object in the collection that contains the specified row and column. [Visual Basic] Overloads Public Function IndexOf(Integer, Integer) As Integer [C#] public int IndexOf(int, int); [Delphi] public function IndexOf(Int32; Int32) : Int32; overload; See Also CellRangeCollection Class | CellRangeCollection Members | C1.Win.C1FlexGrid Namespace

CellRangeCollection.IndexOf Method (CellRange)


Gets the index of a CellRange object in the collection. [Visual Basic] Overloads Public Function IndexOf( _ ByVal item As CellRange _ ) As Integer [C#] public int IndexOf( CellRange item ); [Delphi] public function IndexOf( item: CellRange ): Int32; overload; Parameters item Object to locate in the collection. Return Value The index of the object in the collection, or -1 if the object is not a member of the collection. See Also CellRangeCollection Class | CellRangeCollection Members | C1.Win.C1FlexGrid Namespace | CellRangeCollection.IndexOf Overload List

CellRangeCollection.IndexOf Method (Int32, Int32)


Gets the index of the first CellRange object in the collection that contains the specified row and column.

538 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overloads Public Function IndexOf( _ ByVal row As Integer, _ ByVal col As Integer _ ) As Integer [C#] public int IndexOf( int row, int col ); [Delphi] public function IndexOf( row: Int32; col: Int32 ): Int32; overload; Parameters row Index of the row contained in the range. col Index of the column contained in the range. Return Value The index of the object in the collection, or -1 if no range could be found containing the specified row and column. See Also CellRangeCollection Class | CellRangeCollection Members | C1.Win.C1FlexGrid Namespace | CellRangeCollection.IndexOf Overload List

CellRangeCollection.Insert Method
Inserts a CellRange object in the collection at a specified index. [Visual Basic] Public Sub Insert( _ ByVal index As Integer, _ ByVal value As CellRange _ ) [C#] public void Insert( int index, CellRange value ); [Delphi] public procedure Insert( index: Int32; value: CellRange );

CellRangeCollection.Remove Method 539

Parameters index value See Also CellRangeCollection Class | CellRangeCollection Members | C1.Win.C1FlexGrid Namespace

CellRangeCollection.Remove Method
Removes a CellRange object from the collection. [Visual Basic] Public Sub Remove( _ ByVal obj As CellRange _ ) [C#] public void Remove( CellRange obj ); [Delphi] public procedure Remove( obj: CellRange ); Parameters obj Object to remove from the collection. See Also CellRangeCollection Class | CellRangeCollection Members | C1.Win.C1FlexGrid Namespace

CellRangeCollection.RemoveAt Method
Removed the object at a specified index from the collection. [Visual Basic] Public Sub RemoveAt( _ ByVal index As Integer _ ) [C#] public void RemoveAt( int index ); [Delphi] public procedure RemoveAt( index: Int32 );

540 C1.Win.C1FlexGrid Namespace

Parameters index Index of the object to remove from the collection. See Also CellRangeCollection Class | CellRangeCollection Members | C1.Win.C1FlexGrid Namespace

CellStyle Class
The CellStyle class encapsulates properties that control the appearance of grid cells. This information includes the background and foreground colors, font, text and image alignment, and so on. For a list of all members of this type, see CellStyle Members. System.Object C1.Win.C1FlexGrid.CellStyle [Visual Basic] Public Class CellStyle [C#] public class CellStyle [Delphi] type CellStyle = class; Remarks The C1FlexGridBase.Styles property exposes a collection of grid styles, and has methods for creating and removing styles from the grid. You can create and define styles at design time, but right-clicking the grid and selecting the "Edit Styles" menu option. Styles follow a hierarchical model similar to styles in Microsoft Word or in cascading style sheets. Every property in a CellStyle object may be left unassigned, in which case the value is inherited from a parent style. The parent style is usually the built-in CellStyleCollection.Normal style. To determine which elements are defined in a particular style, use the DefinedElements property. When you modify the properties of a CellStyle object, all cells that use that style are automatically repainted to reflect the changes. Styles may be assigned to CellRange, Row, and Column objects, as shown in the example below. Example The example below creates three CellStyle objects and assigns them to grid rows, columns, and cell ranges. Visual Basic ' create style with red background Dim cs As CellStyle = _flex.Styles.Add("red") Style.BackColor = Color.Red ' create style with green background cs = _flex.Styles.Add("green") Style.BackColor = Color.Green

CellStyle Class 541

' create style with bold font cs = _flex.Styles.Add("bold") Style.Font = New Font("Tahoma", 8, FontStyle.Bold) ' assign red style to a column _flex.Cols(3).Style = _flex.Styles("red") ' assign green style to a row _flex.Rows(3).Style = _flex.Styles("green") ' assign bold style to a cell range Dim rg As CellRange = _flex.GetCellRange(2,2,4,4) rg.Style = _flex.Styles("bold") C# // create style with red background CellStyle cs = _flex.Styles.Add("red"); Style.BackColor = Color.Red; // create style with green background cs = _flex.Styles.Add("green"); Style.BackColor = Color.Green; // create style with bold font cs = _flex.Styles.Add("bold"); Style.Font = new Font("Tahoma", 8, FontStyle.Bold); // assign red style to a column _flex.Cols[3].Style = _flex.Styles["red"]; // assign green style to a row _flex.Rows[3].Style = _flex.Styles["green"]; // assign bold style to a cell range CellRange rg = _flex.GetCellRange(2, 2, 4, 4); rg.Style = _flex.Styles["bold"]; Delphi var cs := CellStyle; rg := CellRange; begin // create style with red background cs := _flex.Styles.Add('red'); Style.BackColor := Color.Red; // create style with green background cs := _flex.Styles.Add('green'); Style.BackColor := Color.Green; // create style with bold font cs := _flex.Styles.Add('bold'); Style.Font := Font.Create('Tahoma', 8, FontStyle.Bold); // assign red style to a column _flex.Cols[3].Style := _flex.Styles['red'];

542 C1.Win.C1FlexGrid Namespace

// assign green style to a column _flex.Rows[3].Style := _flex.Styles['green']; // assign bold style to a cell range rg := _flex.GetCellRange(2, 2, 4, 4); rg.Style := _flex.Styles['bold']; end; After running this code, the third column of the grid will be painted with a red background. The third row will be painted with a green background. The cell at the intersection will be painted in red, because column styles have priority over row styles. The remaining style elements for these cells (font, alignment, and so on) are not defined in the new styles and are automatically inherited from the parent style (CellStyleCollection.Normal). The cells around the intersection will have a bold font. The style that defines the bold font does not specify a background color, so that element is inherited from the parent style, which may be the "red", "green", or "normal" styles. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle Members
CellStyle overview Public Properties BackColor BackgroundImage BackgroundImageLayout Border ComboList DataMap DataType DefinedElements Display EditMask Editor Font ForeColor Format ImageAlign ImageMap Gets or sets the color used to paint the cell background. Gets or sets the style's background image. Gets or sets the a value that determines how the style will scale and position background image. Gets the CellBorder object associated with this style. Gets or sets a pipe-delimited list of valid values. Gets or sets an Collections.IDictionary used to associate cell values with display values. Gets or sets the data type for the style. Gets or sets which elements are defined in this style. Gets or sets whether to show images, text, or both. Gets or sets the mask string used to edit values. Gets or sets the custom editor used to edit cells that have this style. Gets or sets the font used to paint text in the cell. Gets or sets the color of the text in the cell. Gets or sets the format string used to display values. Gets or sets the image alignment. Gets or sets an Collections.IDictionary used to associate cell values with images.

CellStyle Properties 543

ImageSpacing Margins Name TextAlign TextDirection TextEffect Trimming UserData WordWrap Public Methods BuildString Clear Equals GetHashCode

Gets or sets the space between images and text in a cell, in pixels. Gets or sets the margins between the edges of the cell and its contents, in pixels. Gets or sets the style name. Gets or sets the text alignment. Gets or sets the text direction. Gets or sets the 3D effect used to paint text. Gets or sets how long strings are trimmed to fit the cell. Gets or sets arbitrary user data associated with this style. Gets or sets whether strings should automatically wrap within the cell. Overloaded. Returns a compact string representation of this CellStyle. Overloaded. Clears all elements in this style. Overridden. Determines whether two CellStyle objects are equal. Overridden. Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table. Copies all elements defined in a source style to this style. Rebuilds this style based on a description contained in a string. Overloaded. Renders a string and an image into a Drawing.Graphics object using this style.

MergeWith ParseString Render See Also CellStyle Class | C1.Win.C1FlexGrid Namespace

CellStyle Properties
The properties of the CellStyle class are listed here. For a complete list of CellStyle class members, see the CellStyle Members topic. Public Properties BackColor BackgroundImage BackgroundImageLayout Border ComboList Gets or sets the color used to paint the cell background. Gets or sets the style's background image. Gets or sets the a value that determines how the style will scale and position background image. Gets the CellBorder object associated with this style. Gets or sets a pipe-delimited list of valid values.

544 C1.Win.C1FlexGrid Namespace

DataMap DataType DefinedElements Display EditMask Editor Font ForeColor Format ImageAlign ImageMap ImageSpacing Margins Name TextAlign TextDirection TextEffect Trimming UserData WordWrap See Also CellStyle Class | C1.Win.C1FlexGrid Namespace

Gets or sets an Collections.IDictionary used to associate cell values with display values. Gets or sets the data type for the style. Gets or sets which elements are defined in this style. Gets or sets whether to show images, text, or both. Gets or sets the mask string used to edit values. Gets or sets the custom editor used to edit cells that have this style. Gets or sets the font used to paint text in the cell. Gets or sets the color of the text in the cell. Gets or sets the format string used to display values. Gets or sets the image alignment. Gets or sets an Collections.IDictionary used to associate cell values with images. Gets or sets the space between images and text in a cell, in pixels. Gets or sets the margins between the edges of the cell and its contents, in pixels. Gets or sets the style name. Gets or sets the text alignment. Gets or sets the text direction. Gets or sets the 3D effect used to paint text. Gets or sets how long strings are trimmed to fit the cell. Gets or sets arbitrary user data associated with this style. Gets or sets whether strings should automatically wrap within the cell.

CellStyle.BackColor Property
Gets or sets the color used to paint the cell background. [Visual Basic] Public Property BackColor As Color [C#] public Color BackColor {get;set;} [Delphi] public property BackColor: Color read get_BackColor write set_BackColor;

CellStyle.BackgroundImage Property 545

See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.BackgroundImage Property
Gets or sets the style's background image. [Visual Basic] Public Property BackgroundImage As Image [C#] public Image BackgroundImage {get;set;} [Delphi] public property BackgroundImage: Image read get_BackgroundImage write set_BackgroundImage; Remarks This property works with BackgroundImageLayout to determine whether and how background images are rendered in cells. See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.BackgroundImageLayout Property
Gets or sets the a value that determines how the style will scale and position background image. [Visual Basic] Public Property BackgroundImageLayout As ImageAlignEnum [C#] public ImageAlignEnum BackgroundImageLayout {get;set;} [Delphi] public property BackgroundImageLayout: ImageAlignEnum read get_BackgroundImageLayout write set_BackgroundImageLayout; Remarks This property works with BackgroundImage to determine whether and how background images are rendered in cells. See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.Border Property
Gets the CellBorder object associated with this style. [Visual Basic] Public ReadOnly Property Border As CellBorder [C#] public CellBorder Border {get;}

546 C1.Win.C1FlexGrid Namespace

[Delphi] public property Border: CellBorder read get_Border; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.ComboList Property
Gets or sets a pipe-delimited list of valid values. [Visual Basic] Public Property ComboList As String [C#] public string ComboList {get;set;} [Delphi] public property ComboList: String read get_ComboList write set_ComboList; Remarks If the cell is editable, this list of values is used to populate the drop-down Windows.Forms.ComboBox used to edit the cell. If the list starts with a pipe character, then the list is not exclusive and the user may type values that are not on the list. If the list contains three periods ("..."), then a button is displayed in the cell. When the user presses the button, the grid fires the C1FlexGridBase.CellButtonClick event. If the list contains a pipe followed by three periods ("|..."), then a button is displayed in the cell as before, and the user may also type into the cell. See also the DataMap property for an alternate way of specifying valid values for a cell. See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.DataMap Property
Gets or sets an Collections.IDictionary used to associate cell values with display values. [Visual Basic] Public Property DataMap As IDictionary [C#] public IDictionary DataMap {get;set;} [Delphi] public property DataMap: IDictionary read get_DataMap write set_DataMap; Remarks If the cell is editable, this list of values is used to populate the drop-down Windows.Forms.ComboBox used to edit the cell. In this case, the order of the items in the combo list is determined by the order of the elements in the dictionary.

CellStyle.DataType Property 547

The most common dictionary class, Collections.Hashtable, uses arbitrary order. If you want control over the item order, use a different dictionary class such as Collections.Specialized.ListDictionary. The C1FlexGrid assembly also includes a MultiColumnDictionary class, which can be used to create multicolumn and data-bound dictionaries. See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.DataType Property
Gets or sets the data type for the style. [Visual Basic] Public Property DataType As Type [C#] public Type DataType {get;set;} [Delphi] public property DataType: Type read get_DataType write set_DataType; Remarks When the grid is bound to a data source, this property is set automatically based on the data schema. This property is used to coerce values assigned to cells into the proper type. See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.DefinedElements Property
Gets or sets which elements are defined in this style. [Visual Basic] Public Property DefinedElements As StyleElementFlags [C#] public StyleElementFlags DefinedElements {get;set;} [Delphi] public property DefinedElements: StyleElementFlags read get_DefinedElements write set_DefinedElements; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.Display Property
Gets or sets whether to show images, text, or both. [Visual Basic] Public Property Display As DisplayEnum [C#] public DisplayEnum Display {get;set;}

548 C1.Win.C1FlexGrid Namespace

[Delphi] public property Display: DisplayEnum read get_Display write set_Display; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.EditMask Property
Gets or sets the mask string used to edit values. [Visual Basic] Public Property EditMask As String [C#] public string EditMask {get;set;} [Delphi] public property EditMask: String read get_EditMask write set_EditMask; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.Editor Property
Gets or sets the custom editor used to edit cells that have this style. [Visual Basic] Public Property Editor As Control [C#] public Control Editor {get;set;} [Delphi] public property Editor: Control read get_Editor write set_Editor; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.Font Property
Gets or sets the font used to paint text in the cell. [Visual Basic] Public Property Font As Font [C#] public Font Font {get;set;} [Delphi] public property Font: Font read get_Font write set_Font; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.ForeColor Property 549

CellStyle.ForeColor Property
Gets or sets the color of the text in the cell. [Visual Basic] Public Property ForeColor As Color [C#] public Color ForeColor {get;set;} [Delphi] public property ForeColor: Color read get_ForeColor write set_ForeColor; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.Format Property
Gets or sets the format string used to display values. [Visual Basic] Public Property Format As String [C#] public string Format {get;set;} [Delphi] public property Format: String read get_Format write set_Format; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.ImageAlign Property
Gets or sets the image alignment. [Visual Basic] Public Property ImageAlign As ImageAlignEnum [C#] public ImageAlignEnum ImageAlign {get;set;} [Delphi] public property ImageAlign: ImageAlignEnum read get_ImageAlign write set_ImageAlign; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.ImageMap Property
Gets or sets an Collections.IDictionary used to associate cell values with images.

550 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Property ImageMap As IDictionary [C#] public IDictionary ImageMap {get;set;} [Delphi] public property ImageMap: IDictionary read get_ImageMap write set_ImageMap; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.ImageSpacing Property
Gets or sets the space between images and text in a cell, in pixels. [Visual Basic] Public Property ImageSpacing As Integer [C#] public int ImageSpacing {get;set;} [Delphi] public property ImageSpacing: Int32 read get_ImageSpacing write set_ImageSpacing; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.Margins Property
Gets or sets the margins between the edges of the cell and its contents, in pixels. [Visual Basic] Public Property Margins As Margins [C#] public Margins Margins {get;set;} [Delphi] public property Margins: Margins read get_Margins write set_Margins; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.Name Property
Gets or sets the style name. [Visual Basic] Public Property Name As String

CellStyle.TextAlign Property 551

[C#] public string Name {get;set;} [Delphi] public property Name: String read get_Name write set_Name; Remarks Style names must be unique. Setting a style name to the name of an already existing style will throw an exception. Style names must have one or more characters and may not include curly braces ('{' and '}'). See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.TextAlign Property
Gets or sets the text alignment. [Visual Basic] Public Property TextAlign As TextAlignEnum [C#] public TextAlignEnum TextAlign {get;set;} [Delphi] public property TextAlign: TextAlignEnum read get_TextAlign write set_TextAlign; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.TextDirection Property
Gets or sets the text direction. [Visual Basic] Public Property TextDirection As TextDirectionEnum [C#] public TextDirectionEnum TextDirection {get;set;} [Delphi] public property TextDirection: TextDirectionEnum read get_TextDirection write set_TextDirection; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.TextEffect Property
Gets or sets the 3D effect used to paint text.

552 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Property TextEffect As TextEffectEnum [C#] public TextEffectEnum TextEffect {get;set;} [Delphi] public property TextEffect: TextEffectEnum read get_TextEffect write set_TextEffect; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.Trimming Property
Gets or sets how long strings are trimmed to fit the cell. [Visual Basic] Public Property Trimming As StringTrimming [C#] public StringTrimming Trimming {get;set;} [Delphi] public property Trimming: StringTrimming read get_Trimming write set_Trimming; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.UserData Property
Gets or sets arbitrary user data associated with this style. [Visual Basic] Public Property UserData As Object [C#] public object UserData {get;set;} [Delphi] public property UserData: Object read get_UserData write set_UserData; Remarks This data is not used by the control, and can be used to store any data that is useful to the application. See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.WordWrap Property
Gets or sets whether strings should automatically wrap within the cell.

CellStyle Methods 553

[Visual Basic] Public Property WordWrap As Boolean [C#] public bool WordWrap {get;set;} [Delphi] public property WordWrap: Boolean read get_WordWrap write set_WordWrap; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle Methods
The methods of the CellStyle class are listed here. For a complete list of CellStyle class members, see the CellStyle Members topic. Public Methods BuildString Clear Equals GetHashCode Overloaded. Returns a compact string representation of this CellStyle. Overloaded. Clears all elements in this style. Overridden. Determines whether two CellStyle objects are equal. Overridden. Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table. Copies all elements defined in a source style to this style. Rebuilds this style based on a description contained in a string. Overloaded. Renders a string and an image into a Drawing.Graphics object using this style.

MergeWith ParseString Render See Also CellStyle Class | C1.Win.C1FlexGrid Namespace

CellStyle.BuildString Method
Overload List Returns a compact string representation of this CellStyle. [Visual Basic] Overloads Public Function BuildString() As String [C#] public string BuildString(); [Delphi] public function BuildString() : String; overload; Returns a string representation of this CellStyle. [Visual Basic] Overloads Public Function BuildString(StyleElementFlags) As String [C#] public string BuildString(StyleElementFlags); [Delphi] public function BuildString(StyleElementFlags) : String; overload;

554 C1.Win.C1FlexGrid Namespace

See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.BuildString Method ()
Returns a compact string representation of this CellStyle. [Visual Basic] Overloads Public Function BuildString() As String [C#] public string BuildString() [Delphi] public function BuildString(): String; overload; Return Value A string containing the settings of all style elements defined in this CellStyle. Remarks This method is used to persist grid styles and can be used to define and save 'skins'. See the CellStyleCollection.BuildString and CellStyleCollection.ParseString methods. The string returned contains definitions only for the style elements that are defined by this CellStyle. Elements inherited from other styles are not included. To build a string containing specific elements, use the BuildString method instead. Example The code below creates a style with a custom font and background color and builds a string that represents the new style. Then it uses the string to initialize a second style. Visual Basic ' create style with custom font and backcolor Dim cs As CellStyle = _flex.Styles.Add("s1") cs.Font = New Font("Arial", 12, FontStyle.Bold) cs.BackColor = Color.Beige ' save style definition into a string Dim styleDef As String = cs.BuildString ' use string to initialize another style Dim csNew As CellStyle = _flex.Styles.Add("s2") csNew.ParseString(styleDef) ' compare styles Debug.Assert(csNew.Font.Equals(cs.Font)) Debug.Assert(csNew.BackColor.Equals(cs.BackColor)) C# // create style with custom font and backcolor CellStyle cs = _flex.Styles.Add("s1"); cs.Font = new Font("Arial", 12, FontStyle.Bold); cs.BackColor = Color.Beige; // save style definition into a string string styleDef = cs.BuildString();

CellStyle.BuildString Method 555

// use string to initialize another style CellStyle csNew = _flex.Styles.Add("s2"); csNew.ParseString(styleDef); // compare styles Debug.Assert(csNew.Font.Equals(cs.Font)); Debug.Assert(csNew.BackColor.Equals(cs.BackColor)); Delphi var cs : CellStyle; // create style with custom font and backcolor cs := _flex.Styles.Add('s1'); cs.Font := Font.Create('Arial', 12, FontStyle.Bold); cs.BackColor := Color.Beige; // save style definition into a string styleDef := cs.BuildString; // use string to initialize another style csNew := _flex.Styles.Add('s2'); csNew.ParseString(styleDef); // compare styles Debug.Assert(csNew.Font.Equals(cs.Font)); Debug.Assert(csNew.BackColor.Equals(cs.BackColor)); See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace | CellStyle.BuildString Overload List

CellStyle.BuildString Method (StyleElementFlags)


Returns a string representation of this CellStyle. [Visual Basic] Overloads Public Function BuildString( _ ByVal elements As StyleElementFlags _ ) As String [C#] public string BuildString( StyleElementFlags elements ); [Delphi] public function BuildString( elements: StyleElementFlags ): String; overload; Parameters elements StyleElementFlags that specifies which style elements should be included in the string. Return Value A string containing the settings of the specified style elements.

556 C1.Win.C1FlexGrid Namespace

Remarks This method is used to persist grid styles and can be used to define and save 'skins'. See the CellStyleCollection.BuildString and CellStyleCollection.ParseString methods. Example The code below shows the effect of specifying different values for the elements parameter. It builds one compact string containing only the elements actually defined in a style, and another including all style elements. Visual Basic ' build compact and a long style defintion strings Dim s1 As String = _flex.Styles.Fixed.BuildString Dim s2 As String = _flex.Styles.Fixed.BuildString(StyleElementFlags.All) ' show both style defintions Console.WriteLine("{0}: {1}", s1.Length, s1) Console.WriteLine("{0}: {1}", s2.Length, s2) C# // build compact and a long style definition strings string s1 = _flex.Styles.Fixed.BuildString(); string s2 = _flex.Styles.Fixed.BuildString(StyleElementFlags.All); // show both style definitions Console.WriteLine("{0}: {1}", s1.Length, s1); Console.WriteLine("{0}: {1}", s2.Length, s2); Delphi var s1, s2: String; // build compact and a long style definition strings s1 := _flex.Styles.Fixed.BuildString; s2 := _flex.Styles.Fixed.BuildString(StyleElementFlags.All); // show both style defintions Console.WriteLine('{0}: {1}', s1.Length, s1); Console.WriteLine('{0}: {1}', s2.Length, s2); See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace | CellStyle.BuildString Overload List

CellStyle.Clear Method
Overload List Clears all elements in this style. [Visual Basic] Overloads Public Sub Clear() [C#] public void Clear(); [Delphi] public procedure Clear(); overload; Clears selected elements from this style. [Visual Basic] Overloads Public Sub Clear(StyleElementFlags) [C#] public void Clear(StyleElementFlags); [Delphi] public procedure Clear(StyleElementFlags); overload;

CellStyle.Equals Method 557

See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.Clear Method ()
Clears all elements in this style. [Visual Basic] Overloads Public Sub Clear() [C#] public void Clear() [Delphi] public procedure Clear(); overload; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace | CellStyle.Clear Overload List

CellStyle.Clear Method (StyleElementFlags)


Clears selected elements from this style. [Visual Basic] Overloads Public Sub Clear( _ ByVal flags As StyleElementFlags _ ) [C#] public void Clear( StyleElementFlags flags ); [Delphi] public procedure Clear( flags: StyleElementFlags ); overload; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace | CellStyle.Clear Overload List

CellStyle.Equals Method
Determines whether two CellStyle objects are equal. [Visual Basic] Overrides Public Function Equals( _ ByVal o As Object _ ) As Boolean [C#] override public bool Equals( object o );

558 C1.Win.C1FlexGrid Namespace

[Delphi] public function Equals( o: Object ): Boolean; override; Parameters o Style to compare with this style. Return Value True if the two styles are equal; otherwise, False. See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.GetHashCode Method
Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table. [Visual Basic] Overrides Public Function GetHashCode() As Integer [C#] override public int GetHashCode() [Delphi] public function GetHashCode(): Int32; override; Return Value A hash code for the style instance. See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.MergeWith Method
Copies all elements defined in a source style to this style. [Visual Basic] Public Sub MergeWith( _ ByVal sourceStyle As CellStyle _ ) [C#] public void MergeWith( CellStyle sourceStyle ); [Delphi] public procedure MergeWith( sourceStyle: CellStyle );

CellStyle.ParseString Method 559

Remarks Style elements not present in the source style are preserved. See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.ParseString Method
Rebuilds this style based on a description contained in a string. [Visual Basic] Public Function ParseString( _ ByVal str As String _ ) As Boolean [C#] public bool ParseString( string str ); [Delphi] public function ParseString( str: String ): Boolean; Return Value True if the string was successfully parsed, false otherwise. Remarks This method is used to persist grid styles and can be used to define and save 'skins'. See the CellStyleCollection.BuildString and CellStyleCollection.ParseString methods. See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.Render Method
Overload List Renders a string and an image into a Drawing.Graphics object using this style. [Visual Basic] Overloads Public Sub Render(Graphics, Rectangle, Image) [C#] public void Render(Graphics, Rectangle, Image); [Delphi] public procedure Render(Graphics; Rectangle; Image); overload; Renders a string and an image into a Drawing.Graphics object using this style. [Visual Basic] Overloads Public Sub Render(Graphics, Rectangle, String) [C#] public void Render(Graphics, Rectangle, string); [Delphi] public procedure Render(Graphics; Rectangle; String); overload; Renders a string and an image into a Drawing.Graphics object using this style. [Visual Basic] Overloads Public Sub Render(Graphics, Rectangle, String, Image) [C#] public void Render(Graphics, Rectangle, string, Image);

560 C1.Win.C1FlexGrid Namespace

[Delphi] public procedure Render(Graphics; Rectangle; String; Image); overload; Renders a string and an image into a Drawing.Graphics object using this style. [Visual Basic] Overloads Public Sub Render(Graphics, Rectangle, String, Image, DrawCellFlags) [C#] public void Render(Graphics, Rectangle, string, Image, DrawCellFlags); [Delphi] public procedure Render(Graphics; Rectangle; String; Image; DrawCellFlags); overload; See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace

CellStyle.Render Method (Graphics, Rectangle, Image)


Renders a string and an image into a Drawing.Graphics object using this style. [Visual Basic] Overloads Public Sub Render( _ ByVal g As Graphics, _ ByVal rc As Rectangle, _ ByVal img As Image _ ) [C#] public void Render( Graphics g, Rectangle rc, Image img ); [Delphi] public procedure Render( g: Graphics; rc: Rectangle; img: Image ); overload; Parameters g Drawing.Graphics object to render into. rc Area where the element will be displayed. img Image to render. See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace | CellStyle.Render Overload List

CellStyle.Render Method (Graphics, Rectangle, String)


Renders a string and an image into a Drawing.Graphics object using this style.

CellStyle.Render Method 561

[Visual Basic] Overloads Public Sub Render( _ ByVal g As Graphics, _ ByVal rc As Rectangle, _ ByVal str As String _ ) [C#] public void Render( Graphics g, Rectangle rc, string str ); [Delphi] public procedure Render( g: Graphics; rc: Rectangle; str: String ); overload; Parameters g Drawing.Graphics object to render into. rc Area where the element will be displayed. str Text to render. See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace | CellStyle.Render Overload List

CellStyle.Render Method (Graphics, Rectangle, String, Image)


Renders a string and an image into a Drawing.Graphics object using this style. [Visual Basic] Overloads Public Sub Render( _ ByVal g As Graphics, _ ByVal rc As Rectangle, _ ByVal str As String, _ ByVal img As Image _ ) [C#] public void Render( Graphics g, Rectangle rc, string str, Image img );

562 C1.Win.C1FlexGrid Namespace

[Delphi] public procedure Render( g: Graphics; rc: Rectangle; str: String; img: Image ); overload; Parameters g Drawing.Graphics object to render into. rc Area where the element will be displayed. str Text to render. img Image to render. See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace | CellStyle.Render Overload List

CellStyle.Render Method (Graphics, Rectangle, String, Image, DrawCellFlags)


Renders a string and an image into a Drawing.Graphics object using this style. [Visual Basic] Overloads Public Sub Render( _ ByVal g As Graphics, _ ByVal rc As Rectangle, _ ByVal str As String, _ ByVal img As Image, _ ByVal flags As DrawCellFlags _ ) [C#] public void Render( Graphics g, Rectangle rc, string str, Image img, DrawCellFlags flags ); [Delphi] public procedure Render( g: Graphics; rc: Rectangle; str: String; img: Image; flags: DrawCellFlags ); overload;

CellStyleCollection Class 563

Parameters g Drawing.Graphics object to render into. rc Area where the element will be displayed. str Text to render. img Image to render. flags Combination of DrawCellFlags that determines which elements will be rendered. Remarks This method allows using CellStyle objects to render objects outside the grid. It can be useful when implementing owner-drawn applications and style editors for example. See Also CellStyle Class | CellStyle Members | C1.Win.C1FlexGrid Namespace | CellStyle.Render Overload List

CellStyleCollection Class
Collection of CellStyle objects defined for a grid. For a list of all members of this type, see CellStyleCollection Members. System.Object C1.Win.C1FlexGrid.CellStyleCollection [Visual Basic] Public Class CellStyleCollection Implements ICollection, IEnumerable [C#] public class CellStyleCollection : ICollection, IEnumerable [Delphi] type CellStyleCollection = class (TObject, ICollection, IEnumerable); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection Members
CellStyleCollection overview

564 C1.Win.C1FlexGrid Namespace

Public Properties Alternate Count Editor EmptyArea Fixed Focus Frozen Highlight Item NewRow Normal Search SelectedColumnHeader SelectedRowHeader Public Methods Add BuildString Clear ClearUnused Contains IndexOf ParseString Remove See Also CellStyleCollection Class | C1.Win.C1FlexGrid Namespace Overloaded. Adds a new empty CellStyle object to the collection. Builds and returns a compact string representation of the style collection. Clear all styles (even those in use) and reset the built-in styles. Clear all unused styles. Checks whether the collection contains a given style. Gets the index of a style in the collection. Parses a string containing style definitions. Overloaded. Removes a custom style from the collection. Gets the style used to paint scrollable cells in alternate rows. Gets the number of CellStyle objects in the collection. Gets the style used to paint the cell being edited. Gets the style used to paint the area of the grid below and to the right of all the cells. Gets the style used to paint fixed cells. Gets the style used to paint the current cell when the control has focus. Gets the style used to paint frozen cells (frozen cells are editable and selectable, but not scrollable). Gets the style used to paint highlighted selected cells. Overloaded. Gets a built-in CellStyle by style type. Gets the style used to paint cells in the new row template at the bottom of the grid. Gets the default style used to paint scrollable cells. Gets the style used to paint the cell selected while autosearching. Gets the style used to paint selected column headers. Gets the style used to paint selected column headers.

CellStyleCollection Properties
The properties of the CellStyleCollection class are listed here. For a complete list of CellStyleCollection class members, see the CellStyleCollection Members topic.

CellStyleCollection.Alternate Property 565

Public Properties Alternate Count Editor EmptyArea Fixed Focus Frozen Highlight Item NewRow Normal Search SelectedColumnHeader SelectedRowHeader See Also CellStyleCollection Class | C1.Win.C1FlexGrid Namespace Gets the style used to paint scrollable cells in alternate rows. Gets the number of CellStyle objects in the collection. Gets the style used to paint the cell being edited. Gets the style used to paint the area of the grid below and to the right of all the cells. Gets the style used to paint fixed cells. Gets the style used to paint the current cell when the control has focus. Gets the style used to paint frozen cells (frozen cells are editable and selectable, but not scrollable). Gets the style used to paint highlighted selected cells. Overloaded. Gets a built-in CellStyle by style type. Gets the style used to paint cells in the new row template at the bottom of the grid. Gets the default style used to paint scrollable cells. Gets the style used to paint the cell selected while autosearching. Gets the style used to paint selected column headers. Gets the style used to paint selected column headers.

CellStyleCollection.Alternate Property
Gets the style used to paint scrollable cells in alternate rows. [Visual Basic] Public ReadOnly Property Alternate As CellStyle [C#] public CellStyle Alternate {get;} [Delphi] public property Alternate: CellStyle read get_Alternate; Remarks This style is empty by default, so all scrollable cells are rendered using the Normal style. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Count Property
Gets the number of CellStyle objects in the collection.

566 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overridable Public ReadOnly Property Count As Integer Implements ICollection.Count [C#] virtual public int Count {get;} [Delphi] public property Count: Int32 read get_Count; Implements ICollection.Count See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Editor Property
Gets the style used to paint the cell being edited. [Visual Basic] Public ReadOnly Property Editor As CellStyle [C#] public CellStyle Editor {get;} [Delphi] public property Editor: CellStyle read get_Editor; Remarks This style is empty by default, so cells being edited are rendered using the Focus style. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.EmptyArea Property
Gets the style used to paint the area of the grid below and to the right of all the cells. [Visual Basic] Public ReadOnly Property EmptyArea As CellStyle [C#] public CellStyle EmptyArea {get;} [Delphi] public property EmptyArea: CellStyle read get_EmptyArea; See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Fixed Property
Gets the style used to paint fixed cells.

CellStyleCollection.Focus Property 567

[Visual Basic] Public ReadOnly Property Fixed As CellStyle [C#] public CellStyle Fixed {get;} [Delphi] public property Fixed: CellStyle read get_Fixed; See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Focus Property
Gets the style used to paint the current cell when the control has focus. [Visual Basic] Public ReadOnly Property Focus As CellStyle [C#] public CellStyle Focus {get;} [Delphi] public property Focus: CellStyle read get_Focus; Remarks This style is empty by default, so focused cells are rendered using the Normal style. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Frozen Property
Gets the style used to paint frozen cells (frozen cells are editable and selectable, but not scrollable). [Visual Basic] Public ReadOnly Property Frozen As CellStyle [C#] public CellStyle Frozen {get;} [Delphi] public property Frozen: CellStyle read get_Frozen; See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Highlight Property
Gets the style used to paint highlighted selected cells. [Visual Basic] Public ReadOnly Property Highlight As CellStyle

568 C1.Win.C1FlexGrid Namespace

[C#] public CellStyle Highlight {get;} [Delphi] public property Highlight: CellStyle read get_Highlight; Remarks Use the C1FlexGridBase.HighLight property to determine whether cells should be highlighted when the control does not have the focus. Use the C1FlexGridBase.SelectionMode property to determine what types of selection are allowed. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Item Property
Overload List Gets a built-in CellStyle by style type. [Visual Basic] Overloads Public Default ReadOnly Property Item(CellStyleEnum) As CellStyle [C#] public CellStyle this[CellStyleEnum]{get;} [Delphi] public property Item[index: CellStyleEnum]: CellStyle read get_Item; Gets a CellStyle by index. [Visual Basic] Overloads Public Default ReadOnly Property Item(Integer) As CellStyle [C#] public CellStyle this[int]{get;} [Delphi] public property Item[index: Int32]: CellStyle read get_Item; Gets a CellStyle by name. [Visual Basic] Overloads Public Default ReadOnly Property Item(String) As CellStyle [C#] public CellStyle this[string]{get;} [Delphi] public property Item[name: String]: CellStyle read get_Item; See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Item Property (CellStyleEnum)


Gets a built-in CellStyle by style type. [Visual Basic] Public Default ReadOnly Property Item( _ ByVal index As CellStyleEnum _ ) As CellStyle [C#] public CellStyle this[ CellStyleEnum index ] {get;}

CellStyleCollection.Item Property 569

[Delphi] public property Item[ index: CellStyleEnum ]: CellStyle read get_Item; See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace | CellStyleCollection.Item Overload List

CellStyleCollection.Item Property (Int32)


Gets a CellStyle by index. [Visual Basic] Public Default ReadOnly Property Item( _ ByVal index As Integer _ ) As CellStyle [C#] public CellStyle this[ int index ] {get;} [Delphi] public property Item[ index: Int32 ]: CellStyle read get_Item; See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace | CellStyleCollection.Item Overload List

CellStyleCollection.Item Property (String)


Gets a CellStyle by name. [Visual Basic] Public Default ReadOnly Property Item( _ ByVal name As String _ ) As CellStyle [C#] public CellStyle this[ string name ] {get;} [Delphi] public property Item[ name: String ]: CellStyle read get_Item; Remarks If the specified name doesn't exist, this indexer returns null.

570 C1.Win.C1FlexGrid Namespace

See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace | CellStyleCollection.Item Overload List

CellStyleCollection.NewRow Property
Gets the style used to paint cells in the new row template at the bottom of the grid. [Visual Basic] Public ReadOnly Property NewRow As CellStyle [C#] public CellStyle NewRow {get;} [Delphi] public property NewRow: CellStyle read get_NewRow; Remarks The new row template is only present when the C1FlexGridBase.AllowAddNew property is set to true. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Normal Property
Gets the default style used to paint scrollable cells. [Visual Basic] Public ReadOnly Property Normal As CellStyle [C#] public CellStyle Normal {get;} [Delphi] public property Normal: CellStyle read get_Normal; See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Search Property
Gets the style used to paint the cell selected while auto-searching. [Visual Basic] Public ReadOnly Property Search As CellStyle [C#] public CellStyle Search {get;} [Delphi] public property Search: CellStyle read get_Search;

CellStyleCollection.SelectedColumnHeader Property 571

Remarks Use the C1FlexGridBase.AutoSearch property to enable auto-searching. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.SelectedColumnHeader Property
Gets the style used to paint selected column headers. [Visual Basic] Public ReadOnly Property SelectedColumnHeader As CellStyle [C#] public CellStyle SelectedColumnHeader {get;} [Delphi] public property SelectedColumnHeader: CellStyle read get_SelectedColumnHeader; See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.SelectedRowHeader Property
Gets the style used to paint selected column headers. [Visual Basic] Public ReadOnly Property SelectedRowHeader As CellStyle [C#] public CellStyle SelectedRowHeader {get;} [Delphi] public property SelectedRowHeader: CellStyle read get_SelectedRowHeader; See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection Methods
The methods of the CellStyleCollection class are listed here. For a complete list of CellStyleCollection class members, see the CellStyleCollection Members topic. Public Methods Add BuildString Clear ClearUnused Overloaded. Adds a new empty CellStyle object to the collection. Builds and returns a compact string representation of the style collection. Clear all styles (even those in use) and reset the built-in styles. Clear all unused styles.

572 C1.Win.C1FlexGrid Namespace

Contains IndexOf ParseString Remove See Also

Checks whether the collection contains a given style. Gets the index of a style in the collection. Parses a string containing style definitions. Overloaded. Removes a custom style from the collection.

CellStyleCollection Class | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Add Method
Overload List Adds a new empty CellStyle object to the collection. [Visual Basic] Overloads Public Function Add(String) As CellStyle [C#] public CellStyle Add(string); [Delphi] public function Add(String) : CellStyle; overload; Adds a new CellStyle object to the collection. [Visual Basic] Overloads Public Function Add(String, CellStyle) As CellStyle [C#] public CellStyle Add(string, CellStyle); [Delphi] public function Add(String; CellStyle) : CellStyle; overload; Adds new CellStyle object to the collection. [Visual Basic] Overloads Public Function Add(String, String) As CellStyle [C#] public CellStyle Add(string, string); [Delphi] public function Add(String; String) : CellStyle; overload; See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Add Method (String)


Adds a new empty CellStyle object to the collection. [Visual Basic] Overloads Public Function Add( _ ByVal name As String _ ) As CellStyle [C#] public CellStyle Add( string name ); [Delphi] public function Add( name: String ): CellStyle; overload;

CellStyleCollection.Add Method 573

Parameters name Name of the new style. Return Value The new CellStyle object. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace | CellStyleCollection.Add Overload List

CellStyleCollection.Add Method (String, CellStyle)


Adds a new CellStyle object to the collection. [Visual Basic] Overloads Public Function Add( _ ByVal name As String, _ ByVal basedOn As CellStyle _ ) As CellStyle [C#] public CellStyle Add( string name, CellStyle basedOn ); [Delphi] public function Add( name: String; basedOn: CellStyle ): CellStyle; overload; Parameters name Name of the new style. basedOn Base style, used to initialize the properties of the new style. Return Value The new CellStyle object. Remarks If a style with the given name already exists, the existing style is returned and no exception is thrown. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace | CellStyleCollection.Add Overload List

CellStyleCollection.Add Method (String, String)


Adds new CellStyle object to the collection.

574 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overloads Public Function Add( _ ByVal name As String, _ ByVal basedOn As String _ ) As CellStyle [C#] public CellStyle Add( string name, string basedOn ); [Delphi] public function Add( name: String; basedOn: String ): CellStyle; overload; Parameters name Name of the new style. basedOn Name of the base style, used to initialize the properties of the new style. Return Value The new CellStyle object. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace | CellStyleCollection.Add Overload List

CellStyleCollection.BuildString Method
Builds and returns a compact string representation of the style collection. [Visual Basic] Public Function BuildString( _ ByVal includeEmpty As Boolean _ ) As String [C#] public string BuildString( bool includeEmpty ); [Delphi] public function BuildString( includeEmpty: Boolean ): String; Parameters includeEmpty Whether styles with no attributes should be included.

CellStyleCollection.Clear Method 575

Return Value A compact string representation of the style collection. Remarks This method is used internally to implement design-time persistence. It can also be used for implementing 'skins', by saving the current styles into a collection and later applying them to the grid using the ParseString method. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Clear Method
Clear all styles (even those in use) and reset the built-in styles. [Visual Basic] Public Sub Clear() [C#] public void Clear() [Delphi] public procedure Clear(); See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.ClearUnused Method
Clear all unused styles. [Visual Basic] Public Sub ClearUnused() [C#] public void ClearUnused() [Delphi] public procedure ClearUnused(); Remarks Unused styles are unnamed styles that were created and are no longer assigned to any grid elements. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Contains Method
Checks whether the collection contains a given style. [Visual Basic] Public Function Contains( _ ByVal name As String _ ) As Boolean

576 C1.Win.C1FlexGrid Namespace

[C#] public bool Contains( string name ); [Delphi] public function Contains( name: String ): Boolean; Parameters name Name of the style to look for. Return Value True if the collection contains a style called name, False otherwise. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.IndexOf Method
Gets the index of a style in the collection. [Visual Basic] Public Function IndexOf( _ ByVal style As CellStyle _ ) As Integer [C#] public int IndexOf( CellStyle style ); [Delphi] public function IndexOf( style: CellStyle ): Int32; Parameters style Style object to look for. Return Value Index of the style in the collection, or -1 if the style is not a member of the collection. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.ParseString Method
Parses a string containing style definitions.

CellStyleCollection.Remove Method 577

[Visual Basic] Public Function ParseString( _ ByVal styleDef As String _ ) As Boolean [C#] public bool ParseString( string styleDef ); [Delphi] public function ParseString( styleDef: String ): Boolean; Parameters styleDef String containing style definitions. Remarks The style definition string is usually obtained from a call to BuildString method. The new definitions are merged with the current ones. To completely replace the styles, call the Clear method before parsing the new styles. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Remove Method
Overload List Removes a custom style from the collection. [Visual Basic] Overloads Public Sub Remove(CellStyle) [C#] public void Remove(CellStyle); [Delphi] public procedure Remove(CellStyle); overload; Removes a custom style from the collection. [Visual Basic] Overloads Public Sub Remove(Integer) [C#] public void Remove(int); [Delphi] public procedure Remove(Int32); overload; Removes a custom style from the collection. [Visual Basic] Overloads Public Sub Remove(String) [C#] public void Remove(string); [Delphi] public procedure Remove(String); overload; See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace

CellStyleCollection.Remove Method (CellStyle)


Removes a custom style from the collection.

578 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overloads Public Sub Remove( _ ByVal style As CellStyle _ ) [C#] public void Remove( CellStyle style ); [Delphi] public procedure Remove( style: CellStyle ); overload; Parameters style Style to be removed from the collection. Remarks Built-in styles can't be removed. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace | CellStyleCollection.Remove Overload List

CellStyleCollection.Remove Method (Int32)


Removes a custom style from the collection. [Visual Basic] Overloads Public Sub Remove( _ ByVal index As Integer _ ) [C#] public void Remove( int index ); [Delphi] public procedure Remove( index: Int32 ); overload; Parameters index Index of the style to be removed. Remarks Built-in styles can't be removed.

CellStyleEnum Enumeration 579

See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace | CellStyleCollection.Remove Overload List

CellStyleCollection.Remove Method (String)


Removes a custom style from the collection. [Visual Basic] Overloads Public Sub Remove( _ ByVal name As String _ ) [C#] public void Remove( string name ); [Delphi] public procedure Remove( name: String ); overload; Parameters name Name of the style to be removed. Remarks Built-in styles can't be removed. See Also CellStyleCollection Class | CellStyleCollection Members | C1.Win.C1FlexGrid Namespace | CellStyleCollection.Remove Overload List

CellStyleEnum Enumeration
Enumeration used to retrieve CellStyle objects from the C1FlexGridBase.Styles collection. [Visual Basic] Public Enum CellStyleEnum [C#] public enum CellStyleEnum [Delphi] type CellStyleEnum = (Alternate, Editor, EmptyArea, FirstCustomStyle, Fixed, Focus, Frozen, GrandTotal, Highlight, NewRow, Normal, Search, SelectedColumnHeader, SelectedRowHeader, Subtotal0, Subtotal1, Subtotal2, Subtotal3, Subtotal4, Subtotal5); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll)

580 C1.Win.C1FlexGrid Namespace

Remarks Cell styles can be retrieved from the the C1FlexGridBase.Styles collection using the indexer or the style name. Built-in styles can also be obtained directly through read-only properties. Example The code below shows three ways to obtain a reference to a grid's default style: Visual Basic ' s1, s2, Dim s1 As Dim s2 As Dim s3 As and s3 are all references to the grid's Normal style: CellStyle = _flex.Styles(CellStyleEnum.Normal) CellStyle = _flex.Styles("Normal") CellStyle = _flex.Styles.Normal s3 are all references to the grid's Normal style: _flex.Styles[CellStyleEnum.Normal]; _flex.Styles["Normal"]; _flex.Styles.Normal;

C# // s1, s2, and CellStyle s1 = CellStyle s2 = CellStyle s3 =

Delphi var s1 := CellStyle; s2 := CellStyle; s3 := CellStyle; begin // s1, s2, and s3 are all references to the grid's Normal style: s1 := _flex.Styles[CellStyleEnum.Normal]; s2 := _flex.Styles['Normal']; s3 := _flex.Styles.Normal; end;

Members Member name Alternate Editor EmptyArea FirstCustomStyle Fixed Focus Frozen GrandTotal Highlight NewRow Normal Description Style used to render scrollable cells in even-numbered rows. Style used to render cells being edited. Style used to render the area of the grid where there are no cells. Constant that indicates the first custom style. Style used to render fixed cells. Style used to render the cell that has the focus. Style used to render cells that are frozen (editable and selectable, but not scrollable). Style automatically assigned to grand total nodes created with the C1FlexGridBase.Subtotal method. Style used to render cells that are selected and highlighted. Style used to render the last row on the grid when the C1FlexGridBase.AllowAddNew property is set to true. Style used to render scrollable normal cells.

CheckEnum Enumeration 581

Member name Search

Description Style used to render cells that are being selected as the user types (see the C1FlexGridBase.AutoSearch property). Style used to render selected column headers. Style used to render selected row headers. Style automatically assigned to level-0 nodes created with the C1FlexGridBase.Subtotal method. Style automatically assigned to level-1 nodes created with the C1FlexGridBase.Subtotal method. Style automatically assigned to level-2 nodes created with the C1FlexGridBase.Subtotal method. Style automatically assigned to level-3 nodes created with the C1FlexGridBase.Subtotal method. Style automatically assigned to level-4 nodes created with the C1FlexGridBase.Subtotal method. Style automatically assigned to level-5 nodes created with the C1FlexGridBase.Subtotal method.

SelectedColumnHeader SelectedRowHeader Subtotal0 Subtotal1 Subtotal2 Subtotal3 Subtotal4 Subtotal5 See Also C1.Win.C1FlexGrid Namespace

CheckEnum Enumeration
Specifies the type of checkbox to draw in a cell. [Visual Basic] Public Enum CheckEnum [C#] public enum CheckEnum [Delphi] type CheckEnum = (Checked, None, TSChecked, TSGrayed, TSUnchecked, Unchecked); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Remarks There are two types of check boxes: regular and tri-state. Regular check boxes are used to display simple Boolean values. They cycle through settings Checked and Unchecked when clicked with the mouse. Tri-state check boxes are used to display values that may be true, false, or indeterminate (grayed). They cycle through settings TSChecked, TSGrayed, and TSUnchecked when clicked with the mouse. Visually, Checked and Unchecked look the same as TSChecked and TSUnchecked.

582 C1.Win.C1FlexGrid Namespace

Members Member name Checked None TSChecked TSGrayed TSUnchecked Unchecked See Also C1.Win.C1FlexGrid Namespace Description Check box with a check mark in it. No check box. Tri-state check box with a check mark in it. Tri-state check box in grayed state. Tri-state empty check box. Empty check box.

ClearFlags Enumeration
Specifies which elements of the grid should be cleared by the C1FlexGridBase.Clear method. [Visual Basic] Public Enum ClearFlags [C#] public enum ClearFlags [Delphi] type ClearFlags = (All, Content, Style, UserData); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Remarks This enumeration contains flags that can be combined to customize the sorting process. Members Member name All Content Style UserData See Also C1.Win.C1FlexGrid Namespace Description All of the above. Clear cell content, including data, images, and checkboxes if any. Clear custom styles assigned to cells. Clear user data associated with cells.

Column Class
Class that represents a grid column. For a list of all members of this type, see Column Members.

Column Members 583

System.Object C1.Win.C1FlexGrid.RowCol C1.Win.C1FlexGrid.Column [Visual Basic] Public Class Column Inherits RowCol [C#] public class Column : RowCol [Delphi] type Column = class (RowCol); Remarks This class does not have a public constructor. You can add and remove columns using methods in the grid's C1FlexGridBase.Cols property, which exposes the column collection. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also Column Members | C1.Win.C1FlexGrid Namespace

Column Members
Column overview Public Properties AllowDragging (inherited from RowCol) AllowEditing (inherited from RowCol) AllowMerging (inherited from RowCol) AllowResizing (inherited from RowCol) AllowSorting Caption ComboList (inherited from RowCol) DataIndex DataMap (inherited from RowCol) Gets or sets whether the user can drag this row or column with the mouse. Gets or sets whether cells on this row or column can be edited by the user. Specifies whether adjacent cells with similar contents will be merged. Gets or sets whether the user can resize this row or column with the mouse. Gets or sets whether this column can be sorted by clicking on the column header. Gets or sets the text of the column's header cell. Gets or sets a list of items to be used by the drop-down editor. Gets the position of the column in the data source object. Gets or sets an Collections.IDictionary object used to translate data values into display values for this row or column. Gets or sets the type of object stored in this row or column.

DataType (inherited from RowCol)

584 C1.Win.C1FlexGrid Namespace

EditMask (inherited from RowCol) Editor (inherited from RowCol) Format (inherited from RowCol) ImageAlign (inherited from RowCol)

Gets or sets the input mask to use when editing cells on this column. Gets or sets the custom editor used to edit cells in this column. Gets or sets a string that specifies how to format the data on this column. Gets or sets an ImageAlignEnum value that determines how images are aligned in scrollable cells on this row or column. Gets or sets an ImageAlignEnum value that determines how images are aligned in fixed cells on this row or column. Gets or sets a value that determines whether images found in this row or column's ImageMap should be displayed instead of or in addition to the cell text. Gets or sets an Collections.IDictionary object used to translate data values into images for this row or column. Overridden. Gets the index of this column in the Column collection. Gets or sets the cell value specified by the row index in this column. Gets the position of the left of this column, in pixels, relative to the grid. Gets or sets the name of this column. Gets the position of the right of this column, in pixels, relative to the grid. Gets the index of this column in the Column collection. Overridden. Gets or sets whether this column is selected. Specifies how this column should be sorted when the C1FlexGridBase.Sort method is called with a SortFlags.UseColSort flag. Gets or sets a custom CellStyle associated with this row or column. Gets the style used to display this row or column. Gets the stock CellStyle used to paint fixed cells in this row or column. Gets the style used to display fixed cells on this row or column. Gets the custom style associated with fixed cells on this row or column, createing a new one of necessary. Gets or sets a custom CellStyle associated with this row or column, creating a new style if necessary.

ImageAlignFixed (inherited from RowCol)

ImageAndText (inherited from RowCol)

ImageMap (inherited from RowCol)

Index Item Left Name Right SafeIndex Selected Sort

Style (inherited from RowCol) StyleDisplay (inherited from RowCol) StyleFixed (inherited from RowCol) StyleFixedDisplay (inherited from RowCol) StyleFixedNew (inherited from RowCol) StyleNew (inherited from RowCol)

Column Properties 585

TextAlign (inherited from RowCol)

Gets or sets a TextAlignEnum value that determines how text is aligned in scrollable cells on this row or column. Gets or sets a TextAlignEnum value that determines how text is aligned in fixed cells on this row or column. Gets or sets user data associated with this row or column. Gets or sets whether a Row or Column is visible. Gets or sets the width of this column, in pixels (the value -1 represents the default column width). Gets or sets the display width for this column, in pixels. Overridden. Clears this Column. Overridden. Invalidates this column, causing it to be repainted. Overridden. Moves a Column to a new position in the collection.

TextAlignFixed (inherited from RowCol) UserData (inherited from RowCol) Visible (inherited from RowCol) Width WidthDisplay Public Methods Clear Invalidate Move See Also Column Class | C1.Win.C1FlexGrid Namespace

Column Properties
The properties of the Column class are listed here. For a complete list of Column class members, see the Column Members topic. Public Properties AllowDragging (inherited from RowCol) AllowEditing (inherited from RowCol) AllowMerging (inherited from RowCol) AllowResizing (inherited from RowCol) AllowSorting Caption ComboList (inherited from RowCol) DataIndex DataMap (inherited from RowCol) Gets or sets whether the user can drag this row or column with the mouse. Gets or sets whether cells on this row or column can be edited by the user. Specifies whether adjacent cells with similar contents will be merged. Gets or sets whether the user can resize this row or column with the mouse. Gets or sets whether this column can be sorted by clicking on the column header. Gets or sets the text of the column's header cell. Gets or sets a list of items to be used by the drop-down editor. Gets the position of the column in the data source object. Gets or sets an Collections.IDictionary object used to translate data values into display values for this row or column.

586 C1.Win.C1FlexGrid Namespace

DataType (inherited from RowCol) EditMask (inherited from RowCol) Editor (inherited from RowCol) Format (inherited from RowCol) ImageAlign (inherited from RowCol)

Gets or sets the type of object stored in this row or column. Gets or sets the input mask to use when editing cells on this column. Gets or sets the custom editor used to edit cells in this column. Gets or sets a string that specifies how to format the data on this column. Gets or sets an ImageAlignEnum value that determines how images are aligned in scrollable cells on this row or column. Gets or sets an ImageAlignEnum value that determines how images are aligned in fixed cells on this row or column. Gets or sets a value that determines whether images found in this row or column's ImageMap should be displayed instead of or in addition to the cell text. Gets or sets an Collections.IDictionary object used to translate data values into images for this row or column. Overridden. Gets the index of this column in the Column collection. Gets or sets the cell value specified by the row index in this column. Gets the position of the left of this column, in pixels, relative to the grid. Gets or sets the name of this column. Gets the position of the right of this column, in pixels, relative to the grid. Gets the index of this column in the Column collection. Overridden. Gets or sets whether this column is selected. Specifies how this column should be sorted when the C1FlexGridBase.Sort method is called with a SortFlags.UseColSort flag. Gets or sets a custom CellStyle associated with this row or column. Gets the style used to display this row or column. Gets the stock CellStyle used to paint fixed cells in this row or column. Gets the style used to display fixed cells on this row or column. Gets the custom style associated with fixed cells on this row or column, createing a new one of necessary.

ImageAlignFixed (inherited from RowCol)

ImageAndText (inherited from RowCol)

ImageMap (inherited from RowCol)

Index Item Left Name Right SafeIndex Selected Sort

Style (inherited from RowCol) StyleDisplay (inherited from RowCol) StyleFixed (inherited from RowCol) StyleFixedDisplay (inherited from RowCol) StyleFixedNew (inherited from RowCol)

Column.AllowSorting Property 587

StyleNew (inherited from RowCol) TextAlign (inherited from RowCol)

Gets or sets a custom CellStyle associated with this row or column, creating a new style if necessary. Gets or sets a TextAlignEnum value that determines how text is aligned in scrollable cells on this row or column. Gets or sets a TextAlignEnum value that determines how text is aligned in fixed cells on this row or column. Gets or sets user data associated with this row or column. Gets or sets whether a Row or Column is visible. Gets or sets the width of this column, in pixels (the value -1 represents the default column width). Gets or sets the display width for this column, in pixels.

TextAlignFixed (inherited from RowCol) UserData (inherited from RowCol) Visible (inherited from RowCol) Width WidthDisplay See Also Column Class | C1.Win.C1FlexGrid Namespace

Column.AllowSorting Property
Gets or sets whether this column can be sorted by clicking on the column header. [Visual Basic] Public Property AllowSorting As Boolean [C#] public bool AllowSorting {get;set;} [Delphi] public property AllowSorting: Boolean read get_AllowSorting write set_AllowSorting; Remarks The grid has an C1FlexGridBase.AllowSorting property that determines whether columns can be sorted with the mouse. The AllowSorting property of the Column objects can be used to prevent the user from sorting specific columns. See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

Column.Caption Property
Gets or sets the text of the column's header cell. [Visual Basic] Public Property Caption As String [C#] public string Caption {get;set;} [Delphi] public property Caption: String read get_Caption write set_Caption;

588 C1.Win.C1FlexGrid Namespace

See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

Column.DataIndex Property
Gets the position of the column in the data source object. [Visual Basic] Public ReadOnly Property DataIndex As Integer [C#] public int DataIndex {get;} [Delphi] public property DataIndex: Int32 read get_DataIndex; Remarks This property returns -1 for fixed and unbound columns. See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

Column.Index Property
Gets the index of this column in the Column collection. [Visual Basic] Overrides Public ReadOnly Property Index As Integer [C#] override public int Index {get;} [Delphi] public property Index: Int32 read get_Index; Remarks Returns -1 if the column is not a member of the collection. See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

Column.Item Property
Gets or sets the cell value specified by the row index in this column. [Visual Basic] Public Default Property Item( _ ByVal rowIndex As Integer _ ) As Object [C#] public object this[ int rowIndex ] {get;set;}

Column.Left Property 589

[Delphi] public property Item[ rowIndex: Int32 ]: Object read get_Item write set_Item; See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

Column.Left Property
Gets the position of the left of this column, in pixels, relative to the grid. [Visual Basic] Public ReadOnly Property Left As Integer [C#] public int Left {get;} [Delphi] public property Left: Int32 read get_Left; Remarks The value returned is the sum of column widths from the left of the grid until this column, and does not account for the scroll position. To account for the scroll position, this value should be adjusted using the grid's ScrollableControl.ScrollPosition property. To retrieve the size and position of a cell, use the C1FlexGridBase.GetCellRect method. See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

Column.Name Property
Gets or sets the name of this column. [Visual Basic] Public Property Name As String [C#] public string Name {get;set;} [Delphi] public property Name: String read get_Name write set_Name; Remarks The name can be used as an index in the ColumnCollection property indexer. When the grid is bound to a DataSource, the column names are set automatically to the names of columns in the data source, and are used for binding. See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

590 C1.Win.C1FlexGrid Namespace

Column.Right Property
Gets the position of the right of this column, in pixels, relative to the grid. [Visual Basic] Public ReadOnly Property Right As Integer [C#] public int Right {get;} [Delphi] public property Right: Int32 read get_Right; Remarks The value returned corresponds to the sum of the Left and WidthDisplay properties. See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

Column.SafeIndex Property
Gets the index of this column in the Column collection. [Visual Basic] Overridable Public ReadOnly Property SafeIndex As Integer [C#] virtual public int SafeIndex {get;} [Delphi] public property SafeIndex: Int32 read get_SafeIndex; Remarks This property is similar to the Index property, except it throws an exception if the Column is not a member of the collection. See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

Column.Selected Property
Gets or sets whether this column is selected. [Visual Basic] Overrides Public Property Selected As Boolean [C#] override public bool Selected {get;set;} [Delphi] public property Selected: Boolean read get_Selected write set_Selected; See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

Column.Sort Property 591

Column.Sort Property
Specifies how this column should be sorted when the C1FlexGridBase.Sort method is called with a SortFlags.UseColSort flag. [Visual Basic] Public Property Sort As SortFlags [C#] public SortFlags Sort {get;set;} [Delphi] public property Sort: SortFlags read get_Sort write set_Sort; See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

Column.Width Property
Gets or sets the width of this column, in pixels (the value -1 represents the default column width). [Visual Basic] Public Property Width As Integer [C#] public int Width {get;set;} [Delphi] public property Width: Int32 read get_Width write set_Width; Remarks Setting this property to -1 causes the grid to use the default column width for this column (see the RowColCollection.DefaultSize property). Width returns the width assigned to the column even if the row is invisible, and returns -1 if the row has the default height. To obtain the actual display width of a column, use the WidthDisplay property. See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

Column.WidthDisplay Property
Gets or sets the display width for this column, in pixels. [Visual Basic] Public Property WidthDisplay As Integer [C#] public int WidthDisplay {get;set;} [Delphi] public property WidthDisplay: Int32 read get_WidthDisplay write set_WidthDisplay;

592 C1.Win.C1FlexGrid Namespace

Remarks WidthDisplay returns zero if the column is invisible, and returns the actual display width even if the Width property is set to -1 (which stands for default column width). See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

Column Methods
The methods of the Column class are listed here. For a complete list of Column class members, see the Column Members topic. Public Methods Clear Invalidate Move See Also Column Class | C1.Win.C1FlexGrid Namespace Overridden. Clears this Column. Overridden. Invalidates this column, causing it to be repainted. Overridden. Moves a Column to a new position in the collection.

Column.Clear Method
Clears this Column. [Visual Basic] Overrides Public Sub Clear( _ ByVal clearFlags As ClearFlags _ ) [C#] override public void Clear( ClearFlags clearFlags ); [Delphi] public procedure Clear( clearFlags: ClearFlags ); override; Parameters clearFlags ClearFlags value specifying which elements of the Column should be cleared. See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

Column.Invalidate Method
Invalidates this column, causing it to be repainted.

Column.Move Method 593

[Visual Basic] Overrides Public Sub Invalidate() [C#] override public void Invalidate() [Delphi] public procedure Invalidate(); override; See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

Column.Move Method
Moves a Column to a new position in the collection. [Visual Basic] Overrides Public Sub Move( _ ByVal indexNew As Integer _ ) [C#] override public void Move( int indexNew ); [Delphi] public procedure Move( indexNew: Int32 ); override; Parameters indexNew An integer specifying the column's new position. See Also Column Class | Column Members | C1.Win.C1FlexGrid Namespace

ColumnCollection Class
Collection of grid Column objects. For a list of all members of this type, see ColumnCollection Members. System.Object C1.Win.C1FlexGrid.RowColCollection C1.Win.C1FlexGrid.ColumnCollection [Visual Basic] Public Class ColumnCollection Inherits RowColCollection

594 C1.Win.C1FlexGrid Namespace

[C#] public class ColumnCollection : RowColCollection [Delphi] type ColumnCollection = class (RowColCollection); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also ColumnCollection Members | C1.Win.C1FlexGrid Namespace

ColumnCollection Members
ColumnCollection overview Public Properties Count DefaultSize (inherited from RowColCollection) Fixed Frozen (inherited from RowColCollection) Item MaxSize (inherited from RowColCollection) MinSize (inherited from RowColCollection) Selected Public Methods Add Contains IndexOf Insert InsertRange Move MoveRange Appends a new Column object to this collection. Overloaded. Gets a value that determines whether the collection contains a Column with the given name. Overloaded. Gets the index of the Column with the specified name. Adds a new Column object to this collection at a specified position. Adds a range of Column objects to the collection at a specified position. Overridden. Moves a Column object to a new position in the collection. Overridden. Moves a range of Column objects to a new position in the collection. Overridden. Gets or sets the number of Column objects in this collection. Gets or sets the default size for the rows or columns in the collection. Overridden. Gets or sets the number of fixed columns in this collection. Gets or sets the number of frozen rows or columns in the collection. Overloaded. Gets the Column at the specified index. Gets or sets the maximum size for rows and columns in the collection. Gets or sets the minimum size for rows and columns in the collection. Gets a collection of Column objects that are currently selected.

ColumnCollection Properties 595

Remove RemoveRange See Also

Overloaded. Removes a Column object from the collection. Removes a range of Column objects from the collection.

ColumnCollection Class | C1.Win.C1FlexGrid Namespace

ColumnCollection Properties
The properties of the ColumnCollection class are listed here. For a complete list of ColumnCollection class members, see the ColumnCollection Members topic. Public Properties Count DefaultSize (inherited from RowColCollection) Fixed Frozen (inherited from RowColCollection) Item MaxSize (inherited from RowColCollection) MinSize (inherited from RowColCollection) Selected See Also ColumnCollection Class | C1.Win.C1FlexGrid Namespace Overridden. Gets or sets the number of Column objects in this collection. Gets or sets the default size for the rows or columns in the collection. Overridden. Gets or sets the number of fixed columns in this collection. Gets or sets the number of frozen rows or columns in the collection. Overloaded. Gets the Column at the specified index. Gets or sets the maximum size for rows and columns in the collection. Gets or sets the minimum size for rows and columns in the collection. Gets a collection of Column objects that are currently selected.

ColumnCollection.Count Property
Gets or sets the number of Column objects in this collection. [Visual Basic] Overrides Public Property Count As Integer [C#] override public int Count {get;set;} [Delphi] public property Count: Int32 read get_Count write set_Count; Remarks You can add or remove columns by assigning a new value to this property, or you can use the Add, Insert, InsertRange, and Remove methods.

596 C1.Win.C1FlexGrid Namespace

See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace

ColumnCollection.Fixed Property
Gets or sets the number of fixed columns in this collection. [Visual Basic] Overrides Public Property Fixed As Integer [C#] override public int Fixed {get;set;} [Delphi] public property Fixed: Int32 read get_Fixed write set_Fixed; See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace

ColumnCollection.Item Property
Overload List Gets the Column at the specified index. [Visual Basic] Overloads Public Default ReadOnly Property Item(Integer) As Column [C#] public Column this[int]{get;} [Delphi] public property Item[index: Int32]: Column read get_Item; Gets the Column that has the specified column name. [Visual Basic] Overloads Public Default ReadOnly Property Item(String) As Column [C#] public Column this[string]{get;} [Delphi] public property Item[columnName: String]: Column read get_Item; See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace

ColumnCollection.Item Property (Int32)


Gets the Column at the specified index. [Visual Basic] Public Default ReadOnly Property Item( _ ByVal index As Integer _ ) As Column [C#] public Column this[ int index ] {get;}

ColumnCollection.Selected Property 597

[Delphi] public property Item[ index: Int32 ]: Column read get_Item; See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace | ColumnCollection.Item Overload List

ColumnCollection.Item Property (String)


Gets the Column that has the specified column name. [Visual Basic] Public Default ReadOnly Property Item( _ ByVal columnName As String _ ) As Column [C#] public Column this[ string columnName ] {get;} [Delphi] public property Item[ columnName: String ]: Column read get_Item; See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace | ColumnCollection.Item Overload List

ColumnCollection.Selected Property
Gets a collection of Column objects that are currently selected. [Visual Basic] Public ReadOnly Property Selected As ColumnCollection [C#] public ColumnCollection Selected {get;} [Delphi] public property Selected: ColumnCollection read get_Selected; See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace

ColumnCollection Methods
The methods of the ColumnCollection class are listed here. For a complete list of ColumnCollection class members, see the ColumnCollection Members topic.

598 C1.Win.C1FlexGrid Namespace

Public Methods Add Contains IndexOf Insert InsertRange Move MoveRange Remove RemoveRange See Also ColumnCollection Class | C1.Win.C1FlexGrid Namespace Appends a new Column object to this collection. Overloaded. Gets a value that determines whether the collection contains a Column with the given name. Overloaded. Gets the index of the Column with the specified name. Adds a new Column object to this collection at a specified position. Adds a range of Column objects to the collection at a specified position. Overridden. Moves a Column object to a new position in the collection. Overridden. Moves a range of Column objects to a new position in the collection. Overloaded. Removes a Column object from the collection. Removes a range of Column objects from the collection.

ColumnCollection.Add Method
Appends a new Column object to this collection. [Visual Basic] Public Function Add() As Column [C#] public Column Add() [Delphi] public function Add(): Column; Return Value A reference to the Column that was added to the collection. See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace

ColumnCollection.Contains Method
Gets a value that determines whether the collection contains a Column with the given name. [Visual Basic] Public Function Contains( _ ByVal columnName As String _ ) As Boolean

ColumnCollection.IndexOf Method 599

[C#] public bool Contains( string columnName ); [Delphi] public function Contains( columnName: String ): Boolean; overload; Parameters columnName Column name to look for (case-insensitive). Return Value True if the collection contains a column with the given name, False otherwise. See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace

ColumnCollection.IndexOf Method
Overload List Gets the index of the Column with the specified name. [Visual Basic] Overloads Public Function IndexOf(String) As Integer [C#] public int IndexOf(string); [Delphi] public function IndexOf(String) : Int32; overload; Gets the index of the Column with the specified name, optionally throwing an exception if the column is not found. [Visual Basic] Overloads Public Function IndexOf(String, Boolean) As Integer [C#] public int IndexOf(string, bool); [Delphi] public function IndexOf(String; Boolean) : Int32; overload; See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace

ColumnCollection.IndexOf Method (String)


Gets the index of the Column with the specified name. [Visual Basic] Overloads Public Function IndexOf( _ ByVal columnName As String _ ) As Integer [C#] public int IndexOf( string columnName );

600 C1.Win.C1FlexGrid Namespace

[Delphi] public function IndexOf( columnName: String ): Int32; overload; Parameters columnName Column name to look for (case-insensitive). Return Value Index of the column that has the given name in this collection, or -1 if the collection does not contain a column with the given name. See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace | ColumnCollection.IndexOf Overload List

ColumnCollection.IndexOf Method (String, Boolean)


Gets the index of the Column with the specified name, optionally throwing an exception if the column is not found. [Visual Basic] Overloads Public Function IndexOf( _ ByVal columnName As String, _ ByVal throwIfNotFound As Boolean _ ) As Integer [C#] public int IndexOf( string columnName, bool throwIfNotFound ); [Delphi] public function IndexOf( columnName: String; throwIfNotFound: Boolean ): Int32; overload; Parameters columnName Column name to look for (case-insensitive). throwIfNotFound Whether to throw and exception if the column cannot be found. Return Value Index of the column that has the given name in this collection, or -1 if the collection does not contain a column with the given name.

ColumnCollection.Insert Method 601

Remarks If the throwIfNotFound parameter is set to true and a column named columnName cannot be found, the control throws an ArgumentOutOfRangeException. This makes it easier to write compact code that relies on column names. Example The example below uses the IndexOf method to convert column names into indices. Note that if the column names are invalid, the exception will be thrown by the IndexOf method (column not found) rather than in the following method, where it would not be as clear (invalid index). Visual Basic Dim columnIndex As Integer = _flex.Cols.IndexOf("total") _flex.AutoSizeCol(columnIndex) C# int columnIndex = _flex.Cols.IndexOf("total"); _flex.AutoSizeCol(columnIndex); Delphi var columnIndex : Integer; columnIndex := _flex.Cols.IndexOf('total'); _flex.AutoSizeCol(columnIndex);

See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace | ColumnCollection.IndexOf Overload List

ColumnCollection.Insert Method
Adds a new Column object to this collection at a specified position. [Visual Basic] Public Function Insert( _ ByVal index As Integer _ ) As Column [C#] public Column Insert( int index ); [Delphi] public function Insert( index: Int32 ): Column; Parameters index The position where the new column will be inserted. Return Value A reference to the Column that was inserted to the collection. See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace

602 C1.Win.C1FlexGrid Namespace

ColumnCollection.InsertRange Method
Adds a range of Column objects to the collection at a specified position. [Visual Basic] Public Sub InsertRange( _ ByVal index As Integer, _ ByVal count As Integer _ ) [C#] public void InsertRange( int index, int count ); [Delphi] public procedure InsertRange( index: Int32; count: Int32 ); Parameters index The position where the new range will be inserted. count The number of columns to add. See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace

ColumnCollection.Move Method
Moves a Column object to a new position in the collection. [Visual Basic] Overrides Public Sub Move( _ ByVal indexOld As Integer, _ ByVal indexNew As Integer _ ) [C#] override public void Move( int indexOld, int indexNew ); [Delphi] public procedure Move( indexOld: Int32; indexNew: Int32 ); override;

ColumnCollection.MoveRange Method 603

Parameters indexOld Index of the column to be moved. indexNew New position for the column. See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace

ColumnCollection.MoveRange Method
Moves a range of Column objects to a new position in the collection. [Visual Basic] Overrides Public Sub MoveRange( _ ByVal index As Integer, _ ByVal count As Integer, _ ByVal indexNew As Integer _ ) [C#] override public void MoveRange( int index, int count, int indexNew ); [Delphi] public procedure MoveRange( index: Int32; count: Int32; indexNew: Int32 ); override; Parameters index The index of the first column in the range that will be moved. count The number of columns that will be moved. indexNew New position for the first column in the range. See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace

ColumnCollection.Remove Method
Overload List Removes a Column object from the collection. [Visual Basic] Overloads Public Function Remove(Column) As Column

604 C1.Win.C1FlexGrid Namespace

[C#] public Column Remove(Column); [Delphi] public function Remove(Column) : Column; overload; Removes a Column object from the collection. [Visual Basic] Overloads Public Function Remove(Integer) As Column [C#] public Column Remove(int); [Delphi] public function Remove(Int32) : Column; overload; Removes a Column object from the collection. [Visual Basic] Overloads Public Function Remove(String) As Column [C#] public Column Remove(string); [Delphi] public function Remove(String) : Column; overload; See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace

ColumnCollection.Remove Method (Column)


Removes a Column object from the collection. [Visual Basic] Overloads Public Function Remove( _ ByVal column As Column _ ) As Column [C#] public Column Remove( Column column ); [Delphi] public function Remove( column: Column ): Column; overload; Parameters column The column to remove. Return Value A reference to the Column that was removed from the collection. See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace | ColumnCollection.Remove Overload List

ColumnCollection.Remove Method (Int32)


Removes a Column object from the collection.

ColumnCollection.Remove Method 605

[Visual Basic] Overloads Public Function Remove( _ ByVal index As Integer _ ) As Column [C#] public Column Remove( int index ); [Delphi] public function Remove( index: Int32 ): Column; overload; Parameters index The index of the column to remove from the collection. Return Value A reference to the Column that was removed from the collection. See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace | ColumnCollection.Remove Overload List

ColumnCollection.Remove Method (String)


Removes a Column object from the collection. [Visual Basic] Overloads Public Function Remove( _ ByVal columnName As String _ ) As Column [C#] public Column Remove( string columnName ); [Delphi] public function Remove( columnName: String ): Column; overload; Parameters columnName Name of the column to remove. Return Value A reference to the Column that was removed from the collection.

606 C1.Win.C1FlexGrid Namespace

See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace | ColumnCollection.Remove Overload List

ColumnCollection.RemoveRange Method
Removes a range of Column objects from the collection. [Visual Basic] Public Sub RemoveRange( _ ByVal index As Integer, _ ByVal count As Integer _ ) [C#] public void RemoveRange( int index, int count ); [Delphi] public procedure RemoveRange( index: Int32; count: Int32 ); Parameters index The index of the first column to remove from the collection. count The number of columns to remove from the collection. See Also ColumnCollection Class | ColumnCollection Members | C1.Win.C1FlexGrid Namespace

ComboBoxEditor Class
Helper class that provides information about a currently active ComboBox editor. For a list of all members of this type, see ComboBoxEditor Members. System.Object C1.Win.C1FlexGrid.ComboBoxEditor [Visual Basic] Public Class ComboBoxEditor [C#] public class ComboBoxEditor [Delphi] type ComboBoxEditor = class;

ComboBoxEditor Members 607

Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also ComboBoxEditor Members | C1.Win.C1FlexGrid Namespace

ComboBoxEditor Members
ComboBoxEditor overview Public Properties Items SelectedIndex SelectedItem SelectedKey See Also ComboBoxEditor Class | C1.Win.C1FlexGrid Namespace Gets the collection of items in the currently active ComboBox editor. Gets or sets the selected index in the currently active ComboBox editor. Gets or sets the selected item in the currently active ComboBox editor. Gets the key that corresponds to the selected item in the currently active ComboBox editor.

ComboBoxEditor Properties
The properties of the ComboBoxEditor class are listed here. For a complete list of ComboBoxEditor class members, see the ComboBoxEditor Members topic. Public Properties Items SelectedIndex SelectedItem SelectedKey See Also ComboBoxEditor Class | C1.Win.C1FlexGrid Namespace Gets the collection of items in the currently active ComboBox editor. Gets or sets the selected index in the currently active ComboBox editor. Gets or sets the selected item in the currently active ComboBox editor. Gets the key that corresponds to the selected item in the currently active ComboBox editor.

ComboBoxEditor.Items Property
Gets the collection of items in the currently active ComboBox editor. [Visual Basic] Public ReadOnly Property Items As IList [C#] public IList Items {get;}

608 C1.Win.C1FlexGrid Namespace

[Delphi] public property Items: IList read get_Items; Remarks If there's no active editor, or if the editor is not a ComboBox, the value returned is null. See Also ComboBoxEditor Class | ComboBoxEditor Members | C1.Win.C1FlexGrid Namespace

ComboBoxEditor.SelectedIndex Property
Gets or sets the selected index in the currently active ComboBox editor. [Visual Basic] Public Property SelectedIndex As Integer [C#] public int SelectedIndex {get;set;} [Delphi] public property SelectedIndex: Int32 read get_SelectedIndex write set_SelectedIndex; Remarks If there's no active editor, or if the editor is not a ComboBox, the value returned is -1. See Also ComboBoxEditor Class | ComboBoxEditor Members | C1.Win.C1FlexGrid Namespace

ComboBoxEditor.SelectedItem Property
Gets or sets the selected item in the currently active ComboBox editor. [Visual Basic] Public Property SelectedItem As Object [C#] public object SelectedItem {get;set;} [Delphi] public property SelectedItem: Object read get_SelectedItem write set_SelectedItem; Remarks If there's no active editor, or if the editor is not a ComboBox, the value returned is null. See Also ComboBoxEditor Class | ComboBoxEditor Members | C1.Win.C1FlexGrid Namespace

ComboBoxEditor.SelectedKey Property
Gets the key that corresponds to the selected item in the currently active ComboBox editor. [Visual Basic] Public ReadOnly Property SelectedKey As Object

DisplayEnum Enumeration 609

[C#] public object SelectedKey {get;} [Delphi] public property SelectedKey: Object read get_SelectedKey; Remarks If there's no active editor, if the editor is not a ComboBox, or if the cell being edited does not have an associated DataMap, the value returned is null. See Also ComboBoxEditor Class | ComboBoxEditor Members | C1.Win.C1FlexGrid Namespace

DisplayEnum Enumeration
Specifies whether a style should display the cell text, image, both, or none. [Visual Basic] Public Enum DisplayEnum [C#] public enum DisplayEnum [Delphi] type DisplayEnum = (ImageOnly, None, Overlay, Stack, TextOnly); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name ImageOnly None Overlay Stack TextOnly See Also C1.Win.C1FlexGrid Namespace Description Display image only (no text). Nothing (cell stays blank). Display the text over the image. Display the text next to the image. Display text only (no image).

DragModeEnum Enumeration
Specifies the behavior of the control as an OLE drag-drop source. [Visual Basic] Public Enum DragModeEnum

610 C1.Win.C1FlexGrid Namespace

[C#] public enum DragModeEnum [Delphi] type DragModeEnum = (Automatic, AutomaticCopy, AutomaticMove, Manual); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Automatic Description The control provides automatic dragging of data. If the mouse hovers near the edges of the selected range, the cursor will change and allow the user to move or copy data (pressing the CTRL key to copy). Same as Automatic, except the data is always copied (never moved). Same as Automatic, except the data is always moved (never copied). The control does not provide any drag support. The caller can still initiate drag-drop operations using the DoDragDrop method.

AutomaticCopy AutomaticMove Manual

See Also C1.Win.C1FlexGrid Namespace

DragRowColEventArgs Class
Provides data for the C1FlexGridBase.BeforeDragColumn, C1FlexGridBase.BeforeDragRow, C1FlexGridBase.AfterDragColumn, and C1FlexGridBase.AfterDragRow events. For a list of all members of this type, see DragRowColEventArgs Members. System.Object System.EventArgs C1.Win.C1FlexGrid.DragRowColEventArgs [Visual Basic] Public Class DragRowColEventArgs Inherits EventArgs [C#] public class DragRowColEventArgs : EventArgs [Delphi] type DragRowColEventArgs = class (EventArgs); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll)

DragRowColEventArgs Members 611

See Also DragRowColEventArgs Members | C1.Win.C1FlexGrid Namespace

DragRowColEventArgs Members
DragRowColEventArgs overview Public Constructors DragRowColEventArgs Constructor Public Fields Cancel Col Position Row See Also DragRowColEventArgs Class | C1.Win.C1FlexGrid Namespace Gets or sets a value indicating whether the drag operation should be canceled. Gets the original index of the column that was dragged by the user. Gets the new index of the column or row that was dragged by the user. Gets the original index of the row that was dragged by the user. Initializes a new instance of the DragRowColEventArgs class.

DragRowColEventArgs Constructor
Initializes a new instance of the DragRowColEventArgs class. [Visual Basic] Public Function New( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal position As Integer _ ) [C#] public int int int );

DragRowColEventArgs( row, col, position

[Delphi] public constructor Create( row: Int32; col: Int32; position: Int32 ); Parameters row The original index of the row that was dragged by the user.

612 C1.Win.C1FlexGrid Namespace

col The original index of the column that was dragged by the user. position The new index of the column or row. See Also DragRowColEventArgs Class | DragRowColEventArgs Members | C1.Win.C1FlexGrid Namespace

DragRowColEventArgs Fields
The fields of the DragRowColEventArgs class are listed here. For a complete list of DragRowColEventArgs class members, see the DragRowColEventArgs Members topic. Public Fields Cancel Col Position Row See Also DragRowColEventArgs Class | C1.Win.C1FlexGrid Namespace Gets or sets a value indicating whether the drag operation should be canceled. Gets the original index of the column that was dragged by the user. Gets the new index of the column or row that was dragged by the user. Gets the original index of the row that was dragged by the user.

DragRowColEventArgs.Cancel Field
Gets or sets a value indicating whether the drag operation should be canceled. [Visual Basic] Public Cancel As Boolean [C#] public bool Cancel [Delphi] public Cancel: Boolean; See Also DragRowColEventArgs Class | DragRowColEventArgs Members | C1.Win.C1FlexGrid Namespace

DragRowColEventArgs.Col Field
Gets the original index of the column that was dragged by the user. [Visual Basic] Public ReadOnly Col As Integer [C#] public readonly int Col

DragRowColEventArgs.Position Field 613

[Delphi] public Col: Int32; See Also DragRowColEventArgs Class | DragRowColEventArgs Members | C1.Win.C1FlexGrid Namespace

DragRowColEventArgs.Position Field
Gets the new index of the column or row that was dragged by the user. [Visual Basic] Public Position As Integer [C#] public int Position [Delphi] public Position: Int32; See Also DragRowColEventArgs Class | DragRowColEventArgs Members | C1.Win.C1FlexGrid Namespace

DragRowColEventArgs.Row Field
Gets the original index of the row that was dragged by the user. [Visual Basic] Public ReadOnly Row As Integer [C#] public readonly int Row [Delphi] public Row: Int32; See Also DragRowColEventArgs Class | DragRowColEventArgs Members | C1.Win.C1FlexGrid Namespace

DragRowColEventHandler Delegate
Represents the method that will handle the C1FlexGridBase.BeforeDragColumn, C1FlexGridBase.BeforeDragRow, C1FlexGridBase.AfterDragColumn and C1FlexGridBase.AfterDragRow events. [Visual Basic] Public Delegate Sub DragRowColEventHandler( _ ByVal sender As Object, _ ByVal e As DragRowColEventArgs _ )

614 C1.Win.C1FlexGrid Namespace

[C#] public delegate void DragRowColEventHandler( object sender, DragRowColEventArgs e ); [Delphi] type DragRowColEventHandler = procedure ( sender: Object; e: DragRowColEventArgs ) of object; Parameters sender Object that fired the event. e DragRowColEventArgs object that contains the event data. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also C1.Win.C1FlexGrid Namespace

DrawCellFlags Enumeration
Specifies which elements of the cell should be drawn by the grid. [Visual Basic] Public Enum DrawCellFlags [C#] public enum DrawCellFlags [Delphi] type DrawCellFlags = (All, Background, Border, Content); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Remarks This enumeration is used when rendering owner-drawn cells. If you set the Windows.Forms.DrawMode property to DrawModeEnum.OwnerDraw, the grid will fire the C1FlexGridBase.OwnerDrawCell event to allow custom cell drawing. The OwnerDrawCellEventArgs parameter passed to the event handler has a OwnerDrawCellEventArgs.DrawCell method that allows you to use the standard drawing routines for rendering parts of the cell. For example, you can paint a custom background and use the standard drawing routines for the cell borders and content. See the C1FlexGridBase.OwnerDrawCell event for an example.

DrawModeEnum Enumeration 615

Members Member name All Background Border Content See Also C1.Win.C1FlexGrid Namespace Description Draw all cell elements (background, border, and contents). Draw the cell background. Draw the cell border. Draw the cell content (text, images, checkboxes, and so on).

DrawModeEnum Enumeration
Specifies whether cells should be drawn entirely by the grid or with help from custom drawing code. [Visual Basic] Public Enum DrawModeEnum [C#] public enum DrawModeEnum [Delphi] type DrawModeEnum = (Normal, OwnerDraw); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Normal OwnerDraw See Also C1.Win.C1FlexGrid Namespace Description Grid cells are drawn by the grid. The grid fires the C1FlexGridBase.OwnerDrawCell event to allow custom cell drawing.

DropModeEnum Enumeration
Specifies the behavior of the control as an OLE drag-drop target. [Visual Basic] Public Enum DropModeEnum [C#] public enum DropModeEnum [Delphi] type DropModeEnum = (Automatic, Manual, None);

616 C1.Win.C1FlexGrid Namespace

Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Automatic Manual None See Also C1.Win.C1FlexGrid Namespace Description The control automatically handles dropping of text or filename data. The control fires drag-drop events that can be handled to provide drop target functionality. The control can't be used as a drop target.

EditFlags Enumeration
Specifies options that customize the grid's editing behavior. [Visual Basic] Public Enum EditFlags [C#] public enum EditFlags [Delphi] type EditFlags = (All, AutoSearch, CycleOnDoubleClick, DelayedCommit, MultiCheck, None, UseNumericEditor); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name All AutoSearch CycleOnDoubleClick DelayedCommit MultiCheck None UseNumericEditor See Also C1.Win.C1FlexGrid Namespace Description All of the above. Search for entries in lists as the user types. Cycle to the next item on the list when the user doubleclicks a cell. Commit changes to data source only when changing rows or moving focus. Check and uncheck all checkboxes in a selection simultaneously. No special behavior. Use built-in numeric editor when editing numeric types.

FileFlags Enumeration 617

FileFlags Enumeration
Specifies options for use with the C1FlexGridBase.SaveGrid and C1FlexGridBase.LoadGrid methods. [Visual Basic] Public Enum FileFlags [C#] public enum FileFlags [Delphi] type FileFlags = (AsDisplayed, IncludeFixedCells, IncludeMergedRanges, LoadMergedRanges, NoFreezing, None, SaveMergedRanges, SelectedRowsOnly, VisibleOnly); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name AsDisplayed Description Save values as displayed (including formatting and mapping where available). This flag has no effect when saving text files, which always contain values as displayed. Include fixed cells when loading or saving the grid. Save and load merged ranges when exporting to or importing from Excel with the C1FlexGridBase.SaveExcel and C1FlexGridBase.LoadExcel methods. Load merged ranges when importing from Excel with the C1FlexGridBase.LoadExcel method. This flag has no effect when loading text files, it only affects Excel input. Do not freeze rows and columns when exporting to or importing from Excel with the C1FlexGridBase.SaveExcel and C1FlexGridBase.LoadExcel methods. Use default settings. Save merged ranges when exporting to Excel with the C1FlexGridBase.SaveExcel method. This flag has no effect when saving text files, it only affects Excel output. Save only selected rows. Save only visible rows and columns.

IncludeFixedCells IncludeMergedRanges

LoadMergedRanges

NoFreezing

None SaveMergedRanges

SelectedRowsOnly VisibleOnly See Also C1.Win.C1FlexGrid Namespace

618 C1.Win.C1FlexGrid Namespace

FileFormatEnum Enumeration
Specifies the type of file to save or load with the C1FlexGridBase.SaveGrid and C1FlexGridBase.LoadGrid methods. [Visual Basic] Public Enum FileFormatEnum [C#] public enum FileFormatEnum [Delphi] type FileFormatEnum = (Excel, TextComma, TextCustom, TextTab); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Excel TextComma TextCustom TextTab See Also C1.Win.C1FlexGrid Namespace Description Microsoft Excel files (.xls, biff-8 format). Text file, cells separated with commas. Text file, cells separated with the character specified by the C1FlexGridBase.ClipSeparators property. Text file, cells separated with tabs.

FocusRectEnum Enumeration
Specifies the appearance of the focus rectangle. [Visual Basic] Public Enum FocusRectEnum [C#] public enum FocusRectEnum [Delphi] type FocusRectEnum = (Heavy, Inset, Light, None, Raised, Solid); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Heavy Inset Description Show a heavy focus rectangle (dotted, 2-pixel wide). Show an inset focus rectangle.

GetErrorInfoEventArgs Class 619

Member name Light None Raised Solid

Description Show a light focus rectangle (dotted, 1-pixel wide). This is the default setting. No focus rectangle. Show a raised focus rectangle. Show a solid focus rectangle. The color of the rectangle is determined by the BackColor property of the CellStyleCollection.Highlight style.

See Also C1.Win.C1FlexGrid Namespace

GetErrorInfoEventArgs Class
Provides data for the C1FlexGridBase.GetCellErrorInfo and C1FlexGridBase.GetRowErrorInfo events. For a list of all members of this type, see GetErrorInfoEventArgs Members. System.Object System.EventArgs C1.Win.C1FlexGrid.GetErrorInfoEventArgs [Visual Basic] Public Class GetErrorInfoEventArgs Inherits EventArgs [C#] public class GetErrorInfoEventArgs : EventArgs [Delphi] type GetErrorInfoEventArgs = class (EventArgs); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also GetErrorInfoEventArgs Members | C1.Win.C1FlexGrid Namespace

GetErrorInfoEventArgs Members
GetErrorInfoEventArgs overview Public Constructors GetErrorInfoEventArgs Constructor Public Fields Col ErrorText Gets the index of the column that may contain errors (or -1 if checking for row errors). Gets or sets a message that describes the error. Initializes a new instance of the GetErrorInfoEventArgs class.

620 C1.Win.C1FlexGrid Namespace

Row See Also

Gets the index of the row that may contain errors.

GetErrorInfoEventArgs Class | C1.Win.C1FlexGrid Namespace

GetErrorInfoEventArgs Constructor
Initializes a new instance of the GetErrorInfoEventArgs class. [Visual Basic] Public Function New( _ ByVal row As Integer, _ ByVal col As Integer _ ) [C#] public GetErrorInfoEventArgs( int row, int col ); [Delphi] public constructor Create( row: Int32; col: Int32 ); Parameters row The row index when error information is needed for a cell or row. col The column index when error information is needed for a cell or row. See Also GetErrorInfoEventArgs Class | GetErrorInfoEventArgs Members | C1.Win.C1FlexGrid Namespace

GetErrorInfoEventArgs Fields
The fields of the GetErrorInfoEventArgs class are listed here. For a complete list of GetErrorInfoEventArgs class members, see the GetErrorInfoEventArgs Members topic. Public Fields Col ErrorText Row See Also GetErrorInfoEventArgs Class | C1.Win.C1FlexGrid Namespace Gets the index of the column that may contain errors (or -1 if checking for row errors). Gets or sets a message that describes the error. Gets the index of the row that may contain errors.

GetErrorInfoEventArgs.Col Field 621

GetErrorInfoEventArgs.Col Field
Gets the index of the column that may contain errors (or -1 if checking for row errors). [Visual Basic] Public ReadOnly Col As Integer [C#] public readonly int Col [Delphi] public Col: Int32; See Also GetErrorInfoEventArgs Class | GetErrorInfoEventArgs Members | C1.Win.C1FlexGrid Namespace

GetErrorInfoEventArgs.ErrorText Field
Gets or sets a message that describes the error. [Visual Basic] Public ErrorText As String [C#] public string ErrorText [Delphi] public ErrorText: String; See Also GetErrorInfoEventArgs Class | GetErrorInfoEventArgs Members | C1.Win.C1FlexGrid Namespace

GetErrorInfoEventArgs.Row Field
Gets the index of the row that may contain errors. [Visual Basic] Public ReadOnly Row As Integer [C#] public readonly int Row [Delphi] public Row: Int32; See Also GetErrorInfoEventArgs Class | GetErrorInfoEventArgs Members | C1.Win.C1FlexGrid Namespace

GetErrorInfoEventHandler Delegate
Represents the method that will handle the C1FlexGridBase.GetCellErrorInfo and C1FlexGridBase.GetRowErrorInfo events.

622 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Delegate Sub GetErrorInfoEventHandler( _ ByVal sender As Object, _ ByVal e As GetErrorInfoEventArgs _ ) [C#] public delegate void GetErrorInfoEventHandler( object sender, GetErrorInfoEventArgs e ); [Delphi] type GetErrorInfoEventHandler = procedure ( sender: Object; e: GetErrorInfoEventArgs ) of object; Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also C1.Win.C1FlexGrid Namespace

GlyphEnum Enumeration
Specifies a type of glyph (image) used by the grid to convey information about a row, column, or cell. [Visual Basic] Public Enum GlyphEnum [C#] public enum GlyphEnum [Delphi] type GlyphEnum = (Ascending, Checked, Collapsed, DBAdd, DBCursor, Descending, ErrorInfo, Expanded, Grayed, Unchecked); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Ascending Checked Collapsed DBAdd DBCursor Description Indicates column sorted in ascending order (default is hollow triangle pointing up). Checkbox in checked state. Collapsed tree node (default is plus sign). Indicates row being added to data source (default is asterisk). Indicates current record (default is black triangle pointing right).

GridChangedEventArgs Class 623

Member name Descending ErrorInfo Expanded Grayed Unchecked See Also C1.Win.C1FlexGrid Namespace

Description Indicates column sorted in descending order (default is hollow triangle pointing down). Indicates row or cell error (default is red exclamation sign). Expanded tree node (default is minus sign). Checkbox in gray (undefined) state. Checkbox in unchecked state.

GridChangedEventArgs Class
Provides data for the C1FlexGridBase.GridChanged event handler. For a list of all members of this type, see GridChangedEventArgs Members. System.Object System.EventArgs C1.Win.C1FlexGrid.GridChangedEventArgs [Visual Basic] Public Class GridChangedEventArgs Inherits EventArgs [C#] public class GridChangedEventArgs : EventArgs [Delphi] type GridChangedEventArgs = class (EventArgs); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also GridChangedEventArgs Members | C1.Win.C1FlexGrid Namespace

GridChangedEventArgs Members
GridChangedEventArgs overview Public Fields c1 c2 GridChangedType r1 r2 Range of cells affected by the event. Range of cells affected by the event. The type of action that caused the event to fire. Range of cells affected by the event. Range of cells affected by the event.

624 C1.Win.C1FlexGrid Namespace

See Also GridChangedEventArgs Class | C1.Win.C1FlexGrid Namespace

GridChangedEventArgs Fields
The fields of the GridChangedEventArgs class are listed here. For a complete list of GridChangedEventArgs class members, see the GridChangedEventArgs Members topic. Public Fields c1 c2 GridChangedType r1 r2 See Also GridChangedEventArgs Class | C1.Win.C1FlexGrid Namespace Range of cells affected by the event. Range of cells affected by the event. The type of action that caused the event to fire. Range of cells affected by the event. Range of cells affected by the event.

GridChangedEventArgs.c1 Field
Range of cells affected by the event. [Visual Basic] Public ReadOnly c1 As Integer [C#] public readonly int c1 [Delphi] public c1: Int32; See Also GridChangedEventArgs Class | GridChangedEventArgs Members | C1.Win.C1FlexGrid Namespace

GridChangedEventArgs.c2 Field
Range of cells affected by the event. [Visual Basic] Public ReadOnly c2 As Integer [C#] public readonly int c2 [Delphi] public c2: Int32; See Also GridChangedEventArgs Class | GridChangedEventArgs Members | C1.Win.C1FlexGrid Namespace

GridChangedEventArgs.GridChangedType Field 625

GridChangedEventArgs.GridChangedType Field
The type of action that caused the event to fire. [Visual Basic] Public ReadOnly GridChangedType As GridChangedTypeEnum [C#] public readonly GridChangedTypeEnum GridChangedType [Delphi] public GridChangedType: GridChangedTypeEnum; See Also GridChangedEventArgs Class | GridChangedEventArgs Members | C1.Win.C1FlexGrid Namespace

GridChangedEventArgs.r1 Field
Range of cells affected by the event. [Visual Basic] Public ReadOnly r1 As Integer [C#] public readonly int r1 [Delphi] public r1: Int32; See Also GridChangedEventArgs Class | GridChangedEventArgs Members | C1.Win.C1FlexGrid Namespace

GridChangedEventArgs.r2 Field
Range of cells affected by the event. [Visual Basic] Public ReadOnly r2 As Integer [C#] public readonly int r2 [Delphi] public r2: Int32; See Also GridChangedEventArgs Class | GridChangedEventArgs Members | C1.Win.C1FlexGrid Namespace

GridChangedEventHandler Delegate
Represents the method that will handle the C1FlexGridBase.GridChanged event.

626 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Delegate Sub GridChangedEventHandler( _ ByVal sender As Object, _ ByVal e As GridChangedEventArgs _ ) [C#] public delegate void GridChangedEventHandler( object sender, GridChangedEventArgs e ); [Delphi] type GridChangedEventHandler = procedure ( sender: Object; e: GridChangedEventArgs ) of object; Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also C1.Win.C1FlexGrid Namespace

GridChangedTypeEnum Enumeration
Specifies the type of change that occurred when the controls fires the C1FlexGridBase.GridChanged event. [Visual Basic] Public Enum GridChangedTypeEnum [C#] public enum GridChangedTypeEnum [Delphi] type GridChangedTypeEnum = (AfterCollapse, AfterSelChange, BeforeCollapse, BeforeSelChange, ColAdded, ColMoved, ColRemoved, ColSelected, EnsureVisible, GridChanged, LayoutChanged, None, RepaintCell, RepaintGrid, RepaintRange, RowAdded, RowMoved, RowRemoved, RowSelected, Select, StyleApplied, StyleChanged, Update); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name AfterCollapse AfterSelChange BeforeCollapse BeforeSelChange ColAdded Description A tree node has just been collapsed or expanded. The selection has just changed. A tree node is about to be collapsed or expanded. The selection is about to change. A column has been added to the grid.

GridErrorEventArgs Class 627

Member name ColMoved ColRemoved ColSelected EnsureVisible GridChanged LayoutChanged None RepaintCell RepaintGrid RepaintRange RowAdded RowMoved RowRemoved RowSelected Select StyleApplied StyleChanged Update See Also C1.Win.C1FlexGrid Namespace

Description A column has been moved into a new position. A column has been removed from the grid. A column has been selected or de-selected. A tree node will be scrolled into view. The number of grid rows or columns has changed. The number of fixed grid rows or columns has changed. No action. The value in a cell has changed. The grid has been invalidated and will be repainted. A range has been invalidated and will be repainted. A row has been added to the grid. A row has been moved into a new position. A row has been removed from the grid. A row has been selected or de-selected. A tree node will be selected. A style has been applied to a range. A style definition has changed. The grid will be repainted.

GridErrorEventArgs Class
Provides data for the C1FlexGridBase.GridError event. For a list of all members of this type, see GridErrorEventArgs Members. System.Object System.EventArgs C1.Win.C1FlexGrid.GridErrorEventArgs [Visual Basic] Public Class GridErrorEventArgs Inherits EventArgs [C#] public class GridErrorEventArgs : EventArgs [Delphi] type GridErrorEventArgs = class (EventArgs); Namespace: C1.Win.C1FlexGrid

628 C1.Win.C1FlexGrid Namespace

Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also GridErrorEventArgs Members | C1.Win.C1FlexGrid Namespace

GridErrorEventArgs Members
GridErrorEventArgs overview Public Constructors GridErrorEventArgs Constructor Public Fields Col Exception Handled Row See Also GridErrorEventArgs Class | C1.Win.C1FlexGrid Namespace Gets the column index of the cell where the error was detected. Gets the Exception object that contains information about the error. Gets or sets a value indicating whether the error situation has been handled by the control. Gets the row index of the cell where the error was detected. Initializes a new instance of the GridErrorEventArgs class.

GridErrorEventArgs Constructor
Initializes a new instance of the GridErrorEventArgs class. [Visual Basic] Public Function New( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal exception As Exception, _ ByVal handled As Boolean _ ) [C#] public GridErrorEventArgs( int row, int col, Exception exception, bool handled );

GridErrorEventArgs Fields 629

[Delphi] public constructor Create( row: Int32; col: Int32; exception: Exception; handled: Boolean ); Parameters row The row index of the cell where the error was detected. col The column index of the cell where the error was detected. exception The Exception object that contains information about the error. handled Whether the error was handled internally and no exception should be thrown. See Also GridErrorEventArgs Class | GridErrorEventArgs Members | C1.Win.C1FlexGrid Namespace

GridErrorEventArgs Fields
The fields of the GridErrorEventArgs class are listed here. For a complete list of GridErrorEventArgs class members, see the GridErrorEventArgs Members topic. Public Fields Col Exception Handled Row See Also GridErrorEventArgs Class | C1.Win.C1FlexGrid Namespace Gets the column index of the cell where the error was detected. Gets the Exception object that contains information about the error. Gets or sets a value indicating whether the error situation has been handled by the control. Gets the row index of the cell where the error was detected.

GridErrorEventArgs.Col Field
Gets the column index of the cell where the error was detected. [Visual Basic] Public ReadOnly Col As Integer [C#] public readonly int Col

630 C1.Win.C1FlexGrid Namespace

[Delphi] public Col: Int32; See Also GridErrorEventArgs Class | GridErrorEventArgs Members | C1.Win.C1FlexGrid Namespace

GridErrorEventArgs.Exception Field
Gets the Exception object that contains information about the error. [Visual Basic] Public ReadOnly Exception As Exception [C#] public readonly Exception Exception [Delphi] public Exception: Exception; See Also GridErrorEventArgs Class | GridErrorEventArgs Members | C1.Win.C1FlexGrid Namespace

GridErrorEventArgs.Handled Field
Gets or sets a value indicating whether the error situation has been handled by the control. [Visual Basic] Public Handled As Boolean [C#] public bool Handled [Delphi] public Handled: Boolean; Remarks If this value is set to False, the grid will throw the exception. See Also GridErrorEventArgs Class | GridErrorEventArgs Members | C1.Win.C1FlexGrid Namespace

GridErrorEventArgs.Row Field
Gets the row index of the cell where the error was detected. [Visual Basic] Public ReadOnly Row As Integer [C#] public readonly int Row [Delphi] public Row: Int32;

GridErrorEventHandler Delegate 631

See Also GridErrorEventArgs Class | GridErrorEventArgs Members | C1.Win.C1FlexGrid Namespace

GridErrorEventHandler Delegate
Represents the method that will handle the C1FlexGridBase.GridError event. [Visual Basic] Public Delegate Sub GridErrorEventHandler( _ ByVal sender As Object, _ ByVal e As GridErrorEventArgs _ ) [C#] public delegate void GridErrorEventHandler( object sender, GridErrorEventArgs e ); [Delphi] type GridErrorEventHandler = procedure ( sender: Object; e: GridErrorEventArgs ) of object; Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also C1.Win.C1FlexGrid Namespace

GridGlyphs Class
Represents a collection of glyphs (images) indexed by glyph type ( GlyphEnum type). For a list of all members of this type, see GridGlyphs Members. System.Object C1.Win.C1FlexGrid.GridGlyphs [Visual Basic] Public Class GridGlyphs [C#] public class GridGlyphs [Delphi] type GridGlyphs = class; Remarks The GridGlyphs collection contains the images used by the grid to indicate column sorting direction, collapsed and expanded outline groups, checkboxes, cursors, error information, and so on.

632 C1.Win.C1FlexGrid Namespace

You can use the C1FlexGridBase.Glyphs property get or set these images. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also GridGlyphs Members | C1.Win.C1FlexGrid Namespace

GridGlyphs Members
GridGlyphs overview Public Properties Item See Also GridGlyphs Class | C1.Win.C1FlexGrid Namespace Gets or sets the glyph for a particular GlyphEnum value.

GridGlyphs Properties
The properties of the GridGlyphs class are listed here. For a complete list of GridGlyphs class members, see the GridGlyphs Members topic. Public Properties Item See Also GridGlyphs Class | C1.Win.C1FlexGrid Namespace Gets or sets the glyph for a particular GlyphEnum value.

GridGlyphs.Item Property
Gets or sets the glyph for a particular GlyphEnum value. [Visual Basic] Public Default Property Item( _ ByVal glyph As GlyphEnum _ ) As Image [C#] public Image this[ GlyphEnum glyph ] {get;set;} [Delphi] public property Item[ glyph: GlyphEnum ]: Image read get_Item write set_Item; Remarks Setting a glyph to null causes the grid to use the default image for the glyph. To suppress a glyph, assign it a small transparent image.

GridPrinter Class 633

See Also GridGlyphs Class | GridGlyphs Members | C1.Win.C1FlexGrid Namespace

GridPrinter Class
The GridPrinter class encapsulates properties that control printing, such as page and printer settings. For a list of all members of this type, see GridPrinter Members. System.Object C1.Win.C1FlexGrid.GridPrinter [Visual Basic] Public Class GridPrinter [C#] public class GridPrinter [Delphi] type GridPrinter = class; Remarks See also the C1FlexGridBase.PrintGrid method. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also GridPrinter Members | C1.Win.C1FlexGrid Namespace

GridPrinter Members
GridPrinter overview Public Properties Footer FooterFont Header HeaderFont PageCount PageNumber PrintDocument PrintGridFlags Gets or sets a string that contains the page footers. Specifies the font to use for rendering page footers. Gets or sets a string that contains the page headers. Specifies the font to use for rendering page headers. Gets the total number of the pages in the print document. Gets the number of the page being printed (one-based count). Gets the Drawing.Printing.PrintDocument object that specifies page and printer settings. Gets or sets the flags that specify printing options to use with the C1FlexGridBase.PrintGrid method. See the PrintGridFlags enumeration for details.

634 C1.Win.C1FlexGrid Namespace

PrintPreviewDialog See Also GridPrinter Class | C1.Win.C1FlexGrid Namespace

Gets a reference to the PrintPreviewDialog used to display the grid's print preview.

GridPrinter Properties
The properties of the GridPrinter class are listed here. For a complete list of GridPrinter class members, see the GridPrinter Members topic. Public Properties Footer FooterFont Header HeaderFont PageCount PageNumber PrintDocument PrintGridFlags Gets or sets a string that contains the page footers. Specifies the font to use for rendering page footers. Gets or sets a string that contains the page headers. Specifies the font to use for rendering page headers. Gets the total number of the pages in the print document. Gets the number of the page being printed (one-based count). Gets the Drawing.Printing.PrintDocument object that specifies page and printer settings. Gets or sets the flags that specify printing options to use with the C1FlexGridBase.PrintGrid method. See the PrintGridFlags enumeration for details. Gets a reference to the PrintPreviewDialog used to display the grid's print preview.

PrintPreviewDialog See Also GridPrinter Class | C1.Win.C1FlexGrid Namespace

GridPrinter.Footer Property
Gets or sets a string that contains the page footers. [Visual Basic] Public Property Footer As String [C#] public string Footer {get;set;} [Delphi] public property Footer: String read get_Footer write set_Footer; Remarks The string may be divided by tab characters into up to three sections. The sections are then left, center, and right-aligned at the top of each page. The string may contain placeholders "{0}" and "{1}" which are replaced with the current page number and total page count.

GridPrinter.FooterFont Property 635

Use the FooterFont property to select the font used to render the footer. See Also GridPrinter Class | GridPrinter Members | C1.Win.C1FlexGrid Namespace

GridPrinter.FooterFont Property
Specifies the font to use for rendering page footers. [Visual Basic] Public Property FooterFont As Font [C#] public Font FooterFont {get;set;} [Delphi] public property FooterFont: Font read get_FooterFont write set_FooterFont; Remarks See also the Footer property. See Also GridPrinter Class | GridPrinter Members | C1.Win.C1FlexGrid Namespace

GridPrinter.Header Property
Gets or sets a string that contains the page headers. [Visual Basic] Public Property Header As String [C#] public string Header {get;set;} [Delphi] public property Header: String read get_Header write set_Header; Remarks The string may be divided by tab characters into up to three sections. The sections are then left, center, and right-aligned at the top of each page. The string may contain placeholders "{0}" and "{1}" which are replaced with the current page number and total page count. Use the HeaderFont property to select the font used to render the header. Example The code below specifies a right-aligned header with a "Page n of m" display using a 10-point Tahoma font. Visual Basic _flex.Header = "\t\tPage {0} of {1}" _flex.HeaderFont = New Font("Tahoma", 10) _flex.PrintGrid("Header")

636 C1.Win.C1FlexGrid Namespace

C# _flex.Header = "\t\tPage {0} of {1}"; _flex.HeaderFont = new Font("Tahoma", 10); _flex.PrintGrid("Header"); Delphi _flex.Header := ''#9#9'Page {0} of {1}'; _flex.HeaderFont := Font.Create('Tahoma', 10); _flex.PrintGrid('Header');

See Also GridPrinter Class | GridPrinter Members | C1.Win.C1FlexGrid Namespace

GridPrinter.HeaderFont Property
Specifies the font to use for rendering page headers. [Visual Basic] Public Property HeaderFont As Font [C#] public Font HeaderFont {get;set;} [Delphi] public property HeaderFont: Font read get_HeaderFont write set_HeaderFont; Remarks See also the Header property. See Also GridPrinter Class | GridPrinter Members | C1.Win.C1FlexGrid Namespace

GridPrinter.PageCount Property
Gets the total number of the pages in the print document. [Visual Basic] Public ReadOnly Property PageCount As Integer [C#] public int PageCount {get;} [Delphi] public property PageCount: Int32 read get_PageCount; Remarks The value returned is accurate only while the document is printing. Before or after a document is done printing, this property returns zero. See Also GridPrinter Class | GridPrinter Members | C1.Win.C1FlexGrid Namespace

GridPrinter.PageNumber Property
Gets the number of the page being printed (one-based count).

GridPrinter.PrintDocument Property 637

[Visual Basic] Public ReadOnly Property PageNumber As Integer [C#] public int PageNumber {get;} [Delphi] public property PageNumber: Int32 read get_PageNumber; See Also GridPrinter Class | GridPrinter Members | C1.Win.C1FlexGrid Namespace

GridPrinter.PrintDocument Property
Gets the Drawing.Printing.PrintDocument object that specifies page and printer settings. [Visual Basic] Public ReadOnly Property PrintDocument As PrintDocument [C#] public PrintDocument PrintDocument {get;} [Delphi] public property PrintDocument: PrintDocument read get_PrintDocument; See Also GridPrinter Class | GridPrinter Members | C1.Win.C1FlexGrid Namespace

GridPrinter.PrintGridFlags Property
Gets or sets the flags that specify printing options to use with the C1FlexGridBase.PrintGrid method. See the PrintGridFlags enumeration for details. [Visual Basic] Public Property PrintGridFlags As PrintGridFlags [C#] public PrintGridFlags PrintGridFlags {get;set;} [Delphi] public property PrintGridFlags: PrintGridFlags read get_PrintGridFlags write set_PrintGridFlags; See Also GridPrinter Class | GridPrinter Members | C1.Win.C1FlexGrid Namespace

GridPrinter.PrintPreviewDialog Property
Gets a reference to the PrintPreviewDialog used to display the grid's print preview. [Visual Basic] Public ReadOnly Property PrintPreviewDialog As PrintPreviewDialog

638 C1.Win.C1FlexGrid Namespace

[C#] public PrintPreviewDialog PrintPreviewDialog {get;} [Delphi] public property PrintPreviewDialog: PrintPreviewDialog read get_PrintPreviewDialog; Remarks Use this property to customize the size and position of the preview dialog when printing the grid with the PrintGridFlags.ShowPrintDialog option. Example The code below uses the PrintPreviewDialog property to display the preview dialog with a custom caption and in a maximized state: Visual Basic Dim dlg As Form = _flex.PrintParameters.PrintPreviewDialog as Form dlg.Text = "Custom Caption" dlg.StartPosition = FormStartPosition.Manual dlg.WindowState = FormWindowState.Maximized _flex.PrintGrid("test", PrintGridFlags.ShowPreviewDialog) C# Form dlg = _flex.PrintParameters.PrintPreviewDialog as Form; dlg.Text = "Custom Caption"; dlg.StartPosition = FormStartPosition.Manual; dlg.WindowState = FormWindowState.Maximized; _flex.PrintGrid("test", PrintGridFlags.ShowPreviewDialog); Delphi var dlg: PrintPreviewDialog; begin dlg := _flex.PrintParameters.PrintPreviewDialog; dlg.Text := 'Custom Caption'; dlg.StartPosition := FormStartPosition.Manual; dlg.WindowState := FormWindowState.Maximized; _flex.PrintGrid('test', PrintGridFlags.ShowPreviewDialog); end;

See Also GridPrinter Class | GridPrinter Members | C1.Win.C1FlexGrid Namespace

GridTree Class
The GridTree class enapsulates properties that specify the appearance, position, and behavior of the outline tree. For a list of all members of this type, see GridTree Members. System.Object C1.Win.C1FlexGrid.GridTree [Visual Basic] Public Class GridTree

GridTree Members 639

[C#] public class GridTree [Delphi] type GridTree = class; Remarks Each grid has a single GridTree object, which can be obtained using the C1FlexGridBase.Tree property. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also GridTree Members | C1.Win.C1FlexGrid Namespace

GridTree Members
GridTree overview Public Properties Column Indent LineColor LineStyle MaximumLevel NodeImageCollapsed NodeImageExpanded Style Public Methods Clear Show Sort See Also GridTree Class | C1.Win.C1FlexGrid Namespace Resets the C1FlexGridBase.Tree object. Expands all nodes up to the specified level, collapses others. Sorts all nodes at the given level. Gets or sets the index of the column where the outline tree is displayed. Gets or sets the indentation, in pixels, of each tree level. Gets or sets the color of the lines in the outline tree. Gets or sets the line style used to draw the outline tree. Gets the level of the deepest node in the outline. Gets or sets the image displayed next to collapsed nodes. Gets or sets the image displayed next to expanded nodes. Gets or sets the style of the outline tree.

GridTree Properties
The properties of the GridTree class are listed here. For a complete list of GridTree class members, see the GridTree Members topic. Public Properties Column Gets or sets the index of the column where the outline tree is displayed.

640 C1.Win.C1FlexGrid Namespace

Indent LineColor LineStyle MaximumLevel NodeImageCollapsed NodeImageExpanded Style See Also GridTree Class | C1.Win.C1FlexGrid Namespace

Gets or sets the indentation, in pixels, of each tree level. Gets or sets the color of the lines in the outline tree. Gets or sets the line style used to draw the outline tree. Gets the level of the deepest node in the outline. Gets or sets the image displayed next to collapsed nodes. Gets or sets the image displayed next to expanded nodes. Gets or sets the style of the outline tree.

GridTree.Column Property
Gets or sets the index of the column where the outline tree is displayed. [Visual Basic] Public Property Column As Integer [C#] public int Column {get;set;} [Delphi] public property Column: Int32 read get_Column write set_Column; Remarks By default, this property is set to -1, which causes the tree to be hidden. See Also GridTree Class | GridTree Members | C1.Win.C1FlexGrid Namespace

GridTree.Indent Property
Gets or sets the indentation, in pixels, of each tree level. [Visual Basic] Public Property Indent As Integer [C#] public int Indent {get;set;} [Delphi] public property Indent: Int32 read get_Indent write set_Indent; Remarks If you set the Indent property to a value that is too narrow to fit the NodeImageCollapsed and NodeImageExpanded images, the grid will adjust it to fit the images. See Also GridTree Class | GridTree Members | C1.Win.C1FlexGrid Namespace

GridTree.LineColor Property 641

GridTree.LineColor Property
Gets or sets the color of the lines in the outline tree. [Visual Basic] Public Property LineColor As Color [C#] public Color LineColor {get;set;} [Delphi] public property LineColor: Color read get_LineColor write set_LineColor; Remarks See also the Style property. See Also GridTree Class | GridTree Members | C1.Win.C1FlexGrid Namespace

GridTree.LineStyle Property
Gets or sets the line style used to draw the outline tree. [Visual Basic] Public Property LineStyle As DashStyle [C#] public DashStyle LineStyle {get;set;} [Delphi] public property LineStyle: DashStyle read get_LineStyle write set_LineStyle; See Also GridTree Class | GridTree Members | C1.Win.C1FlexGrid Namespace

GridTree.MaximumLevel Property
Gets the level of the deepest node in the outline. [Visual Basic] Public ReadOnly Property MaximumLevel As Integer [C#] public int MaximumLevel {get;} [Delphi] public property MaximumLevel: Int32 read get_MaximumLevel; Remarks This property can be used with methods that take an outline level as a parameter (for example, Sort and Show). See Also GridTree Class | GridTree Members | C1.Win.C1FlexGrid Namespace

642 C1.Win.C1FlexGrid Namespace

GridTree.NodeImageCollapsed Property
Gets or sets the image displayed next to collapsed nodes. [Visual Basic] Public Property NodeImageCollapsed As Image [C#] public Image NodeImageCollapsed {get;set;} [Delphi] public property NodeImageCollapsed: Image read get_NodeImageCollapsed write set_NodeImageCollapsed; Remarks Setting this property to null resets it and causes the grid to use the default image (a plus sign). To hide the images, use the Style property. See Also GridTree Class | GridTree Members | C1.Win.C1FlexGrid Namespace

GridTree.NodeImageExpanded Property
Gets or sets the image displayed next to expanded nodes. [Visual Basic] Public Property NodeImageExpanded As Image [C#] public Image NodeImageExpanded {get;set;} [Delphi] public property NodeImageExpanded: Image read get_NodeImageExpanded write set_NodeImageExpanded; Remarks Setting this property to null resets it and causes the grid to use the default image (a minus sign). To hide the images, use the Style property. See Also GridTree Class | GridTree Members | C1.Win.C1FlexGrid Namespace

GridTree.Style Property
Gets or sets the style of the outline tree. [Visual Basic] Public Property Style As TreeStyleFlags [C#] public TreeStyleFlags Style {get;set;}

GridTree Methods 643

[Delphi] public property Style: TreeStyleFlags read get_Style write set_Style; Remarks Use the Style property to determine whether the outline tree should include lines connecting the nodes and buttons for collapsing and expanding the nodes. See the TreeStyleFlags enumeration for details. Use the Column property to determine where the grid will show the outline tree. See Also GridTree Class | GridTree Members | C1.Win.C1FlexGrid Namespace

GridTree Methods
The methods of the GridTree class are listed here. For a complete list of GridTree class members, see the GridTree Members topic. Public Methods Clear Show Sort See Also GridTree Class | C1.Win.C1FlexGrid Namespace Resets the C1FlexGridBase.Tree object. Expands all nodes up to the specified level, collapses others. Sorts all nodes at the given level.

GridTree.Clear Method
Resets the C1FlexGridBase.Tree object. [Visual Basic] Public Sub Clear() [C#] public void Clear() [Delphi] public procedure Clear(); See Also GridTree Class | GridTree Members | C1.Win.C1FlexGrid Namespace

GridTree.Show Method
Expands all nodes up to the specified level, collapses others. [Visual Basic] Public Sub Show( _ ByVal level As Integer _ )

644 C1.Win.C1FlexGrid Namespace

[C#] public void Show( int level ); [Delphi] public procedure Show( level: Int32 ); Parameters level The level to show. Any nodes with Node.Level higher than this will be collapsed, others will be expanded. See Also GridTree Class | GridTree Members | C1.Win.C1FlexGrid Namespace

GridTree.Sort Method
Sorts all nodes at the given level. [Visual Basic] Public Sub Sort( _ ByVal level As Integer, _ ByVal order As SortFlags, _ ByVal col1 As Integer, _ ByVal col2 As Integer _ ) [C#] public void Sort( int level, SortFlags order, int col1, int col2 ); [Delphi] public procedure Sort( level: Int32; order: SortFlags; col1: Int32; col2: Int32 ); Parameters level Level of the nodes to sort. order SortFlags value that controls sort direction and options. col1 Start of the range of columns to sort.

HighLightEnum Enumeration 645

col2 End of the range of columns to sort. See Also GridTree Class | GridTree Members | C1.Win.C1FlexGrid Namespace

HighLightEnum Enumeration
Specifies whether the grid should highlight the selected range. [Visual Basic] Public Enum HighLightEnum [C#] public enum HighLightEnum [Delphi] type HighLightEnum = (Always, Never, WithFocus); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Always Never WithFocus See Also C1.Win.C1FlexGrid Namespace Description Always highlight the selected range. Never highlight the selected range. Highlight the selected range when the control has focus.

HitTestInfo Structure
HitTestInfo contains information about the control at a point on the screen (it returned by the C1FlexGridBase.HitTest method). For a list of all members of this type, see HitTestInfo Members. System.Object System.ValueType C1.Win.C1FlexGrid.HitTestInfo [Visual Basic] Public Structure HitTestInfo [C#] public struct HitTestInfo [Delphi] type HitTestInfo = record;

646 C1.Win.C1FlexGrid Namespace

Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also HitTestInfo Members | C1.Win.C1FlexGrid Namespace

HitTestInfo Members
HitTestInfo overview Public Fields Column Row Type X Y See Also HitTestInfo Structure | C1.Win.C1FlexGrid Namespace Get the index of the column at the point being tested (if the point does not correspond to a cell, it returns -1). Get the index of the row at the point being tested (if the point does not correspond to a cell, it returns -1). Gets the type of element at the point being tested. Please see HitTestTypeEnum for details. The X coordinate of a point on the control surface, in pixels. The Y coordinate of a point on the control surface, in pixels.

HitTestInfo Fields
The fields of the HitTestInfo structure are listed here. For a complete list of HitTestInfo structure members, see the HitTestInfo Members topic. Column Row Type X Y See Also HitTestInfo Structure | C1.Win.C1FlexGrid Namespace Get the index of the column at the point being tested (if the point does not correspond to a cell, it returns -1). Get the index of the row at the point being tested (if the point does not correspond to a cell, it returns -1). Gets the type of element at the point being tested. Please see HitTestTypeEnum for details. The X coordinate of a point on the control surface, in pixels. The Y coordinate of a point on the control surface, in pixels.

HitTestInfo.Column Field
Get the index of the column at the point being tested (if the point does not correspond to a cell, it returns -1). [Visual Basic] Public ReadOnly Column As Integer

HitTestInfo.Row Field 647

[C#] public readonly int Column [Delphi] public Column: Int32; See Also HitTestInfo Structure | HitTestInfo Members | C1.Win.C1FlexGrid Namespace

HitTestInfo.Row Field
Get the index of the row at the point being tested (if the point does not correspond to a cell, it returns -1). [Visual Basic] Public ReadOnly Row As Integer [C#] public readonly int Row [Delphi] public Row: Int32; See Also HitTestInfo Structure | HitTestInfo Members | C1.Win.C1FlexGrid Namespace

HitTestInfo.Type Field
Gets the type of element at the point being tested. Please see HitTestTypeEnum for details. [Visual Basic] Public ReadOnly Type As HitTestTypeEnum [C#] public readonly HitTestTypeEnum Type [Delphi] public Type: HitTestTypeEnum; See Also HitTestInfo Structure | HitTestInfo Members | C1.Win.C1FlexGrid Namespace

HitTestInfo.X Field
The X coordinate of a point on the control surface, in pixels. [Visual Basic] Public ReadOnly X As Integer [C#] public readonly int X [Delphi] public X: Int32;

648 C1.Win.C1FlexGrid Namespace

See Also HitTestInfo Structure | HitTestInfo Members | C1.Win.C1FlexGrid Namespace

HitTestInfo.Y Field
The Y coordinate of a point on the control surface, in pixels. [Visual Basic] Public ReadOnly Y As Integer [C#] public readonly int Y [Delphi] public Y: Int32; See Also HitTestInfo Structure | HitTestInfo Members | C1.Win.C1FlexGrid Namespace

HitTestTypeEnum Enumeration
Type of grid element at a specific point on the control. [Visual Basic] Public Enum HitTestTypeEnum [C#] public enum HitTestTypeEnum [Delphi] type HitTestTypeEnum = (Cell, Checkbox, ColumnFreeze, ColumnHeader, ColumnResize, EditButton, None, OutlineBar, OutlineTree, RowFreeze, RowHeader, RowResize); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Cell Description The point is on a grid cell. (The cell coordinates are stored in the HitTestInfo.Row and HitTestInfo.Column properties). The point is on a check box. The point is near the right edge of the last frozen column, in the column freezing area. The point is on a fixed row, over a column. The point is near the right edge of a fixed cell, in the column resizing area. The point is on an edit button (drop down, popup editors).

Checkbox ColumnFreeze ColumnHeader ColumnResize EditButton

IC1EmbeddedEditor Interface 649

Member name None OutlineBar

Description The point is in the grid's empty area. The point is on the outline bar (visible when the grid's C1FlexGridBase.Tree property has a GridTree.Style that contains the TreeStyleFlags.ButtonBar flag). The point is on the collapse/expand button on an outline tree (visible when the grid's GridTree.Style property contains the TreeStyleFlags.Symbols flag). The point is near the bottom edge of the last frozen row, in the row freezing area. The point is on a fixed column, next to a row. The point is near the bottom edge of a fixed cell, in the row resizing area.

OutlineTree

RowFreeze RowHeader RowResize See Also C1.Win.C1FlexGrid Namespace

IC1EmbeddedEditor Interface
Interface implemented by editors and used by the grid to host edit controls on cells. For a list of all members of this type, see IC1EmbeddedEditor Members. [Visual Basic] Public Interface IC1EmbeddedEditor [C#] public interface IC1EmbeddedEditor [Delphi] type IC1EmbeddedEditor = interface; Remarks All built-in grid editors implement this interface, as do the controls in the ComponentOne C1Input library. If you want to use a third-party editor with the C1FlexGrid, consider creating a derived class and implementing this interface. Note that the methods in IC1EmbeddedEditor are called using reflection. Controls do not need to implement the entire interface. Any public methods with matching signatures (names, parameters, and return values) will be invoked by the grid. The grid supplies default handlers for any methods not implemented by the control. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also IC1EmbeddedEditor Members | C1.Win.C1FlexGrid Namespace

IC1EmbeddedEditor Members
IC1EmbeddedEditor overview

650 C1.Win.C1FlexGrid Namespace

Public Methods C1EditorFormat C1EditorGetStyle Formats a given value using a specified mask. Gets the editor style, which determines the type of button that is displayed in the cell before and during editing (DropDown, Modal, or None). Gets the current value of the editor. Called to initialize the editor content and styles. Gets a value that determines whether a given key should finalize editing. Called to update the editor's size and position. Gets a value that determines if the editor's current contents are valid.

C1EditorGetValue C1EditorInitialize C1EditorKeyDownFinishEdit C1EditorUpdateBounds C1EditorValueIsValid See Also

IC1EmbeddedEditor Interface | C1.Win.C1FlexGrid Namespace

IC1EmbeddedEditor Methods
The methods of the IC1EmbeddedEditor interface are listed here. For a complete list of IC1EmbeddedEditor interface members, see the IC1EmbeddedEditor Members topic. Public Methods C1EditorFormat C1EditorGetStyle Formats a given value using a specified mask. Gets the editor style, which determines the type of button that is displayed in the cell before and during editing (DropDown, Modal, or None). Gets the current value of the editor. Called to initialize the editor content and styles. Gets a value that determines whether a given key should finalize editing. Called to update the editor's size and position. Gets a value that determines if the editor's current contents are valid.

C1EditorGetValue C1EditorInitialize C1EditorKeyDownFinishEdit C1EditorUpdateBounds C1EditorValueIsValid See Also

IC1EmbeddedEditor Interface | C1.Win.C1FlexGrid Namespace

IC1EmbeddedEditor.C1EditorFormat Method
Formats a given value using a specified mask. [Visual Basic] Function C1EditorFormat( _ ByVal value As Object, _ ByVal mask As String _ ) As String

IC1EmbeddedEditor.C1EditorGetStyle Method 651

[C#] string C1EditorFormat( object value, string mask ); [Delphi] function C1EditorFormat( value: Object; mask: String ): String; Parameters value Value to be formatted. mask Formatting mask. Return Value A string containing the formatted value. Remarks The default implementation ignores the mask and returns value.ToString(). See Also IC1EmbeddedEditor Interface | IC1EmbeddedEditor Members | C1.Win.C1FlexGrid Namespace

IC1EmbeddedEditor.C1EditorGetStyle Method
Gets the editor style, which determines the type of button that is displayed in the cell before and during editing (DropDown, Modal, or None). [Visual Basic] Function C1EditorGetStyle() As UITypeEditorEditStyle [C#] UITypeEditorEditStyle C1EditorGetStyle() [Delphi] function C1EditorGetStyle(): UITypeEditorEditStyle; Remarks The default handler returns DropDown for ComboBoxes, DateTimePickers, and UpDown controls. It returns None for other control types. The UITypeEditorEditStyle enumeration is defined in the System.Drawing.Design namespace. The available settings are DropDown, Modal, and None. See Also IC1EmbeddedEditor Interface | IC1EmbeddedEditor Members | C1.Win.C1FlexGrid Namespace

IC1EmbeddedEditor.C1EditorGetValue Method
Gets the current value of the editor.

652 C1.Win.C1FlexGrid Namespace

[Visual Basic] Function C1EditorGetValue() As Object [C#] object C1EditorGetValue() [Delphi] function C1EditorGetValue(): Object; Return Value The current value of the editor (any data type). See Also IC1EmbeddedEditor Interface | IC1EmbeddedEditor Members | C1.Win.C1FlexGrid Namespace

IC1EmbeddedEditor.C1EditorInitialize Method
Called to initialize the editor content and styles. [Visual Basic] Sub C1EditorInitialize( _ ByVal value As Object, _ ByVal editorAttributes As IDictionary _ ) [C#] void C1EditorInitialize( object value, IDictionary editorAttributes ); [Delphi] procedure C1EditorInitialize( value: Object; editorAttributes: IDictionary ); Parameters value Contains the grid data that should be displayed in the editor. editorAttributes Contains a dictionary with keys that correspond to style element names and values for the cell being edited. Remarks The editorAttributes dictionary contains the following keys: BackColor: Cell background color. ForeColor: Cell foreground color. Font: Cell font. Format: Cell format string (for example, "#,##0.##").

IC1EmbeddedEditor.C1EditorKeyDownFinishEdit Method 653

ContentAlignment: Cell text alignment. Margins: Extra margins around the cell content (in pixels). Wrap: Whether word wrapping is enabled. See Also IC1EmbeddedEditor Interface | IC1EmbeddedEditor Members | C1.Win.C1FlexGrid Namespace

IC1EmbeddedEditor.C1EditorKeyDownFinishEdit Method
Gets a value that determines whether a given key should finalize editing. [Visual Basic] Function C1EditorKeyDownFinishEdit( _ ByVal e As KeyEventArgs _ ) As Boolean [C#] bool C1EditorKeyDownFinishEdit( KeyEventArgs e ); [Delphi] function C1EditorKeyDownFinishEdit( e: KeyEventArgs ): Boolean; Parameters e Key to be tested. Return Value True if the key should finish the edits and close the editor. Remarks If this method returns true, the grid copies the editor value to the cell and exits edit mode. The key is then processed by the grid (unless the e.Handled parameter is set to true). For example, pressing the down arrow typically causes the grid to exit edit mode and move the cursor to the next row. The default handler returns true for the TAB, ENTER, and ESC keys. It also handles the arrow keys for editors based on TextBox, ComboBox, and DateTimePicker controls. See Also IC1EmbeddedEditor Interface | IC1EmbeddedEditor Members | C1.Win.C1FlexGrid Namespace

IC1EmbeddedEditor.C1EditorUpdateBounds Method
Called to update the editor's size and position. [Visual Basic] Sub C1EditorUpdateBounds( _ ByVal rc As Rectangle _ )

654 C1.Win.C1FlexGrid Namespace

[C#] void C1EditorUpdateBounds( Rectangle rc ); [Delphi] procedure C1EditorUpdateBounds( rc: Rectangle ); Parameters rc The bounds of the cell being edited, in client coordinates. Remarks This method is called during initialization and also when the grid scrolls. See Also IC1EmbeddedEditor Interface | IC1EmbeddedEditor Members | C1.Win.C1FlexGrid Namespace

IC1EmbeddedEditor.C1EditorValueIsValid Method
Gets a value that determines if the editor's current contents are valid. [Visual Basic] Function C1EditorValueIsValid() As Boolean [C#] bool C1EditorValueIsValid() [Delphi] function C1EditorValueIsValid(): Boolean; Return Value True if the editor currently has valid content (for example, it contains an EditMask and all required positions have been filled). See Also IC1EmbeddedEditor Interface | IC1EmbeddedEditor Members | C1.Win.C1FlexGrid Namespace

IC1MultiColumnDictionary Interface
Interface that extends Collections.IDictionary and can be used to implement multi-column data maps. For a list of all members of this type, see IC1MultiColumnDictionary Members. [Visual Basic] Public Interface IC1MultiColumnDictionary Inherits ICollection, IDictionary, IEnumerable [C#] public interface IC1MultiColumnDictionary : ICollection, IDictionary, IEnumerable

IC1MultiColumnDictionary Members 655

[Delphi] type IC1MultiColumnDictionary = interface (ICollection, IDictionary, IEnumerable); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also IC1MultiColumnDictionary Members | C1.Win.C1FlexGrid Namespace

IC1MultiColumnDictionary Members
IC1MultiColumnDictionary overview Public Methods GetDisplayValue See Also IC1MultiColumnDictionary Interface | C1.Win.C1FlexGrid Namespace Gets the string that should be displayed in the grid while not in edit mode.

IC1MultiColumnDictionary Methods
The methods of the IC1MultiColumnDictionary interface are listed here. For a complete list of IC1MultiColumnDictionary interface members, see the IC1MultiColumnDictionary Members topic. Public Methods GetDisplayValue See Also IC1MultiColumnDictionary Interface | C1.Win.C1FlexGrid Namespace Gets the string that should be displayed in the grid while not in edit mode.

IC1MultiColumnDictionary.GetDisplayValue Method
Gets the string that should be displayed in the grid while not in edit mode. [Visual Basic] Function GetDisplayValue( _ ByVal key As Object _ ) As String [C#] string GetDisplayValue( object key ); [Delphi] function GetDisplayValue( key: Object ): String;

656 C1.Win.C1FlexGrid Namespace

Parameters key Value to look up in the dictionary. Return Value The string that should be displayed in the grid while not in edit mode. Remarks When the IC1MultiColumnDictionary is used to populate a Windows.Forms.ComboBox, all columns are displayed when the combo is dropped down. When the combo is closed, only one column can be displayed. This method returns that value. See Also IC1MultiColumnDictionary Interface | IC1MultiColumnDictionary Members | C1.Win.C1FlexGrid Namespace

ImageAlignEnum Enumeration
Specifies how images are aligns in grid cells. [Visual Basic] Public Enum ImageAlignEnum [C#] public enum ImageAlignEnum [Delphi] type ImageAlignEnum = (CenterBottom, CenterCenter, CenterTop, Hide, LeftBottom, LeftCenter, LeftTop, RightBottom, RightCenter, RightTop, Scale, Stretch, Tile, TileStretch); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name CenterBottom CenterCenter CenterTop Hide LeftBottom LeftCenter LeftTop Description Image is horizontally aligned to the center and vertically aligned to the bottom of the cell. Image is horizontally aligned to the center and vertically aligned to the center of the cell. Image is horizontally aligned to the center and vertically aligned to the top of the cell. Image is not displayed. Image is horizontally aligned to the left and vertically aligned to the bottom of the cell. Image is horizontally aligned to the left and vertically aligned to the center of the cell. Image is horizontally aligned to the left and vertically aligned to the top of the cell.

KeyActionEnum Enumeration 657

Member name RightBottom RightCenter RightTop Scale Stretch Tile TileStretch See Also C1.Win.C1FlexGrid Namespace

Description Image is horizontally aligned to the right and vertically aligned to the bottom of the cell. Image is horizontally aligned to the right and vertically aligned to the center of the cell. Image is horizontally aligned to the right and vertically aligned to the top of the cell. Image is scaled to fit the maximum area within the cell while preserving the original aspect ratio. Image is stretched to cover the whole cell. Image is tiled to cover the whole cell. Image is split into a grid, corner parts are copied and center is stretched to cover the cell.

KeyActionEnum Enumeration
Specifies the action to perform when the ENTER and TAB keys are pressed. [Visual Basic] Public Enum KeyActionEnum [C#] public enum KeyActionEnum [Delphi] type KeyActionEnum = (MoveAcross, MoveAcrossOut, MoveDown, None); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name MoveAcross MoveAcrossOut Description Move to the next column. At the end of the row, wrap to the start of the next row. Same as MoveAcross, and move the focus to the next control in the tab order when the last cell in the grid is reached. Move to the next row. No special action (allow system to handle the key). For example, the TAB key is normally used to cycle through the controls on a form.

MoveDown None

See Also C1.Win.C1FlexGrid Namespace

658 C1.Win.C1FlexGrid Namespace

KeyEditEventArgs Class
Provides data for the C1FlexGridBase.KeyDownEdit and C1FlexGridBase.KeyUpEdit events. For a list of all members of this type, see KeyEditEventArgs Members. System.Object System.EventArgs C1.Win.C1FlexGrid.KeyEditEventArgs [Visual Basic] Public Class KeyEditEventArgs Inherits EventArgs [C#] public class KeyEditEventArgs : EventArgs [Delphi] type KeyEditEventArgs = class (EventArgs); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also KeyEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyEditEventArgs Members
KeyEditEventArgs overview Public Constructors KeyEditEventArgs Constructor Public Fields Alt Col Control Handled KeyCode KeyData Gets a value indicating whether the ALT key was pressed. Gets the column index of the cell being edited when the key was pressed. Gets a value indicating whether the CTRL key was pressed. Gets or sets a value indicating whether the event was handled and should be ignored by the control. Gets the key code for the event, which will be one of the Windows.Forms.Keys values. Gets the key code for the key that was pressed, combined with modifier flags that indicate which combination of CTRL, SHIFT, and ALT keys were pressed at the same time. Initializes a new instance of the KeyEditEventArgs class.

KeyEditEventArgs Constructor 659

KeyValue Modifiers

Gets the integer representation of the KeyData property. Gets the modifier flags, as defined in Keys. This indicates which combination of modifier keys (CTRL, SHIFT, and ALT) were pressed. Gets the row index of the cell being edited when the key was pressed. Gets a value indicating whether the SHIFT key was pressed.

Row Shift See Also

KeyEditEventArgs Class | C1.Win.C1FlexGrid Namespace

KeyEditEventArgs Constructor
Initializes a new instance of the KeyEditEventArgs class. [Visual Basic] Public Function New( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal e As KeyEventArgs _ ) [C#] public KeyEditEventArgs( int row, int col, KeyEventArgs e ); [Delphi] public constructor Create( row: Int32; col: Int32; e: KeyEventArgs ); Parameters row The row index of the cell being edited when the key was pressed. col The column index of the cell being edited when the key was pressed. e A Windows.Forms.KeyEventArgs object containing the keyboard data. See Also KeyEditEventArgs Class | KeyEditEventArgs Members | C1.Win.C1FlexGrid Namespace

660 C1.Win.C1FlexGrid Namespace

KeyEditEventArgs Fields
The fields of the KeyEditEventArgs class are listed here. For a complete list of KeyEditEventArgs class members, see the KeyEditEventArgs Members topic. Public Fields Alt Col Control Handled KeyCode KeyData Gets a value indicating whether the ALT key was pressed. Gets the column index of the cell being edited when the key was pressed. Gets a value indicating whether the CTRL key was pressed. Gets or sets a value indicating whether the event was handled and should be ignored by the control. Gets the key code for the event, which will be one of the Windows.Forms.Keys values. Gets the key code for the key that was pressed, combined with modifier flags that indicate which combination of CTRL, SHIFT, and ALT keys were pressed at the same time. Gets the integer representation of the KeyData property. Gets the modifier flags, as defined in Keys. This indicates which combination of modifier keys (CTRL, SHIFT, and ALT) were pressed. Gets the row index of the cell being edited when the key was pressed. Gets a value indicating whether the SHIFT key was pressed.

KeyValue Modifiers

Row Shift See Also

KeyEditEventArgs Class | C1.Win.C1FlexGrid Namespace

KeyEditEventArgs.Alt Field
Gets a value indicating whether the ALT key was pressed. [Visual Basic] Public ReadOnly Alt As Boolean [C#] public readonly bool Alt [Delphi] public Alt: Boolean; See Also KeyEditEventArgs Class | KeyEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyEditEventArgs.Col Field 661

KeyEditEventArgs.Col Field
Gets the column index of the cell being edited when the key was pressed. [Visual Basic] Public ReadOnly Col As Integer [C#] public readonly int Col [Delphi] public Col: Int32; See Also KeyEditEventArgs Class | KeyEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyEditEventArgs.Control Field
Gets a value indicating whether the CTRL key was pressed. [Visual Basic] Public ReadOnly Control As Boolean [C#] public readonly bool Control [Delphi] public Control: Boolean; See Also KeyEditEventArgs Class | KeyEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyEditEventArgs.Handled Field
Gets or sets a value indicating whether the event was handled and should be ignored by the control. [Visual Basic] Public Handled As Boolean [C#] public bool Handled [Delphi] public Handled: Boolean; See Also KeyEditEventArgs Class | KeyEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyEditEventArgs.KeyCode Field
Gets the key code for the event, which will be one of the Windows.Forms.Keys values. [Visual Basic] Public ReadOnly KeyCode As Keys

662 C1.Win.C1FlexGrid Namespace

[C#] public readonly Keys KeyCode [Delphi] public KeyCode: Keys; See Also KeyEditEventArgs Class | KeyEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyEditEventArgs.KeyData Field
Gets the key code for the key that was pressed, combined with modifier flags that indicate which combination of CTRL, SHIFT, and ALT keys were pressed at the same time. [Visual Basic] Public ReadOnly KeyData As Keys [C#] public readonly Keys KeyData [Delphi] public KeyData: Keys; See Also KeyEditEventArgs Class | KeyEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyEditEventArgs.KeyValue Field
Gets the integer representation of the KeyData property. [Visual Basic] Public ReadOnly KeyValue As Integer [C#] public readonly int KeyValue [Delphi] public KeyValue: Int32; See Also KeyEditEventArgs Class | KeyEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyEditEventArgs.Modifiers Field
Gets the modifier flags, as defined in Keys. This indicates which combination of modifier keys (CTRL, SHIFT, and ALT) were pressed. [Visual Basic] Public ReadOnly Modifiers As Keys [C#] public readonly Keys Modifiers

KeyEditEventArgs.Row Field 663

[Delphi] public Modifiers: Keys; See Also KeyEditEventArgs Class | KeyEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyEditEventArgs.Row Field
Gets the row index of the cell being edited when the key was pressed. [Visual Basic] Public ReadOnly Row As Integer [C#] public readonly int Row [Delphi] public Row: Int32; See Also KeyEditEventArgs Class | KeyEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyEditEventArgs.Shift Field
Gets a value indicating whether the SHIFT key was pressed. [Visual Basic] Public ReadOnly Shift As Boolean [C#] public readonly bool Shift [Delphi] public Shift: Boolean; See Also KeyEditEventArgs Class | KeyEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyEditEventHandler Delegate
Represents the method that will handle the C1FlexGridBase.KeyDownEdit and C1FlexGridBase.KeyUpEdit events. [Visual Basic] Public Delegate Sub KeyEditEventHandler( _ ByVal sender As Object, _ ByVal e As KeyEditEventArgs _ )

664 C1.Win.C1FlexGrid Namespace

[C#] public delegate void KeyEditEventHandler( object sender, KeyEditEventArgs e ); [Delphi] type KeyEditEventHandler = procedure ( sender: Object; e: KeyEditEventArgs ) of object; Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also C1.Win.C1FlexGrid Namespace

KeyPressEditEventArgs Class
Provides data for the C1FlexGridBase.KeyPressEdit event. For a list of all members of this type, see KeyPressEditEventArgs Members. System.Object System.EventArgs C1.Win.C1FlexGrid.KeyPressEditEventArgs [Visual Basic] Public Class KeyPressEditEventArgs Inherits EventArgs [C#] public class KeyPressEditEventArgs : EventArgs [Delphi] type KeyPressEditEventArgs = class (EventArgs); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also KeyPressEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyPressEditEventArgs Members
KeyPressEditEventArgs overview Public Constructors KeyPressEditEventArgs Constructor Initializes a new instance of the KeyPressEditEventArgs class.

KeyPressEditEventArgs Constructor 665

Public Fields Col Handled KeyChar Row See Also KeyPressEditEventArgs Class | C1.Win.C1FlexGrid Namespace Gets the column index of the cell being edited when the key was pressed. Gets or sets a value indicating whether the event was handled and should be ignored by the control. Gets the character corresponding to the key pressed. Gets the row index of the cell being edited when the key was pressed.

KeyPressEditEventArgs Constructor
Initializes a new instance of the KeyPressEditEventArgs class. [Visual Basic] Public Function ByVal row As ByVal col As ByVal key As )

New( _ Integer, _ Integer, _ Char _

[C#] public KeyPressEditEventArgs( int row, int col, char key ); [Delphi] public constructor Create( row: Int32; col: Int32; key: Char ); Parameters row The row index of the cell being edited when the key was pressed. col The column index of the cell being edited when the key was pressed. key The character corresponding to the key pressed. See Also KeyPressEditEventArgs Class | KeyPressEditEventArgs Members | C1.Win.C1FlexGrid Namespace

666 C1.Win.C1FlexGrid Namespace

KeyPressEditEventArgs Fields
The fields of the KeyPressEditEventArgs class are listed here. For a complete list of KeyPressEditEventArgs class members, see the KeyPressEditEventArgs Members topic. Public Fields Col Handled KeyChar Row See Also KeyPressEditEventArgs Class | C1.Win.C1FlexGrid Namespace Gets the column index of the cell being edited when the key was pressed. Gets or sets a value indicating whether the event was handled and should be ignored by the control. Gets the character corresponding to the key pressed. Gets the row index of the cell being edited when the key was pressed.

KeyPressEditEventArgs.Col Field
Gets the column index of the cell being edited when the key was pressed. [Visual Basic] Public ReadOnly Col As Integer [C#] public readonly int Col [Delphi] public Col: Int32; See Also KeyPressEditEventArgs Class | KeyPressEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyPressEditEventArgs.Handled Field
Gets or sets a value indicating whether the event was handled and should be ignored by the control. [Visual Basic] Public Handled As Boolean [C#] public bool Handled [Delphi] public Handled: Boolean; See Also KeyPressEditEventArgs Class | KeyPressEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyPressEditEventArgs.KeyChar Field
Gets the character corresponding to the key pressed.

KeyPressEditEventArgs.Row Field 667

[Visual Basic] Public KeyChar As Char [C#] public char KeyChar [Delphi] public KeyChar: Char; See Also KeyPressEditEventArgs Class | KeyPressEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyPressEditEventArgs.Row Field
Gets the row index of the cell being edited when the key was pressed. [Visual Basic] Public ReadOnly Row As Integer [C#] public readonly int Row [Delphi] public Row: Int32; See Also KeyPressEditEventArgs Class | KeyPressEditEventArgs Members | C1.Win.C1FlexGrid Namespace

KeyPressEditEventHandler Delegate
Represents the method that will handle the C1FlexGridBase.KeyPressEdit event. [Visual Basic] Public Delegate Sub KeyPressEditEventHandler( _ ByVal sender As Object, _ ByVal e As KeyPressEditEventArgs _ ) [C#] public delegate void KeyPressEditEventHandler( object sender, KeyPressEditEventArgs e ); [Delphi] type KeyPressEditEventHandler = procedure ( sender: Object; e: KeyPressEditEventArgs ) of object; Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll)

668 C1.Win.C1FlexGrid Namespace

See Also C1.Win.C1FlexGrid Namespace

MoveCursorEnum Enumeration
This enumeration is for internal use only. [Visual Basic] Public Enum MoveCursorEnum [C#] public enum MoveCursorEnum [Delphi] type MoveCursorEnum = (CellDown, CellLeft, CellNext, CellPrev, CellRight, CellUp, EndDown, EndRight, HomeLeft, HomeUp, None, PageDown, PageLeft, PageRight, PageUp); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name CellDown CellLeft CellNext CellPrev CellRight CellUp EndDown EndRight HomeLeft HomeUp None PageDown PageLeft PageRight PageUp See Also C1.Win.C1FlexGrid Namespace Description One cell down. One cell left. One cell right, then wrap to next row. One cell left, then wrap to previous row. One cell right. One cell up. Bottom cell. Rightmost cell. Leftmost cell. Top cell. No movement. Page down. Page left. Page right. Page up.

MultiColumnDictionary Class 669

MultiColumnDictionary Class
Class that implements the IC1MultiColumnDictionary and can be used as a column DataMap to create multicolumn combo editors. For a list of all members of this type, see MultiColumnDictionary Members. System.Object System.Collections.Specialized.ListDictionary C1.Win.C1FlexGrid.MultiColumnDictionary [Visual Basic] Public Class MultiColumnDictionary Inherits ListDictionary Implements IC1MultiColumnDictionary [C#] public class MultiColumnDictionary : ListDictionary , IC1MultiColumnDictionary [Delphi] type MultiColumnDictionary = class (ListDictionary, IC1MultiColumnDictionary); Remarks The MultiColumnDictionary class can be used to implement simple string-based data maps or bound data maps that get the data from a data source object. Example The code below creates an unbound two-column data map and assigns it to a grid column: Visual Basic ' create string-based MultiColumnDictionary and assign it to column ' note: this will automatically generate keys of type int for each item, the key values will be stored in the grid. Dim text As String = "Row1, Col1\tRow1, Col2|Row2, Col1\tRow2, Col2" Dim map As MultiColumnDictionary = New MultiColumnDictionary(text,0,True) _flex.Cols(1).DataMap = map C# // create string-based MultiColumnDictionary and assign it to column // note: this will automatically generate keys of type int for each item, the key values will be stored in the grid. string text = "Row1, Col1\tRow1, Col2|Row2, Col1\tRow2, Col3|Row2, Col1\tRow3, Col2"; MultiColumnDictionary map = new MultiColumnDictionary(text, 0, true); _flex.Cols[1].DataMap = map; Delphi var text := string; begin

670 C1.Win.C1FlexGrid Namespace

// create string-based MultiColumnDictionary and assign it to column // note: this will automatically generate keys of type int for each item, the key values will be stored in the grid. text := 'Row1, Col1'#9'Row1, Col2|Row2, Col1'#9'Row2, Col2'; map := MultiColumnDictionary.Create(text, 0, True); _flex.Cols[1].DataMap := map; end; The map consists of three items, each with two columns. Because the autoKeys parameter was set to true in the map's constructor, the map will have unique integer keys for each value,and those integers will be stored in the grid cells. If autoKeys had been set to false, the strings themselves would be used as keys and stored in the grid cells. The code below creates a bound data map and assigns it to a grid column: Visual Basic ' create data-based MultiColumnDictionary and assign it to column ' note: the list will automatically be updated is the data source changes. Dim dt As DataTable = GetDataTable("employees") Dim columnNames() As String = New String() {"FirstName", "LastName", "Country"} Dim map As MultiColumnDictionary = New MultiColumnDictionary(dt,"EmployeeID",columnNames,1) _flex.Cols(2).DataMap = map C# // create data-based MultiColumnDictionary and assign it to column // notes: the list will automatically be updated is the data source changes. DataTable dt = GetDataTable("employees"); string[] columnNames = new string[] { "FirstName", "LastName", "Country" }; MultiColumnDictionary map = new MultiColumnDictionary(dt, "EmployeeID", columnNames, 1); _flex.Cols[2].DataMap = map; Delphi var dt := DataTable; map := MultiColumnDictionary; begin // create data-based MultiColumnDictionary and assign it to column // note: the list will automatically be updated is the data source changes. dt := GetDataTable('employees'); columnNames := array of string.Create('FirstName', 'LastName', 'Country'); map := MultiColumnDictionary.Create(dt, 'EmployeeID', columnNames, 1); _flex.Cols[2].DataMap := map; end;

MultiColumnDictionary Members 671

This map is bound to an Employees DataTable. The keyColumn parameter is set to "EmployeeID", causing this field to be used used as a key. When the grid is edited, the values stored in the cells will be the employee's ID. However, this value is never displayed be the grid. The drop-down list will show the employee's first name, last name, and country, as specified by the columnNames parameter. When the list is closed, the grid will display the employee's last name, as specified by the displayColumn parameter. Note that this map is dynamically bound to the data source, so if the employees table is modified, the editor list will reflect the changes automatically. Note also that the usual combo editing features such as auto-search and double-click cycling still work. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also MultiColumnDictionary Members | C1.Win.C1FlexGrid Namespace

MultiColumnDictionary Members
MultiColumnDictionary overview Public Constructors MultiColumnDictionary Constructor Public Methods Clear See Also MultiColumnDictionary Class | C1.Win.C1FlexGrid Namespace Overridden. Removes all entries from the MultiColumnDictionary. Initializes a new instance of a bound MultiColumnDictionary class.

MultiColumnDictionary Constructor
Overload List Initializes a new instance of a bound MultiColumnDictionary class. [Visual Basic] Public Function New(DataTable, String) [C#] public MultiColumnDictionary(DataTable, string); [Delphi] public constructor Create(DataTable; String); overload; Initializes a new instance of an unbound MultiColumnDictionary class. [Visual Basic] Public Function New(String) [C#] public MultiColumnDictionary(string); [Delphi] public constructor Create(String); overload; Initializes a new instance of a bound MultiColumnDictionary class. [Visual Basic] Public Function New(ITypedList, String) [C#] public MultiColumnDictionary(ITypedList, string);

672 C1.Win.C1FlexGrid Namespace

[Delphi] public constructor Create(ITypedList; String); overload; Initializes a new instance of an unbound MultiColumnDictionary class. [Visual Basic] Public Function New(String, Integer, Boolean) [C#] public MultiColumnDictionary(string, int, bool); [Delphi] public constructor Create(String; Int32; Boolean); overload; Initializes a new instance of a bound MultiColumnDictionary class. [Visual Basic] Public Function New(DataTable, String, String(), Integer) [C#] public MultiColumnDictionary(DataTable, string, string[], int); [Delphi] public constructor Create(DataTable; String; array of String; Int32); overload; Initializes a new instance of a bound MultiColumnDictionary class. [Visual Basic] Public Function New(ITypedList, String, String(), Integer) [C#] public MultiColumnDictionary(ITypedList, string, string[], int); [Delphi] public constructor Create(ITypedList; String; array of String; Int32); overload; See Also MultiColumnDictionary Class | MultiColumnDictionary Members | C1.Win.C1FlexGrid Namespace

MultiColumnDictionary Constructor (DataTable, String)


Initializes a new instance of a bound MultiColumnDictionary class. [Visual Basic] Public Function New( _ ByVal table As DataTable, _ ByVal keyColumn As String _ ) [C#] public MultiColumnDictionary( DataTable table, string keyColumn ); [Delphi] public constructor Create( table: DataTable; keyColumn: String ); overload; Parameters table Data source object. keyColumn Name of the data source column that contains unique keys. See Also MultiColumnDictionary Class | MultiColumnDictionary Members | C1.Win.C1FlexGrid Namespace | MultiColumnDictionary Constructor Overload List

MultiColumnDictionary Constructor (String) 673

MultiColumnDictionary Constructor (String)


Initializes a new instance of an unbound MultiColumnDictionary class. [Visual Basic] Public Function New( _ ByVal items As String _ ) [C#] public MultiColumnDictionary( string items ); [Delphi] public constructor Create( items: String ); overload; Parameters items String that contains the items, delimited by pipe characters ("|"). Each item may contain multiple columns, delimited by tabs (vbTab or '\t'). Remarks This constructor causes the map to show all columns when the editor is dropped down and only the first column when the editor is closed or inactive. See Also MultiColumnDictionary Class | MultiColumnDictionary Members | C1.Win.C1FlexGrid Namespace | MultiColumnDictionary Constructor Overload List

MultiColumnDictionary Constructor (ITypedList, String)


Initializes a new instance of a bound MultiColumnDictionary class. [Visual Basic] Public Function New( _ ByVal list As ITypedList, _ ByVal keyColumn As String _ ) [C#] public MultiColumnDictionary( ITypedList list, string keyColumn ); [Delphi] public constructor Create( list: ITypedList; keyColumn: String ); overload;

674 C1.Win.C1FlexGrid Namespace

Parameters list Data source object. keyColumn Name of the data source column that contains unique keys. Remarks This constructor causes the map to show all columns when the editor is dropped down and only the first column when the editor is closed or inactive. See Also MultiColumnDictionary Class | MultiColumnDictionary Members | C1.Win.C1FlexGrid Namespace | MultiColumnDictionary Constructor Overload List

MultiColumnDictionary Constructor (String, Int32, Boolean)


Initializes a new instance of an unbound MultiColumnDictionary class. [Visual Basic] Public Function New( _ ByVal items As String, _ ByVal displayColumn As Integer, _ ByVal autoKeys As Boolean _ ) [C#] public MultiColumnDictionary( string items, int displayColumn, bool autoKeys ); [Delphi] public constructor Create( items: String; displayColumn: Int32; autoKeys: Boolean ); overload; Parameters items String that contains the items. Items are delimited by pipe characters ("|"). Each item may contain multiple columns, delimited by tabs (vbTab or '\t'). displayColumn Index of the column that is displayed in the grid. autoKeys True if keys are to be automatically generated, false if the items themselves are to be used as keys. Note that in the latter case, duplicate items are not allowed.

MultiColumnDictionary Constructor (DataTable, String, String[], Int32) 675

See Also MultiColumnDictionary Class | MultiColumnDictionary Members | C1.Win.C1FlexGrid Namespace | MultiColumnDictionary Constructor Overload List

MultiColumnDictionary Constructor (DataTable, String, String[], Int32)


Initializes a new instance of a bound MultiColumnDictionary class. [Visual Basic] Public Function New( _ ByVal table As DataTable, _ ByVal keyColumn As String, _ ByVal columnNames As String(), _ ByVal displayColumn As Integer _ ) [C#] public MultiColumnDictionary( DataTable table, string keyColumn, string[] columnNames, int displayColumn ); [Delphi] public constructor Create( table: DataTable; keyColumn: String; columnNames: String(); displayColumn: Int32 ); overload; Parameters table Data source object. keyColumn Name of the data source column that contains unique keys. columnNames Array with the names of the columns that are included in the map. displayColumn Name of the column that is displayed in the grid. See Also MultiColumnDictionary Class | MultiColumnDictionary Members | C1.Win.C1FlexGrid Namespace | MultiColumnDictionary Constructor Overload List

MultiColumnDictionary Constructor (ITypedList, String, String[], Int32)


Initializes a new instance of a bound MultiColumnDictionary class.

676 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Function New( _ ByVal list As ITypedList, _ ByVal keyColumn As String, _ ByVal columnNames As String(), _ ByVal displayColumn As Integer _ ) [C#] public MultiColumnDictionary( ITypedList list, string keyColumn, string[] columnNames, int displayColumn ); [Delphi] public constructor Create( list: ITypedList; keyColumn: String; columnNames: String(); displayColumn: Int32 ); overload; Parameters list Data source object. keyColumn Name of the data source column that contains unique keys. columnNames Array with the names of the columns that are included in the map. displayColumn Name of the column that is displayed in the grid. See Also MultiColumnDictionary Class | MultiColumnDictionary Members | C1.Win.C1FlexGrid Namespace | MultiColumnDictionary Constructor Overload List

MultiColumnDictionary Methods
The methods of the MultiColumnDictionary class are listed here. For a complete list of MultiColumnDictionary class members, see the MultiColumnDictionary Members topic. Public Methods Clear See Also MultiColumnDictionary Class | C1.Win.C1FlexGrid Namespace Overridden. Removes all entries from the MultiColumnDictionary.

MultiColumnDictionary.Clear Method 677

MultiColumnDictionary.Clear Method
Removes all entries from the MultiColumnDictionary. [Visual Basic] Overrides Public Sub Clear() [C#] new override public void Clear() [Delphi] public procedure Clear(); override; See Also MultiColumnDictionary Class | MultiColumnDictionary Members | C1.Win.C1FlexGrid Namespace

Node Class
The Node class encapsulates properties and methods used for manipulating node rows (collapsing, expanding, moving, and sorting them). For a list of all members of this type, see Node Members. System.Object C1.Win.C1FlexGrid.Node [Visual Basic] Public Class Node [C#] public class Node [Delphi] type Node = class; Remarks You can create node rows using the C1FlexGridBase.Subtotal method or by setting the Row.IsNode property to true. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also Node Members | C1.Win.C1FlexGrid Namespace

Node Members
Node overview Public Properties Children Collapsed Gets the number of child nodes under this node. Gets or sets whether this node is collapsed.

678 C1.Win.C1FlexGrid Namespace

Data Expanded Image Key Level Row Public Methods AddNode EnsureVisible GetCellRange GetNode Move RemoveNode Select Sort See Also Node Class | C1.Win.C1FlexGrid Namespace

Gets or sets the data on this node row at the column that contains the outline tree. Gets or sets whether this node is expanded. Gets or sets the image on this node row at the column that contains the outline tree. Gets or sets the RowCol.UserData associated with this node row. Gets or sets the outline level for this node. Returns a reference to the Row object that corresponds to this node. Overloaded. Creates a node row at a specified position relative to this node. Ensures that this node is visible, expanding its parent nodes and scrolling it into view if necessary. Returns a CellRange object containing this row and all its child rows. Returns a reference to a node located at a given position relative to this node. Overloaded. Moves a node to a new position. Removes this node row and all its child rows (nodes and data) from the grid. Selects the node. Overloaded. Sorts the current node in the specified order.

Node Properties
The properties of the Node class are listed here. For a complete list of Node class members, see the Node Members topic. Public Properties Children Collapsed Data Expanded Image Key Gets the number of child nodes under this node. Gets or sets whether this node is collapsed. Gets or sets the data on this node row at the column that contains the outline tree. Gets or sets whether this node is expanded. Gets or sets the image on this node row at the column that contains the outline tree. Gets or sets the RowCol.UserData associated with this node row.

Node.Children Property 679

Level Row See Also Node Class | C1.Win.C1FlexGrid Namespace

Gets or sets the outline level for this node. Returns a reference to the Row object that corresponds to this node.

Node.Children Property
Gets the number of child nodes under this node. [Visual Basic] Public ReadOnly Property Children As Integer [C#] public int Children {get;} [Delphi] public property Children: Int32 read get_Children; Remarks Only immediate children are included in the count. Grand-children are not included. See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.Collapsed Property
Gets or sets whether this node is collapsed. [Visual Basic] Public Property Collapsed As Boolean [C#] public bool Collapsed {get;set;} [Delphi] public property Collapsed: Boolean read get_Collapsed write set_Collapsed; See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.Data Property
Gets or sets the data on this node row at the column that contains the outline tree. [Visual Basic] Public Property Data As Object [C#] public object Data {get;set;} [Delphi] public property Data: Object read get_Data write set_Data;

680 C1.Win.C1FlexGrid Namespace

See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.Expanded Property
Gets or sets whether this node is expanded. [Visual Basic] Public Property Expanded As Boolean [C#] public bool Expanded {get;set;} [Delphi] public property Expanded: Boolean read get_Expanded write set_Expanded; See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.Image Property
Gets or sets the image on this node row at the column that contains the outline tree. [Visual Basic] Public Property Image As Image [C#] public Image Image {get;set;} [Delphi] public property Image: Image read get_Image write set_Image; See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.Key Property
Gets or sets the RowCol.UserData associated with this node row. [Visual Basic] Public Property Key As Object [C#] public object Key {get;set;} [Delphi] public property Key: Object read get_Key write set_Key; See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.Level Property
Gets or sets the outline level for this node.

Node.Row Property 681

[Visual Basic] Public Property Level As Integer [C#] public int Level {get;set;} [Delphi] public property Level: Int32 read get_Level write set_Level; See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.Row Property
Returns a reference to the Row object that corresponds to this node. [Visual Basic] Public ReadOnly Property Row As Row [C#] public Row Row {get;} [Delphi] public property Row: Row read get_Row; See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node Methods
The methods of the Node class are listed here. For a complete list of Node class members, see the Node Members topic. Public Methods AddNode EnsureVisible GetCellRange GetNode Move RemoveNode Select Sort Overloaded. Creates a node row at a specified position relative to this node. Ensures that this node is visible, expanding its parent nodes and scrolling it into view if necessary. Returns a CellRange object containing this row and all its child rows. Returns a reference to a node located at a given position relative to this node. Overloaded. Moves a node to a new position. Removes this node row and all its child rows (nodes and data) from the grid. Selects the node. Overloaded. Sorts the current node in the specified order.

682 C1.Win.C1FlexGrid Namespace

See Also Node Class | C1.Win.C1FlexGrid Namespace

Node.AddNode Method
Overload List Creates a node row at a specified position relative to this node. [Visual Basic] Overloads Public Function AddNode(NodeTypeEnum, Object) As Node [C#] public Node AddNode(NodeTypeEnum, object); [Delphi] public function AddNode(NodeTypeEnum; Object) : Node; overload; Creates a node row at a specified position relative to this node. [Visual Basic] Overloads Public Function AddNode(NodeTypeEnum, Object, Object, Image) As Node [C#] public Node AddNode(NodeTypeEnum, object, object, Image); [Delphi] public function AddNode(NodeTypeEnum; Object; Object; Image) : Node; overload; See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.AddNode Method (NodeTypeEnum, Object)


Creates a node row at a specified position relative to this node. [Visual Basic] Overloads Public Function AddNode( _ ByVal position As NodeTypeEnum, _ ByVal data As Object _ ) As Node [C#] public Node AddNode( NodeTypeEnum position, object data ); [Delphi] public function AddNode( position: NodeTypeEnum; data: Object ): Node; overload; Parameters position A value from the NodeTypeEnum enumeration that specifies where the new node will be added with respect to this node (for example, Child, Sibling). data Value of the Data property for the new node. Return Value A reference to the new Node added to the grid.

Node.EnsureVisible Method 683

See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace | Node.AddNode Overload List

Node.AddNode Method (NodeTypeEnum, Object, Object, Image)


Creates a node row at a specified position relative to this node. [Visual Basic] Overloads Public Function AddNode( _ ByVal position As NodeTypeEnum, _ ByVal data As Object, _ ByVal key As Object, _ ByVal img As Image _ ) As Node [C#] public Node AddNode( NodeTypeEnum position, object data, object key, Image img ); [Delphi] public function AddNode( position: NodeTypeEnum; data: Object; key: Object; img: Image ): Node; overload; Parameters position A value from the NodeTypeEnum enumeration that specifies where the new node will be added with respect to this node (for example, Child, Sibling). data Value of the Data property for the new node. key Value of the Key property for the new node. img Value of the Image property for the new node. Return Value A reference to the new Node added to the grid. See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace | Node.AddNode Overload List

Node.EnsureVisible Method
Ensures that this node is visible, expanding its parent nodes and scrolling it into view if necessary.

684 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Sub EnsureVisible() [C#] public void EnsureVisible() [Delphi] public procedure EnsureVisible(); See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.GetCellRange Method
Returns a CellRange object containing this row and all its child rows. [Visual Basic] Public Function GetCellRange() As CellRange [C#] public CellRange GetCellRange() [Delphi] public function GetCellRange(): CellRange; Return Value A CellRange object containing this row and all its child rows. Remarks The CellRange object returned includes all columns. See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.GetNode Method
Returns a reference to a node located at a given position relative to this node. [Visual Basic] Public Function GetNode( _ ByVal position As NodeTypeEnum _ ) As Node [C#] public Node GetNode( NodeTypeEnum position ); [Delphi] public function GetNode( position: NodeTypeEnum ): Node;

Node.Move Method 685

Parameters position A value from the NodeTypeEnum enumeration that specifies the position relative to this node. Return Value A node object. Remarks If the node requested does not exist, GetNode returns null (for example, the root node does not have a previous sibling). See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.Move Method
Overload List Moves a node to a new position. [Visual Basic] Overloads Public Function Move(NodeMoveEnum) As Boolean [C#] public bool Move(NodeMoveEnum); [Delphi] public function Move(NodeMoveEnum) : Boolean; overload; Moves a node to a new position. [Visual Basic] Overloads Public Function Move(NodeMoveEnum, Node) As Boolean [C#] public bool Move(NodeMoveEnum, Node); [Delphi] public function Move(NodeMoveEnum; Node) : Boolean; overload; See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.Move Method (NodeMoveEnum)


Moves a node to a new position. [Visual Basic] Overloads Public Function Move( _ ByVal moveTo As NodeMoveEnum _ ) As Boolean [C#] public bool Move( NodeMoveEnum moveTo ); [Delphi] public function Move( moveTo: NodeMoveEnum ): Boolean; overload;

686 C1.Win.C1FlexGrid Namespace

Parameters moveTo A value from the NodeMoveEnum enumeration that specifies where the node will be moved with respect to its current position. Return Value Returns true if the method was successful, false otherwise. See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace | Node.Move Overload List

Node.Move Method (NodeMoveEnum, Node)


Moves a node to a new position. [Visual Basic] Overloads Public Function Move( _ ByVal moveTo As NodeMoveEnum, _ ByVal targetNode As Node _ ) As Boolean [C#] public bool Move( NodeMoveEnum moveTo, Node targetNode ); [Delphi] public function Move( moveTo: NodeMoveEnum; targetNode: Node ): Boolean; overload; Parameters moveTo A value from the NodeMoveEnum enumeration that specifies where the node will be moved with respect to its current position. targetNode Node object to use as a target when the moveTo parameter is set to NodeMoveEnum.ChildOf. Return Value Returns true if the method was successful, false otherwise. See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace | Node.Move Overload List

Node.RemoveNode Method
Removes this node row and all its child rows (nodes and data) from the grid. [Visual Basic] Public Sub RemoveNode()

Node.Select Method 687

[C#] public void RemoveNode() [Delphi] public procedure RemoveNode(); See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.Select Method
Selects the node. [Visual Basic] Public Sub Select() [C#] public void Select() [Delphi] public procedure Select(); Remarks This method sets the control's C1FlexGridBase.Row property. See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.Sort Method
Overload List Sorts the current node in the specified order. [Visual Basic] Overloads Public Sub Sort(IComparer) [C#] public void Sort(IComparer); [Delphi] public procedure Sort(IComparer); overload; Sorts the current node in the specified order. [Visual Basic] Overloads Public Sub Sort(SortFlags) [C#] public void Sort(SortFlags); [Delphi] public procedure Sort(SortFlags); overload; Sorts the current node in the specified order. [Visual Basic] Overloads Public Sub Sort(SortFlags, Integer, Integer) [C#] public void Sort(SortFlags, int, int); [Delphi] public procedure Sort(SortFlags; Int32; Int32); overload; See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace

Node.Sort Method (IComparer)


Sorts the current node in the specified order.

688 C1.Win.C1FlexGrid Namespace

[Visual Basic] Overloads Public Sub Sort( _ ByVal comparer As IComparer _ ) [C#] public void Sort( IComparer comparer ); [Delphi] public procedure Sort( comparer: IComparer ); overload; Parameters comparer An object that implements the Collections.IComparer interface used to compare Row objects. This can be used to provide custom sorting. See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace | Node.Sort Overload List

Node.Sort Method (SortFlags)


Sorts the current node in the specified order. [Visual Basic] Overloads Public Sub Sort( _ ByVal order As SortFlags _ ) [C#] public void Sort( SortFlags order ); [Delphi] public procedure Sort( order: SortFlags ); overload; Parameters order One or more values from the SortFlags enumeration that specify the type of sorting to be applied (for example, ascending, descending, case-sensitive, and so on). See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace | Node.Sort Overload List

Node.Sort Method (SortFlags, Int32, Int32)


Sorts the current node in the specified order.

Node.Sort Method 689

[Visual Basic] Overloads Public Sub Sort( _ ByVal order As SortFlags, _ ByVal col1 As Integer, _ ByVal col2 As Integer _ ) [C#] public void Sort( SortFlags order, int col1, int col2 ); [Delphi] public procedure Sort( order: SortFlags; col1: Int32; col2: Int32 ); overload; Parameters order One or more values from the SortFlags enumeration that specify the type of sorting to be applied (for example, ascending, descending, case-sensitive, and so on). col1 Start of a range of columns to sort. col2 End of a range of columns to sort. See Also Node Class | Node Members | C1.Win.C1FlexGrid Namespace | Node.Sort Overload List

NodeMoveEnum Enumeration
Specifies the destination of nodes when they are moved with the Node.Move method. [Visual Basic] Public Enum NodeMoveEnum [C#] public enum NodeMoveEnum [Delphi] type NodeMoveEnum = (ChildOf, Down, First, In, Last, Out, Up); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll)

690 C1.Win.C1FlexGrid Namespace

Members Member name ChildOf Down First In Last Out Up See Also C1.Win.C1FlexGrid Namespace Description Make the node a child of the specified node. Move the node to the position after its next sibling. Move the node to the position before its first sibling. Move the node one level in, deeper into the outline. Move the node to the position after its last sibling. Move the node one level out, towards the root. Move the node to the position before its previous sibling.

NodeTypeEnum Enumeration
Specifies a node with respect to another given node. [Visual Basic] Public Enum NodeTypeEnum [C#] public enum NodeTypeEnum [Delphi] type NodeTypeEnum = (FirstChild, FirstSibling, LastChild, LastSibling, NextSibling, Parent, PreviousSibling, Root); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Remarks This enumeration is used with the Node.GetNode method. Members Member name FirstChild FirstSibling LastChild LastSibling NextSibling Parent PreviousSibling Root Description The node's first child. The node's first sibling (node with same level and same parent). The node's last child. The node's last sibling. The node's next sibling. The node's immediate parent. The node's previous sibling. The node's top-level parent.

OwnerDrawCellEventArgs Class 691

See Also C1.Win.C1FlexGrid Namespace

OwnerDrawCellEventArgs Class
Provides data for the C1FlexGridBase.OwnerDrawCell event. For a list of all members of this type, see OwnerDrawCellEventArgs Members. System.Object System.EventArgs C1.Win.C1FlexGrid.OwnerDrawCellEventArgs [Visual Basic] Public Class OwnerDrawCellEventArgs Inherits EventArgs [C#] public class OwnerDrawCellEventArgs : EventArgs [Delphi] type OwnerDrawCellEventArgs = class (EventArgs); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also OwnerDrawCellEventArgs Members | C1.Win.C1FlexGrid Namespace

OwnerDrawCellEventArgs Members
OwnerDrawCellEventArgs overview Public Constructors OwnerDrawCellEventArgs Constructor Public Fields Bounds Col Graphics Handled Measuring Row Get the rectangle where the cell will be painted (in client coordinates). Get the column index of the cell being painted. Gets the Graphics object used to draw the cell. Use this object to draw custom elements in the cell. Gets or sets whether the event has finished drawing the cell. Gets a value that determines if the event was fired only to measure the cell. Get the row index of the cell being painted. Initializes a new instance of the OwnerDrawCellEventArgs class.

692 C1.Win.C1FlexGrid Namespace

Public Properties Image Style Text Public Methods DrawCell See Also OwnerDrawCellEventArgs Class | C1.Win.C1FlexGrid Namespace Overloaded. Causes the grid to paint the whole cell. Gets or sets the image that will be displayed in the cell. Sets or sets the CellStyle object used to paint the cell. Gets or sets the text that will be displayed in the cell.

OwnerDrawCellEventArgs Constructor
Initializes a new instance of the OwnerDrawCellEventArgs class. [Visual Basic] Public Function New( _ ByVal view As C1FlexGridBase, _ ByVal g As Graphics, _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal s As CellStyle, _ ByVal rc As Rectangle, _ ByVal text As String, _ ByVal img As Image _ ) [C#] public OwnerDrawCellEventArgs( C1FlexGridBase view, Graphics g, int row, int col, CellStyle s, Rectangle rc, string text, Image img ); [Delphi] public constructor Create( view: C1FlexGridBase; g: Graphics; row: Int32; col: Int32; s: CellStyle; rc: Rectangle; text: String; img: Image );

OwnerDrawCellEventArgs Fields 693

Parameters view The C1FlexGridBase control that contains the cell being painted. g The Graphics object where the cell will be painted. row The row index of the cell being painted. col The column index of the cell being painted. s The CellStyle that will be used to paint the cell. rc The bounds of the cell being painted. text The text that will be displayed in the cell. img The image that will be displayed in the cell. See Also OwnerDrawCellEventArgs Class | OwnerDrawCellEventArgs Members | C1.Win.C1FlexGrid Namespace

OwnerDrawCellEventArgs Fields
The fields of the OwnerDrawCellEventArgs class are listed here. For a complete list of OwnerDrawCellEventArgs class members, see the OwnerDrawCellEventArgs Members topic. Public Fields Bounds Col Graphics Handled Measuring Row See Also OwnerDrawCellEventArgs Class | C1.Win.C1FlexGrid Namespace Get the rectangle where the cell will be painted (in client coordinates). Get the column index of the cell being painted. Gets the Graphics object used to draw the cell. Use this object to draw custom elements in the cell. Gets or sets whether the event has finished drawing the cell. Gets a value that determines if the event was fired only to measure the cell. Get the row index of the cell being painted.

OwnerDrawCellEventArgs.Bounds Field
Get the rectangle where the cell will be painted (in client coordinates).

694 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public ReadOnly Bounds As Rectangle [C#] public readonly Rectangle Bounds [Delphi] public Bounds: Rectangle; See Also OwnerDrawCellEventArgs Class | OwnerDrawCellEventArgs Members | C1.Win.C1FlexGrid Namespace

OwnerDrawCellEventArgs.Col Field
Get the column index of the cell being painted. [Visual Basic] Public ReadOnly Col As Integer [C#] public readonly int Col [Delphi] public Col: Int32; See Also OwnerDrawCellEventArgs Class | OwnerDrawCellEventArgs Members | C1.Win.C1FlexGrid Namespace

OwnerDrawCellEventArgs.Graphics Field
Gets the Graphics object used to draw the cell. Use this object to draw custom elements in the cell. [Visual Basic] Public ReadOnly Graphics As Graphics [C#] public readonly Graphics Graphics [Delphi] public Graphics: Graphics; See Also OwnerDrawCellEventArgs Class | OwnerDrawCellEventArgs Members | C1.Win.C1FlexGrid Namespace

OwnerDrawCellEventArgs.Handled Field
Gets or sets whether the event has finished drawing the cell. [Visual Basic] Public Handled As Boolean [C#] public bool Handled

OwnerDrawCellEventArgs.Measuring Field 695

[Delphi] public Handled: Boolean; Remarks If this parameter is set to true, the grid assumes the call has been painted by the event handler. If it is set to false, the grid will paint the cell when the event returns. Note that calling the DrawCell method automatically sets this parameter to true. See Also OwnerDrawCellEventArgs Class | OwnerDrawCellEventArgs Members | C1.Win.C1FlexGrid Namespace

OwnerDrawCellEventArgs.Measuring Field
Gets a value that determines if the event was fired only to measure the cell. [Visual Basic] Public ReadOnly Measuring As Boolean [C#] public readonly bool Measuring [Delphi] public Measuring: Boolean; Remarks This occurs while autosizing rows and columns, since the event handler may may change the value displayed in the cell while handling this event. See Also OwnerDrawCellEventArgs Class | OwnerDrawCellEventArgs Members | C1.Win.C1FlexGrid Namespace

OwnerDrawCellEventArgs.Row Field
Get the row index of the cell being painted. [Visual Basic] Public ReadOnly Row As Integer [C#] public readonly int Row [Delphi] public Row: Int32; See Also OwnerDrawCellEventArgs Class | OwnerDrawCellEventArgs Members | C1.Win.C1FlexGrid Namespace

OwnerDrawCellEventArgs Properties
The properties of the OwnerDrawCellEventArgs class are listed here. For a complete list of OwnerDrawCellEventArgs class members, see the OwnerDrawCellEventArgs Members topic. Public Properties Image Gets or sets the image that will be displayed in the cell.

696 C1.Win.C1FlexGrid Namespace

Style Text See Also

Sets or sets the CellStyle object used to paint the cell. Gets or sets the text that will be displayed in the cell.

OwnerDrawCellEventArgs Class | C1.Win.C1FlexGrid Namespace

OwnerDrawCellEventArgs.Image Property
Gets or sets the image that will be displayed in the cell. [Visual Basic] Public Property Image As Image [C#] public Image Image {get;set;} [Delphi] public property Image: Image read get_Image write set_Image; Remarks Changing this value is an easy way to modify the image displayed in a cell without any custom drawing code. See Also OwnerDrawCellEventArgs Class | OwnerDrawCellEventArgs Members | C1.Win.C1FlexGrid Namespace

OwnerDrawCellEventArgs.Style Property
Sets or sets the CellStyle object used to paint the cell. [Visual Basic] Public Property Style As CellStyle [C#] public CellStyle Style {get;set;} [Delphi] public property Style: CellStyle read get_Style write set_Style; Remarks This parameter is often used to provide dynamic formatting based on cell contents. For example, if the cell contains a value outside a given range, the event handler may assign a new style to this parameter. Although it is legal to modify the members of the CellStyle parameter in this event, this is not recommended, since the change will affect other cells that may be using this style. Example The code below uses the C1FlexGridBase.OwnerDrawCell event to highlight cells that indicate low stock levels. Visual Basic ' create style used to display low-stock items Dim cs As CellStyle = _flex.Styles.Add("Critical") cs.BackColor = Color.Red

OwnerDrawCellEventArgs.Style Property 697

Private Sub _flex_OwnerDrawCell(sender As Object, e As C1.Win.C1FlexGrid.OwnerDrawCellEventArgs) ' ignore fixed cells If e.Row < _flex.Rows.Fixed Or e.Col < _flex.Cols.Fixed Then Return End If ' apply custom style if reorder level is critical If _flex.Cols(e.Col).Name = "UnitsInStock" Then ' change the style by applying the "Critical" style to the ' Style parameter do not change the e.Style.BackColor property ' directly since that would affect other cells that use this ' style) If CShort(_flex(e.Row, "UnitsInStock")) < CShort(_flex(e.Row, "ReorderLevel")) Then e.Style = _flex.Styles("Critical") End If End If End Sub C# // create style used to display low-stock items CellStyle cs = _flex.Styles.Add("Critical"); cs.BackColor = Color.Red; private void _flex_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e) { // ignore fixed cells if (e.Row < _flex.Rows.Fixed || e.Col < _flex.Cols.Fixed) return; // apply custom style if reorder level is critical if (_flex.Cols[e.Col].Name == "UnitsInStock") { // change the style by applying the "Critical" style to the Style parameter // (do not change the e.Style.BackColor property directly since that would // affect other cells that use this style) if ((short)_flex[e.Row, "UnitsInStock"] < (short)_flex[e.Row, "ReorderLevel"]) e.Style = _flex.Styles["Critical"]; } } Dephi // create style used to display low-stock items var cs := CellStyle; begin cs := _flex.Styles.Add('Critical'); cs.BackColor := Color.Red; end;

698 C1.Win.C1FlexGrid Namespace

procedure _flex_OwnerDrawCell(sender: object; e: C1.Win.C1FlexGrid.OwnerDrawCellEventArgs) begin // ignore fixed cells if ((e.Row < _flex.Rows.Fixed) or (e.Col < _flex.Cols.Fixed)) then Exit; // apply custom style if reorder level is critical if (_flex.Cols[e.Col].Name = 'UnitsInStock') then // change the style by applying the "Critical" style to the // Style parameter do not change the e.Style.BackColor property // directly since that would affect other cells that use this // style) if (SmallInt((_flex[e.Row] < (SmallInt(_flex[e.Row]))))) then e.Style := _flex.Styles['Critical']; end; See Also OwnerDrawCellEventArgs Class | OwnerDrawCellEventArgs Members | C1.Win.C1FlexGrid Namespace

OwnerDrawCellEventArgs.Text Property
Gets or sets the text that will be displayed in the cell. [Visual Basic] Public Property Text As String [C#] public string Text {get;set;} [Delphi] public property Text: String read get_Text write set_Text; Remarks Changing this value is an easy way to modify the text displayed in a cell without any custom drawing code. See Also OwnerDrawCellEventArgs Class | OwnerDrawCellEventArgs Members | C1.Win.C1FlexGrid Namespace

OwnerDrawCellEventArgs Methods
The methods of the OwnerDrawCellEventArgs class are listed here. For a complete list of OwnerDrawCellEventArgs class members, see the OwnerDrawCellEventArgs Members topic. Public Methods DrawCell See Also OwnerDrawCellEventArgs Class | C1.Win.C1FlexGrid Namespace Overloaded. Causes the grid to paint the whole cell.

OwnerDrawCellEventArgs.DrawCell Method 699

OwnerDrawCellEventArgs.DrawCell Method
Overload List Causes the grid to paint the whole cell. [Visual Basic] Overloads Public Sub DrawCell() [C#] public void DrawCell(); [Delphi] public procedure DrawCell(); overload; Causes the grid to paint parts of the cell (background, foreground, border, and so on.) [Visual Basic] Overloads Public Sub DrawCell(DrawCellFlags) [C#] public void DrawCell(DrawCellFlags); [Delphi] public procedure DrawCell(DrawCellFlags); overload; See Also OwnerDrawCellEventArgs Class | OwnerDrawCellEventArgs Members | C1.Win.C1FlexGrid Namespace

OwnerDrawCellEventArgs.DrawCell Method ()
Causes the grid to paint the whole cell. [Visual Basic] Overloads Public Sub DrawCell() [C#] public void DrawCell() [Delphi] public procedure DrawCell(); overload; See Also OwnerDrawCellEventArgs Class | OwnerDrawCellEventArgs Members | C1.Win.C1FlexGrid Namespace | OwnerDrawCellEventArgs.DrawCell Overload List

OwnerDrawCellEventArgs.DrawCell Method (DrawCellFlags)


Causes the grid to paint parts of the cell (background, foreground, border, and so on.) [Visual Basic] Overloads Public Sub DrawCell( _ ByVal flags As DrawCellFlags _ ) [C#] public void DrawCell( DrawCellFlags flags ); [Delphi] public procedure DrawCell( flags: DrawCellFlags ); overload;

700 C1.Win.C1FlexGrid Namespace

Parameters flags DrawCellFlags that specifies the parts of the cell. Remarks This method is typically called in C1FlexGridBase.OwnerDrawCell handlers when the code intends to draw some elements of the cell but not everything. For example, the code may want to draw a custom border only. In this case, it could call e.DrawCell(DrawCellFlags.Background | DrawCellFlags.Content) to draw the cell background and content, and later draw the custom border. Or the code could want to draw a custom marker in a cell (like a note indicator in Excel). In this case, it should call e.DrawCell() to draw the entire cell, and later add the note marker (little red triangle on the top right corner of the cell). If the owner-draw code draws the entire cell (including the background), then there's no need to call e.DrawCell at all. See Also OwnerDrawCellEventArgs Class | OwnerDrawCellEventArgs Members | C1.Win.C1FlexGrid Namespace | OwnerDrawCellEventArgs.DrawCell Overload List

OwnerDrawCellEventHandler Delegate
Represents the method that will handle the C1FlexGridBase.OwnerDrawCell event. [Visual Basic] Public Delegate Sub OwnerDrawCellEventHandler( _ ByVal sender As Object, _ ByVal e As OwnerDrawCellEventArgs _ ) [C#] public delegate void OwnerDrawCellEventHandler( object sender, OwnerDrawCellEventArgs e ); [Delphi] type OwnerDrawCellEventHandler = procedure ( sender: Object; e: OwnerDrawCellEventArgs ) of object; Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also C1.Win.C1FlexGrid Namespace

PrintGridFlags Enumeration
Contains flags that specify printing options to use with the C1FlexGridBase.PrintGrid method.

RangeEventArgs Class 701

[Visual Basic] Public Enum PrintGridFlags [C#] public enum PrintGridFlags [Delphi] type PrintGridFlags = (ActualSize, ExtendLastCol, FitToPage, FitToPageWidth, ShowHighlight, ShowPageSetupDialog, ShowPreviewDialog, ShowPrintDialog); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name ActualSize Description Print the grid in actual (screen size). If the grid is too wide to fit on a page, columns spill onto separate pages. If the grid is too tall to fit on a page, rows spill onto additional pages. Extend the last column on each printed page. Scale the grid so it will fit on a single page (rows and columns). Scale the grid so its width will fit on a single page. If the grid is too tall to fit on a page, rows spill onto additional pages. Show highlighted selection while printing. Show a page setup dialog before printing so the user can select paper size, orientation, and margins. Show a print preview dialog before printing so the user can inspect the document before printing it. Show a print setup dialog before printing so the user can select the printer to use.

ExtendLastCol FitToPage FitToPageWidth

ShowHighlight ShowPageSetupDialog ShowPreviewDialog ShowPrintDialog See Also C1.Win.C1FlexGrid Namespace

RangeEventArgs Class
Provides data for the C1FlexGridBase.AfterRowColChange, C1FlexGridBase.AfterScroll, C1FlexGridBase.AfterSelChange, C1FlexGridBase.BeforeRowColChange, C1FlexGridBase.BeforeScroll, and C1FlexGridBase.BeforeSelChange events. For a list of all members of this type, see RangeEventArgs Members. System.Object System.EventArgs C1.Win.C1FlexGrid.RangeEventArgs

702 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Class RangeEventArgs Inherits EventArgs [C#] public class RangeEventArgs : EventArgs [Delphi] type RangeEventArgs = class (EventArgs); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also RangeEventArgs Members | C1.Win.C1FlexGrid Namespace

RangeEventArgs Members
RangeEventArgs overview Public Constructors RangeEventArgs Constructor Public Fields Cancel NewRange OldRange See Also RangeEventArgs Class | C1.Win.C1FlexGrid Namespace Gets or sets a value indicating whether the new selection should be canceled. Gets the range that will be selected after the event. Gets the range selected before the event. Initializes a new instance of the RangeEventArgs class.

RangeEventArgs Constructor
Initializes a new instance of the RangeEventArgs class. [Visual Basic] Public Function New( _ ByVal rgOld As CellRange, _ ByVal rgNew As CellRange _ ) [C#] public RangeEventArgs( CellRange rgOld, CellRange rgNew );

RangeEventArgs Fields 703

[Delphi] public constructor Create( rgOld: CellRange; rgNew: CellRange ); Parameters rgOld The range selected before the event. rgNew The range that will be selected after the event. See Also RangeEventArgs Class | RangeEventArgs Members | C1.Win.C1FlexGrid Namespace

RangeEventArgs Fields
The fields of the RangeEventArgs class are listed here. For a complete list of RangeEventArgs class members, see the RangeEventArgs Members topic. Public Fields Cancel NewRange OldRange See Also RangeEventArgs Class | C1.Win.C1FlexGrid Namespace Gets or sets a value indicating whether the new selection should be canceled. Gets the range that will be selected after the event. Gets the range selected before the event.

RangeEventArgs.Cancel Field
Gets or sets a value indicating whether the new selection should be canceled. [Visual Basic] Public Cancel As Boolean [C#] public bool Cancel [Delphi] public Cancel: Boolean; See Also RangeEventArgs Class | RangeEventArgs Members | C1.Win.C1FlexGrid Namespace

RangeEventArgs.NewRange Field
Gets the range that will be selected after the event. [Visual Basic] Public ReadOnly NewRange As CellRange

704 C1.Win.C1FlexGrid Namespace

[C#] public readonly CellRange NewRange [Delphi] public NewRange: CellRange; See Also RangeEventArgs Class | RangeEventArgs Members | C1.Win.C1FlexGrid Namespace

RangeEventArgs.OldRange Field
Gets the range selected before the event. [Visual Basic] Public ReadOnly OldRange As CellRange [C#] public readonly CellRange OldRange [Delphi] public OldRange: CellRange; See Also RangeEventArgs Class | RangeEventArgs Members | C1.Win.C1FlexGrid Namespace

RangeEventHandler Delegate
Represents the method that will handle the C1FlexGridBase.AfterRowColChange, C1FlexGridBase.AfterScroll, C1FlexGridBase.AfterSelChange, C1FlexGridBase.BeforeRowColChange, C1FlexGridBase.BeforeScroll, and C1FlexGridBase.BeforeSelChange events. [Visual Basic] Public Delegate Sub RangeEventHandler( _ ByVal sender As Object, _ ByVal e As RangeEventArgs _ ) [C#] public delegate void RangeEventHandler( object sender, RangeEventArgs e ); [Delphi] type RangeEventHandler = procedure ( sender: Object; e: RangeEventArgs ) of object; Parameters sender Object that fired the event.

Row Class 705

e RangeEventArgs object that contains the event data. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also C1.Win.C1FlexGrid Namespace

Row Class
Class that represents a grid row. For a list of all members of this type, see Row Members. System.Object C1.Win.C1FlexGrid.RowCol C1.Win.C1FlexGrid.Row [Visual Basic] Public Class Row Inherits RowCol [C#] public class Row : RowCol [Delphi] type Row = class (RowCol); Remarks This class does not have a public constructor. You can add and remove rows using methods in the grid's C1FlexGridBase.Rows property, which exposes the row collection. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also Row Members | C1.Win.C1FlexGrid Namespace

Row Members
Row overview Public Properties AllowDragging (inherited from RowCol) AllowEditing (inherited from RowCol) AllowMerging (inherited from RowCol) Gets or sets whether the user can drag this row or column with the mouse. Gets or sets whether cells on this row or column can be edited by the user. Specifies whether adjacent cells with similar contents will be merged.

706 C1.Win.C1FlexGrid Namespace

AllowResizing (inherited from RowCol) Bottom Caption ComboList (inherited from RowCol) DataIndex DataMap (inherited from RowCol)

Gets or sets whether the user can resize this row or column with the mouse. Gets the position of the bottom of this row, in pixels, relative to the grid. Gets or sets the text of the first fixed cell in the row. Gets or sets a list of items to be used by the drop-down editor. Gets the index of this row in the RowCollection collection, excluding fixed and node rows. Gets or sets an Collections.IDictionary object used to translate data values into display values for this row or column. Gets the object that provides data for this row. Gets or sets the type of object stored in this row or column. Gets or sets the input mask to use when editing cells on this column. Gets or sets the custom editor used to edit cells in this column. Gets or sets a string that specifies how to format the data on this column. Gets or sets the height of this row, in pixels (the value -1 represents the default row height). Gets or sets the display height for this row, in pixels. Gets or sets an ImageAlignEnum value that determines how images are aligned in scrollable cells on this row or column. Gets or sets an ImageAlignEnum value that determines how images are aligned in fixed cells on this row or column. Gets or sets a value that determines whether images found in this row or column's ImageMap should be displayed instead of or in addition to the cell text. Gets or sets an Collections.IDictionary object used to translate data values into images for this row or column. Overridden. Gets the index of this row in the RowCollection collection. Indicates the row is a placeholder for adding new rows to the grid. Gets or sets whether this row is a node row in an outline. Overloaded. Gets or sets the cell value specified by the column index in this row.

DataSource DataType (inherited from RowCol) EditMask (inherited from RowCol) Editor (inherited from RowCol) Format (inherited from RowCol) Height HeightDisplay ImageAlign (inherited from RowCol)

ImageAlignFixed (inherited from RowCol)

ImageAndText (inherited from RowCol)

ImageMap (inherited from RowCol)

Index IsNew IsNode Item

Row Properties 707

Node SafeIndex Selected Style (inherited from RowCol) StyleDisplay (inherited from RowCol) StyleFixed (inherited from RowCol) StyleFixedDisplay (inherited from RowCol) StyleFixedNew (inherited from RowCol) StyleNew (inherited from RowCol) TextAlign (inherited from RowCol)

Gets the Node object associated with this row. Gets the index of this row in the RowCollection collection. Overridden. Gets or sets whether this row is selected. Gets or sets a custom CellStyle associated with this row or column. Gets the style used to display this row or column. Gets the stock CellStyle used to paint fixed cells in this row or column. Gets the style used to display fixed cells on this row or column. Gets the custom style associated with fixed cells on this row or column, createing a new one of necessary. Gets or sets a custom CellStyle associated with this row or column, creating a new style if necessary. Gets or sets a TextAlignEnum value that determines how text is aligned in scrollable cells on this row or column. Gets or sets a TextAlignEnum value that determines how text is aligned in fixed cells on this row or column. Gets the position of the top of this row, in pixels, relative to the grid. Gets or sets user data associated with this row or column. Gets or sets whether a Row or Column is visible. Overridden. Clears this row. Overridden. Invalidates this row, causing it to be repainted. Overridden. Moves a row to a new position in the collection.

TextAlignFixed (inherited from RowCol) Top UserData (inherited from RowCol) Visible (inherited from RowCol) Public Methods Clear Invalidate Move See Also Row Class | C1.Win.C1FlexGrid Namespace

Row Properties
The properties of the Row class are listed here. For a complete list of Row class members, see the Row Members topic. Public Properties AllowDragging (inherited from RowCol) AllowEditing (inherited from RowCol) Gets or sets whether the user can drag this row or column with the mouse. Gets or sets whether cells on this row or column can be edited by the user.

708 C1.Win.C1FlexGrid Namespace

AllowMerging (inherited from RowCol) AllowResizing (inherited from RowCol) Bottom Caption ComboList (inherited from RowCol) DataIndex DataMap (inherited from RowCol)

Specifies whether adjacent cells with similar contents will be merged. Gets or sets whether the user can resize this row or column with the mouse. Gets the position of the bottom of this row, in pixels, relative to the grid. Gets or sets the text of the first fixed cell in the row. Gets or sets a list of items to be used by the drop-down editor. Gets the index of this row in the RowCollection collection, excluding fixed and node rows. Gets or sets an Collections.IDictionary object used to translate data values into display values for this row or column. Gets the object that provides data for this row. Gets or sets the type of object stored in this row or column. Gets or sets the input mask to use when editing cells on this column. Gets or sets the custom editor used to edit cells in this column. Gets or sets a string that specifies how to format the data on this column. Gets or sets the height of this row, in pixels (the value -1 represents the default row height). Gets or sets the display height for this row, in pixels. Gets or sets an ImageAlignEnum value that determines how images are aligned in scrollable cells on this row or column. Gets or sets an ImageAlignEnum value that determines how images are aligned in fixed cells on this row or column. Gets or sets a value that determines whether images found in this row or column's ImageMap should be displayed instead of or in addition to the cell text. Gets or sets an Collections.IDictionary object used to translate data values into images for this row or column. Overridden. Gets the index of this row in the RowCollection collection. Indicates the row is a placeholder for adding new rows to the grid. Gets or sets whether this row is a node row in an outline.

DataSource DataType (inherited from RowCol) EditMask (inherited from RowCol) Editor (inherited from RowCol) Format (inherited from RowCol) Height HeightDisplay ImageAlign (inherited from RowCol)

ImageAlignFixed (inherited from RowCol)

ImageAndText (inherited from RowCol)

ImageMap (inherited from RowCol)

Index IsNew IsNode

Row.Bottom Property 709

Item Node SafeIndex Selected Style (inherited from RowCol) StyleDisplay (inherited from RowCol) StyleFixed (inherited from RowCol) StyleFixedDisplay (inherited from RowCol) StyleFixedNew (inherited from RowCol) StyleNew (inherited from RowCol) TextAlign (inherited from RowCol)

Overloaded. Gets or sets the cell value specified by the column index in this row. Gets the Node object associated with this row. Gets the index of this row in the RowCollection collection. Overridden. Gets or sets whether this row is selected. Gets or sets a custom CellStyle associated with this row or column. Gets the style used to display this row or column. Gets the stock CellStyle used to paint fixed cells in this row or column. Gets the style used to display fixed cells on this row or column. Gets the custom style associated with fixed cells on this row or column, createing a new one of necessary. Gets or sets a custom CellStyle associated with this row or column, creating a new style if necessary. Gets or sets a TextAlignEnum value that determines how text is aligned in scrollable cells on this row or column. Gets or sets a TextAlignEnum value that determines how text is aligned in fixed cells on this row or column. Gets the position of the top of this row, in pixels, relative to the grid. Gets or sets user data associated with this row or column. Gets or sets whether a Row or Column is visible.

TextAlignFixed (inherited from RowCol) Top UserData (inherited from RowCol) Visible (inherited from RowCol) See Also Row Class | C1.Win.C1FlexGrid Namespace

Row.Bottom Property
Gets the position of the bottom of this row, in pixels, relative to the grid. [Visual Basic] Public ReadOnly Property Bottom As Integer [C#] public int Bottom {get;} [Delphi] public property Bottom: Int32 read get_Bottom; Remarks The value returned corresponds to the sum of the Top and HeightDisplay properties.

710 C1.Win.C1FlexGrid Namespace

See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row.Caption Property
Gets or sets the text of the first fixed cell in the row. [Visual Basic] Public Property Caption As String [C#] public string Caption {get;set;} [Delphi] public property Caption: String read get_Caption write set_Caption; See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row.DataIndex Property
Gets the index of this row in the RowCollection collection, excluding fixed and node rows. [Visual Basic] Public ReadOnly Property DataIndex As Integer [C#] public int DataIndex {get;} [Delphi] public property DataIndex: Int32 read get_DataIndex; Remarks This property returns -1 if the row is a fixed or node row. If the grid is bound to a data source, the return value can be used as an indexer into the grid's data source to obtain a reference to the item bound to the row. You can also obtain the underlying data object directly using the row's DataSource property. See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row.DataSource Property
Gets the object that provides data for this row. [Visual Basic] Public ReadOnly Property DataSource As Object [C#] public object DataSource {get;} [Delphi] public property DataSource: Object read get_DataSource;

Row.Height Property 711

Remarks The type of object returned depends on the type of DataSource assigned to the grid. For example, if the grid is bound to a Data.DataView object, then this property will return the specific Data.DataRowView object that is bound to this row. This property returns null if the grid is unbound, or if the row is a fixed or node row that doesn't correspond to any objects in the grid's data source. For an example, see the C1FlexGridBase.GetUnboundValue event. See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row.Height Property
Gets or sets the height of this row, in pixels (the value -1 represents the default row height). [Visual Basic] Public Property Height As Integer [C#] public int Height {get;set;} [Delphi] public property Height: Int32 read get_Height write set_Height; Remarks Setting this property to -1 causes the grid to use the default row height for this row (see the RowColCollection.DefaultSize property). Height returns the height assigned to the row even if the row is invisible, and returns -1 if the row has the default height. To obtain the actual display height of a row, use the HeightDisplay property. See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row.HeightDisplay Property
Gets or sets the display height for this row, in pixels. [Visual Basic] Public Property HeightDisplay As Integer [C#] public int HeightDisplay {get;set;} [Delphi] public property HeightDisplay: Int32 read get_HeightDisplay write set_HeightDisplay; Remarks HeightDisplay returns zero if the row is invisible, and returns the actual display height even if the Height property is set to -1 (which stands for default row height). See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

712 C1.Win.C1FlexGrid Namespace

Row.Index Property
Gets the index of this row in the RowCollection collection. [Visual Basic] Overrides Public ReadOnly Property Index As Integer [C#] override public int Index {get;} [Delphi] public property Index: Int32 read get_Index; Remarks This property returns -1 if the Row is not a member of the collection. See also the SafeIndex and DataIndex properties. See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row.IsNew Property
Indicates the row is a placeholder for adding new rows to the grid. [Visual Basic] Public ReadOnly Property IsNew As Boolean [C#] public bool IsNew {get;} [Delphi] public property IsNew: Boolean read get_IsNew; Remarks This property returns true for the last row on the grid when the C1FlexGridBase.AllowAddNew property is set to true. This is the row that has an asterisk glyph on the first fixed column. See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row.IsNode Property
Gets or sets whether this row is a node row in an outline. [Visual Basic] Public Property IsNode As Boolean [C#] public bool IsNode {get;set;} [Delphi] public property IsNode: Boolean read get_IsNode write set_IsNode;

Row.Item Property 713

Remarks This property determines whether the row behaves as a node in an outline tree. You can use IsNode to create custom outline trees, or use the grid's C1FlexGridBase.Subtotal method to create outline trees automatically. See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row.Item Property
Overload List Gets or sets the cell value specified by the column index in this row. [Visual Basic] Overloads Public Default Property Item(Integer) As Object [C#] public object this[int]{get;set;} [Delphi] public property Item[columnIndex: Int32]: Object read get_Item write set_Item; Gets or sets the cell value specified by the column name in this row. [Visual Basic] Overloads Public Default Property Item(String) As Object [C#] public object this[string]{get;set;} [Delphi] public property Item[columnName: String]: Object read get_Item write set_Item; See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row.Item Property (Int32)


Gets or sets the cell value specified by the column index in this row. [Visual Basic] Public Default Property Item( _ ByVal columnIndex As Integer _ ) As Object [C#] public object this[ int columnIndex ] {get;set;} [Delphi] public property Item[ columnIndex: Int32 ]: Object read get_Item write set_Item; See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace | Row.Item Overload List

Row.Item Property (String)


Gets or sets the cell value specified by the column name in this row.

714 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Default Property Item( _ ByVal columnName As String _ ) As Object [C#] public object this[ string columnName ] {get;set;} [Delphi] public property Item[ columnName: String ]: Object read get_Item write set_Item; See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace | Row.Item Overload List

Row.Node Property
Gets the Node object associated with this row. [Visual Basic] Public ReadOnly Property Node As Node [C#] public Node Node {get;} [Delphi] public property Node: Node read get_Node; Remarks If the row is a node (see the IsNode property), this property returns a Node object that can be used to collapse or expand the node, set its level within the outline tree, and so on. If the row is not a node, this property gets the row's parent node. See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row.SafeIndex Property
Gets the index of this row in the RowCollection collection. [Visual Basic] Overridable Public ReadOnly Property SafeIndex As Integer [C#] virtual public int SafeIndex {get;} [Delphi] public property SafeIndex: Int32 read get_SafeIndex;

Row.Selected Property 715

Remarks This property is similar to the Index property, except it throws an exception if the Row is not a member of the collection. See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row.Selected Property
Gets or sets whether this row is selected. [Visual Basic] Overrides Public Property Selected As Boolean [C#] override public bool Selected {get;set;} [Delphi] public property Selected: Boolean read get_Selected write set_Selected; Remarks Use this property to get or set the selection status for individual rows when the grid's Windows.Forms.SelectionMode property is set to SelectionModeEnum.ListBox. See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row.Top Property
Gets the position of the top of this row, in pixels, relative to the grid. [Visual Basic] Public ReadOnly Property Top As Integer [C#] public int Top {get;} [Delphi] public property Top: Int32 read get_Top; Remarks The value returned is the sum of row heights from the top of the grid until this row, and does not account for the scroll position. To account for the scroll position, this value should be adjusted using the grid's ScrollableControl.ScrollPosition property. To retrieve the size and position of a cell, use the C1FlexGridBase.GetCellRect method. See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row Methods
The methods of the Row class are listed here. For a complete list of Row class members, see the Row Members topic.

716 C1.Win.C1FlexGrid Namespace

Public Methods Clear Invalidate Move See Also Row Class | C1.Win.C1FlexGrid Namespace Overridden. Clears this row. Overridden. Invalidates this row, causing it to be repainted. Overridden. Moves a row to a new position in the collection.

Row.Clear Method
Clears this row. [Visual Basic] Overrides Public Sub Clear( _ ByVal clearFlags As ClearFlags _ ) [C#] override public void Clear( ClearFlags clearFlags ); [Delphi] public procedure Clear( clearFlags: ClearFlags ); override; Parameters clearFlags ClearFlags value specifying which elements of the row should be cleared. Remarks Use this method to reset row properties to their default values (height, visibility, style, user data, and so on). See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row.Invalidate Method
Invalidates this row, causing it to be repainted. [Visual Basic] Overrides Public Sub Invalidate() [C#] override public void Invalidate() [Delphi] public procedure Invalidate(); override;

Row.Move Method 717

See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

Row.Move Method
Moves a row to a new position in the collection. [Visual Basic] Overrides Public Sub Move( _ ByVal indexNew As Integer _ ) [C#] override public void Move( int indexNew ); [Delphi] public procedure Move( indexNew: Int32 ); override; Parameters indexNew An integer specifying the row's new position. See Also Row Class | Row Members | C1.Win.C1FlexGrid Namespace

RowCol Class
Base class for grid rows and columns ( Row and Column classes). For a list of all members of this type, see RowCol Members. System.Object C1.Win.C1FlexGrid.RowCol C1.Win.C1FlexGrid.Column C1.Win.C1FlexGrid.Row [Visual Basic] MustInherit Public Class RowCol [C#] public abstract class RowCol [Delphi] type RowCol = class abstract; Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll)

718 C1.Win.C1FlexGrid Namespace

See Also RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol Members
RowCol overview Public Properties AllowDragging AllowEditing AllowMerging AllowResizing ComboList DataMap Gets or sets whether the user can drag this row or column with the mouse. Gets or sets whether cells on this row or column can be edited by the user. Specifies whether adjacent cells with similar contents will be merged. Gets or sets whether the user can resize this row or column with the mouse. Gets or sets a list of items to be used by the drop-down editor. Gets or sets an Collections.IDictionary object used to translate data values into display values for this row or column. Gets or sets the type of object stored in this row or column. Gets or sets the input mask to use when editing cells on this column. Gets or sets the custom editor used to edit cells in this column. Gets or sets a string that specifies how to format the data on this column. Gets or sets an ImageAlignEnum value that determines how images are aligned in scrollable cells on this row or column. Gets or sets an ImageAlignEnum value that determines how images are aligned in fixed cells on this row or column. Gets or sets a value that determines whether images found in this row or column's ImageMap should be displayed instead of or in addition to the cell text. Gets or sets an Collections.IDictionary object used to translate data values into images for this row or column. Gets the index of this row or column in its parent collection (or -1 if the element is not a member of the collection). Gets or sets whether this row or column is selected.

DataType EditMask Editor Format ImageAlign

ImageAlignFixed

ImageAndText

ImageMap

Index

Selected

RowCol Constructor 719

Style StyleDisplay StyleFixed StyleFixedDisplay StyleFixedNew StyleNew TextAlign

Gets or sets a custom CellStyle associated with this row or column. Gets the style used to display this row or column. Gets the stock CellStyle used to paint fixed cells in this row or column. Gets the style used to display fixed cells on this row or column. Gets the custom style associated with fixed cells on this row or column, createing a new one of necessary. Gets or sets a custom CellStyle associated with this row or column, creating a new style if necessary. Gets or sets a TextAlignEnum value that determines how text is aligned in scrollable cells on this row or column. Gets or sets a TextAlignEnum value that determines how text is aligned in fixed cells on this row or column. Gets or sets user data associated with this row or column. Gets or sets whether a Row or Column is visible. Clears the contents of the row or column. Invalidates an individual row or column, causing it to be repainted. Moves this row or column to a new position in the collection. Initializes a new instance of the RowCol class.

TextAlignFixed UserData Visible Public Methods Clear Invalidate Move Protected Constructors RowCol Constructor See Also RowCol Class | C1.Win.C1FlexGrid Namespace

RowCol Constructor
Initializes a new instance of the RowCol class. [Visual Basic] Protected Function New() [C#] protected RowCol() [Delphi] strict protected constructor Create(); See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

720 C1.Win.C1FlexGrid Namespace

RowCol Properties
The properties of the RowCol class are listed here. For a complete list of RowCol class members, see the RowCol Members topic. Public Properties AllowDragging AllowEditing AllowMerging AllowResizing ComboList DataMap Gets or sets whether the user can drag this row or column with the mouse. Gets or sets whether cells on this row or column can be edited by the user. Specifies whether adjacent cells with similar contents will be merged. Gets or sets whether the user can resize this row or column with the mouse. Gets or sets a list of items to be used by the drop-down editor. Gets or sets an Collections.IDictionary object used to translate data values into display values for this row or column. Gets or sets the type of object stored in this row or column. Gets or sets the input mask to use when editing cells on this column. Gets or sets the custom editor used to edit cells in this column. Gets or sets a string that specifies how to format the data on this column. Gets or sets an ImageAlignEnum value that determines how images are aligned in scrollable cells on this row or column. Gets or sets an ImageAlignEnum value that determines how images are aligned in fixed cells on this row or column. Gets or sets a value that determines whether images found in this row or column's ImageMap should be displayed instead of or in addition to the cell text. Gets or sets an Collections.IDictionary object used to translate data values into images for this row or column. Gets the index of this row or column in its parent collection (or -1 if the element is not a member of the collection). Gets or sets whether this row or column is selected. Gets or sets a custom CellStyle associated with this row or column. Gets the style used to display this row or column.

DataType EditMask Editor Format ImageAlign

ImageAlignFixed

ImageAndText

ImageMap

Index

Selected Style StyleDisplay

RowCol.AllowDragging Property 721

StyleFixed StyleFixedDisplay StyleFixedNew StyleNew TextAlign

Gets the stock CellStyle used to paint fixed cells in this row or column. Gets the style used to display fixed cells on this row or column. Gets the custom style associated with fixed cells on this row or column, createing a new one of necessary. Gets or sets a custom CellStyle associated with this row or column, creating a new style if necessary. Gets or sets a TextAlignEnum value that determines how text is aligned in scrollable cells on this row or column. Gets or sets a TextAlignEnum value that determines how text is aligned in fixed cells on this row or column. Gets or sets user data associated with this row or column. Gets or sets whether a Row or Column is visible.

TextAlignFixed UserData Visible See Also RowCol Class | C1.Win.C1FlexGrid Namespace

RowCol.AllowDragging Property
Gets or sets whether the user can drag this row or column with the mouse. [Visual Basic] Overridable Public Property AllowDragging As Boolean [C#] virtual public bool AllowDragging {get;set;} [Delphi] public property AllowDragging: Boolean read get_AllowDragging write set_AllowDragging; Remarks The grid object also has an C1FlexGridBase.AllowDragging property. If dragging is disabled at the grid level, the user will not be able to drag any rows or columns. If dragging is allowed by the grid's C1FlexGridBase.AllowDragging property, then dragging of individual rows and columns can still be disabled by setting this property to false. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.AllowEditing Property
Gets or sets whether cells on this row or column can be edited by the user. [Visual Basic] Overridable Public Property AllowEditing As Boolean

722 C1.Win.C1FlexGrid Namespace

[C#] virtual public bool AllowEditing {get;set;} [Delphi] public property AllowEditing: Boolean read get_AllowEditing write set_AllowEditing; Remarks The grid object also has an C1FlexGridBase.AllowEditing property. If editing is disabled at the grid level, the user will not be able to edit any cells. If editing is allowed by the grid's C1FlexGridBase.AllowEditing property, then editing of individual rows and columns can still be disabled by setting this property to false. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.AllowMerging Property
Specifies whether adjacent cells with similar contents will be merged. [Visual Basic] Overridable Public Property AllowMerging As Boolean [C#] virtual public bool AllowMerging {get;set;} [Delphi] public property AllowMerging: Boolean read get_AllowMerging write set_AllowMerging; Remarks Merging cells allows you to display data in a clear, appealing way because it highlights groups of identical information. It also gives you flexibility to build tables similar to the ones you can create in HTML or using Microsoft Word, both of which support merged cells. To create tables with merged cells, you must set the AllowMerging property to a value other than AllowMergingEnum.None, and then set the AllowMerging property of individual rows and columns true for the rows and columns you wish to merge. After these properties are set, the grid will automatically merge adjacent cells that have the same contents. Whenever the cell contents change, the grid updates the merging state. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.AllowResizing Property
Gets or sets whether the user can resize this row or column with the mouse. [Visual Basic] Overridable Public Property AllowResizing As Boolean [C#] virtual public bool AllowResizing {get;set;}

RowCol.ComboList Property 723

[Delphi] public property AllowResizing: Boolean read get_AllowResizing write set_AllowResizing; Remarks To resize rows or columns, the mouse must be over the fixed area of the grid, and close to a border between rows or columns. The mouse pointer will then change into a sizing pointer and the user can drag the row or column to change the row height or column width. If a group of columns is selected (from first to last row) and the user resizes one of them, all selected columns are resized. The same applies to rows. If column sizing is allowed, users may double-click the resizing area to resize a column so it will automatically fit the longest entry. Rows with zero height and columns with zero width can't be resized by the user. If you want to make them very small but still resizable, set their height or width to one pixel, not to zero. The C1FlexGridBase.BeforeResizeRow and C1FlexGridBase.BeforeResizeColumn events fire before resizing starts, and may be used to prevent resizing of specific rows and columns. The C1FlexGridBase.AfterResizeRow and C1FlexGridBase.AfterResizeColumn fire after resizing, and may be used to validate the user's action and to update the display. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.ComboList Property
Gets or sets a list of items to be used by the drop-down editor. [Visual Basic] Public Property ComboList As String [C#] public string ComboList {get;set;} [Delphi] public property ComboList: String read get_ComboList write set_ComboList; Remarks The ComboList property specifies the type of editor to be used when editing a cell. You may use a text box, drop-down list, drop-down combo, or an edit button to pop up custom editor forms. To use the ComboList property, set the C1FlexGridBase.AllowEditing property to True, and set the ComboList property to a string that describes the type of editing you want to use for that cell. The options are described below: 1. 2. 3. To edit the cell using a regular text box, set the ComboList property to an empty string (""). To edit the cell using a drop-down list, set the ComboList property to a string containing the available options, separated by pipe characters (for example "option 1| option 2"). To edit the cell using a drop-down combo, set the ComboList property to a string containing the available options, separated by pipe characters and starting with a pipe character (for example "|option 1|option 2"). To display an edit button, set the ComboList property to a string containing an ellipsis ("..."). Edit buttons look like regular push buttons, aligned to the right of the cell, with an ellipsis as a caption. When the user

4.

724 C1.Win.C1FlexGrid Namespace

clicks on the edit button, the grid fires the C1FlexGridBase.CellButtonClick event. In this case, the user can't edit the cell contents directly. 5. To display an edit button next to an editable cell, set the ComboList property to a string containing a pipe and an ellipsis ("|..."). In this case, you get a regular edit button but the user can also edit the cell contents directly.

Note that the ComboList property has precedence over the DataMap property. Using both properties on a single row or column is legal, but it effetively disables the DataMap. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.DataMap Property
Gets or sets an Collections.IDictionary object used to translate data values into display values for this row or column. [Visual Basic] Public Property DataMap As IDictionary [C#] public IDictionary DataMap {get;set;} [Delphi] public property DataMap: IDictionary read get_DataMap write set_DataMap; Remarks The DataMap property allows you to implement "translated" rows or columns. In translated rows or columns, the grid does not display the values stored in the cells. Instead, it looks up those values in the column's DataMap and displays the mapped value. The grid also uses the DataMap value to populate drop-down lists when the column is editable. Note that the DataMap property has no effect when the ComboList property is also set. Using both properties on a single row or column is legal, but it effetively disables the DataMap. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.DataType Property
Gets or sets the type of object stored in this row or column. [Visual Basic] Overridable Public Property DataType As Type [C#] virtual public Type DataType {get;set;} [Delphi] public property DataType: Type read get_DataType write set_DataType; Remarks By default, the column's DataType property is set to Object, which allows you to store any data values in the column.

RowCol.EditMask Property 725

If you set a row or column's DataType to a specific type, the grid will try to convert any values assigned to cells in that column to the specified data type. If the conversion fails, the grid will fire a C1FlexGridBase.GridError event and the cell value will not be changed. The DataType property affects how values are stored internally in the grid, how they are sorted, and the type of control that is used to edit the values in the column. For example, a Windows.Forms.DateTimePicker control is used to edit values in DateTime columns, and check boxes are used to display and edit values in Boolean columns. If you want to store times (not dates) in a column, you can still use the DateTime type, but you should use a Format that displays only the time, not the date. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.EditMask Property
Gets or sets the input mask to use when editing cells on this column. [Visual Basic] Public Property EditMask As String [C#] public string EditMask {get;set;} [Delphi] public property EditMask: String read get_EditMask write set_EditMask; Remarks The grid also has an C1FlexGridBase.EditMask property that applies to the entire grid. For details and mask syntax, refer to that property. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.Editor Property
Gets or sets the custom editor used to edit cells in this column. [Visual Basic] Overridable Public Property Editor As Control [C#] virtual public Control Editor {get;set;} [Delphi] public property Editor: Control read get_Editor write set_Editor; Remarks The grid provides several built-in editors that are automatically selected based on the properties of the cell being edited. This property allows you to use external editors when editing values in a given column. Any control can be used as an external editor, but to achieve complete integration with the grid, the external editor should implement the IC1EmbeddedEditor interface.

726 C1.Win.C1FlexGrid Namespace

You can associate external editors with columns at design time (using the grid's Column Editor) or at run time, by setting this property. Example The code below creates a C1DateEdit control and assigns it to the Editor property of a grid column. The control will be used to edit cells on this column instead of the default Windows.Forms.DateTimePicker control. All controls in the C1Input library implement the IC1EmbeddedEditor interface and can be used as grid editors without any extra code. Visual Basic ' create C1DateEdit control (included with C1Input) Dim dateEdit As C1DateEdit = New C1DateEdit() ' use the new control as an editor for a grid column _flex.Cols(1).DataType = Type.GetType(DateTime) _flex.Cols(1).Editor = c1DateEdit C# // create C1DateEdit control (included with C1Input) C1DateEdit dateEdit = new C1DateEdit(); // use the new control as an editor for a grid column _flex.Cols[1].DataType = typeof(DateTime); _flex.Cols[1].Editor = c1DateEdit; Delphi var dateEdit := C1DateEdit; begin // create C1DateEdit control (included with C1Input) dateEdit := C1DateEdit.Create; // use the new control as an editor for a grid column _flex.Cols[1].DataType := TypeOf(DateTime); _flex.Cols[1].Editor := c1DateEdit; end; See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.Format Property
Gets or sets a string that specifies how to format the data on this column. [Visual Basic] Public Property Format As String [C#] public string Format {get;set;} [Delphi] public property Format: String read get_Format write set_Format;

RowCol.ImageAlign Property 727

Remarks The Format property affects how values are formatted for display, not the values stored internally. To retrieve the formatted value of a cell, use the C1FlexGridBase.GetDataDisplay property. The Format string has the same semantics as the format argument in the .NET Format method. For details and a complete set of examples, see the .NET documentation. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.ImageAlign Property
Gets or sets an ImageAlignEnum value that determines how images are aligned in scrollable cells on this row or column. [Visual Basic] Public Property ImageAlign As ImageAlignEnum [C#] public ImageAlignEnum ImageAlign {get;set;} [Delphi] public property ImageAlign: ImageAlignEnum read get_ImageAlign write set_ImageAlign; See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.ImageAlignFixed Property
Gets or sets an ImageAlignEnum value that determines how images are aligned in fixed cells on this row or column. [Visual Basic] Public Property ImageAlignFixed As ImageAlignEnum [C#] public ImageAlignEnum ImageAlignFixed {get;set;} [Delphi] public property ImageAlignFixed: ImageAlignEnum read get_ImageAlignFixed write set_ImageAlignFixed; See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.ImageAndText Property
Gets or sets a value that determines whether images found in this row or column's ImageMap should be displayed instead of or in addition to the cell text. [Visual Basic] Public Property ImageAndText As Boolean

728 C1.Win.C1FlexGrid Namespace

[C#] public bool ImageAndText {get;set;} [Delphi] public property ImageAndText: Boolean read get_ImageAndText write set_ImageAndText; See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.ImageMap Property
Gets or sets an Collections.IDictionary object used to translate data values into images for this row or column. [Visual Basic] Public Property ImageMap As IDictionary [C#] public IDictionary ImageMap {get;set;} [Delphi] public property ImageMap: IDictionary read get_ImageMap write set_ImageMap; Remarks Use this property to associate data values in this row or column with images. For example, if a column contains country names, you can use this property to display the corresponding flags. Use the ImageAndText property to determine whether the image is displayed instead of or in addition to the cell text. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.Index Property
Gets the index of this row or column in its parent collection (or -1 if the element is not a member of the collection). [Visual Basic] Overridable Public ReadOnly Property Index As Integer [C#] virtual public int Index {get;} [Delphi] public property Index: Int32 read get_Index; See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.Selected Property
Gets or sets whether this row or column is selected.

RowCol.Style Property 729

[Visual Basic] Overridable Public Property Selected As Boolean [C#] virtual public bool Selected {get;set;} [Delphi] public property Selected: Boolean read get_Selected write set_Selected; Remarks Use this property to get or set the selection state for individual rows when the grid's Windows.Forms.SelectionMode property is set to SelectionModeEnum.ListBox. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.Style Property
Gets or sets a custom CellStyle associated with this row or column. [Visual Basic] Overridable Public Property Style As CellStyle [C#] virtual public CellStyle Style {get;set;} [Delphi] public property Style: CellStyle read get_Style write set_Style; Remarks If this element does not have a custom style, this property returns null. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.StyleDisplay Property
Gets the style used to display this row or column. [Visual Basic] Overridable Public ReadOnly Property StyleDisplay As CellStyle [C#] virtual public CellStyle StyleDisplay {get;} [Delphi] public property StyleDisplay: CellStyle read get_StyleDisplay; Remarks This property never returns null. If the row or column has a custom style, this property returns that style. Otherwise, it returns the stock style used to display the row (for example, Normal, Alternate, Fixed, Frozen). See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

730 C1.Win.C1FlexGrid Namespace

RowCol.StyleFixed Property
Gets the stock CellStyle used to paint fixed cells in this row or column. [Visual Basic] Overridable Public Property StyleFixed As CellStyle [C#] virtual public CellStyle StyleFixed {get;set;} [Delphi] public property StyleFixed: CellStyle read get_StyleFixed write set_StyleFixed; See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.StyleFixedDisplay Property
Gets the style used to display fixed cells on this row or column. [Visual Basic] Overridable Public ReadOnly Property StyleFixedDisplay As CellStyle [C#] virtual public CellStyle StyleFixedDisplay {get;} [Delphi] public property StyleFixedDisplay: CellStyle read get_StyleFixedDisplay; Remarks If the row or column has a custom style associated with its fixed cells, this property returns that style. Otherwise, it returns the stock style used to display the column (for example, Normal, Fixed). See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.StyleFixedNew Property
Gets the custom style associated with fixed cells on this row or column, createing a new one of necessary. [Visual Basic] Overridable Public ReadOnly Property StyleFixedNew As CellStyle [C#] virtual public CellStyle StyleFixedNew {get;} [Delphi] public property StyleFixedNew: CellStyle read get_StyleFixedNew; See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.StyleNew Property 731

RowCol.StyleNew Property
Gets or sets a custom CellStyle associated with this row or column, creating a new style if necessary. [Visual Basic] Overridable Public ReadOnly Property StyleNew As CellStyle [C#] virtual public CellStyle StyleNew {get;} [Delphi] public property StyleNew: CellStyle read get_StyleNew; Remarks This property never returns null. If this element does not have a custom style, a new one will be created automatically and returned. Example The code below sets a column's background color to red. Visual Basic ' get the style associated with column 1 (create a new one if necessary) Dim cs As CellStyle = _flex.Cols(1).StyleNew.BackColor ' set the new style's back color to red cs.BackColor = Color.Red C# // get the style associated with column 1 (create a new one if necessary) CellStyle cs = _flex.Cols[1].StyleNew.BackColor; // set the new style's back color to red cs.BackColor = Color.Red; Delphi var cs := CellStyle; begin // get the style associated with column 1 (create a new one if necessary) cs := _flex.Cols[1].StyleNew.BackColor; // set the new style's back color to red cs.BackColor := Color.Red; end; See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.TextAlign Property
Gets or sets a TextAlignEnum value that determines how text is aligned in scrollable cells on this row or column. [Visual Basic] Public Property TextAlign As TextAlignEnum

732 C1.Win.C1FlexGrid Namespace

[C#] public TextAlignEnum TextAlign {get;set;} [Delphi] public property TextAlign: TextAlignEnum read get_TextAlign write set_TextAlign; See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.TextAlignFixed Property
Gets or sets a TextAlignEnum value that determines how text is aligned in fixed cells on this row or column. [Visual Basic] Public Property TextAlignFixed As TextAlignEnum [C#] public TextAlignEnum TextAlignFixed {get;set;} [Delphi] public property TextAlignFixed: TextAlignEnum read get_TextAlignFixed write set_TextAlignFixed; See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.UserData Property
Gets or sets user data associated with this row or column. [Visual Basic] Overridable Public Property UserData As Object [C#] virtual public object UserData {get;set;} [Delphi] public property UserData: Object read get_UserData write set_UserData; Remarks The UserData value is not used internally by the grid. It is reserved for additional data that the application may associate with rows or columns. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.Visible Property
Gets or sets whether a Row or Column is visible. [Visual Basic] Overridable Public Property Visible As Boolean

RowCol Methods 733

[C#] virtual public bool Visible {get;set;} [Delphi] public property Visible: Boolean read get_Visible write set_Visible; Remarks This property returns true even if the row or column has been scrolled out of view. To determine whether a row is currently within view, check the C1FlexGridBase.TopRow and C1FlexGridBase.BottomRow properties. To determine whether a column is currently within view, check the C1FlexGridBase.LeftCol and C1FlexGridBase.RightCol properties. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol Methods
The methods of the RowCol class are listed here. For a complete list of RowCol class members, see the RowCol Members topic. Public Methods Clear Invalidate Move See Also RowCol Class | C1.Win.C1FlexGrid Namespace Clears the contents of the row or column. Invalidates an individual row or column, causing it to be repainted. Moves this row or column to a new position in the collection.

RowCol.Clear Method
Clears the contents of the row or column. [Visual Basic] Overridable Public Sub Clear( _ ByVal clearFlags As ClearFlags _ ) [C#] virtual public void Clear( ClearFlags clearFlags ); [Delphi] public procedure Clear( clearFlags: ClearFlags ); virtual;

734 C1.Win.C1FlexGrid Namespace

Parameters clearFlags ClearFlags value specifying which elements of the row or column should be cleared. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.Invalidate Method
Invalidates an individual row or column, causing it to be repainted. [Visual Basic] Overridable MustOverride Public Sub Invalidate() [C#] virtual abstract public void Invalidate() [Delphi] public procedure Invalidate(); virtual; abstract; See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowCol.Move Method
Moves this row or column to a new position in the collection. [Visual Basic] Overridable Public Sub Move( _ ByVal indexNew As Integer _ ) [C#] virtual public void Move( int indexNew ); [Delphi] public procedure Move( indexNew: Int32 ); virtual; Parameters indexNew An integer specifying the new position. See Also RowCol Class | RowCol Members | C1.Win.C1FlexGrid Namespace

RowColCollection Class
Base class for grid row and column collections ( RowCollection and ColumnCollection classes).

RowColCollection Members 735

For a list of all members of this type, see RowColCollection Members. System.Object C1.Win.C1FlexGrid.RowColCollection C1.Win.C1FlexGrid.ColumnCollection C1.Win.C1FlexGrid.RowCollection [Visual Basic] MustInherit Public Class RowColCollection Implements IEnumerable [C#] public abstract class RowColCollection : IEnumerable [Delphi] type RowColCollection = class abstract (TObject, IEnumerable); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also RowColCollection Members | C1.Win.C1FlexGrid Namespace

RowColCollection Members
RowColCollection overview Public Properties Count DefaultSize Fixed Frozen MaxSize MinSize Public Methods Contains Move MoveRange Determines whether the collection contains a given row or column. Moves a row or column to a new position in the collection. Moves a range of rows or columns to a new position in the collection. Gets or sets the number of rows or columns in the collection. Gets or sets the default size for the rows or columns in the collection. Gets or sets the number of fixed rows or columns in the collection. Gets or sets the number of frozen rows or columns in the collection. Gets or sets the maximum size for rows and columns in the collection. Gets or sets the minimum size for rows and columns in the collection.

736 C1.Win.C1FlexGrid Namespace

See Also RowColCollection Class | C1.Win.C1FlexGrid Namespace

RowColCollection Properties
The properties of the RowColCollection class are listed here. For a complete list of RowColCollection class members, see the RowColCollection Members topic. Public Properties Count DefaultSize Fixed Frozen MaxSize MinSize See Also RowColCollection Class | C1.Win.C1FlexGrid Namespace Gets or sets the number of rows or columns in the collection. Gets or sets the default size for the rows or columns in the collection. Gets or sets the number of fixed rows or columns in the collection. Gets or sets the number of frozen rows or columns in the collection. Gets or sets the maximum size for rows and columns in the collection. Gets or sets the minimum size for rows and columns in the collection.

RowColCollection.Count Property
Gets or sets the number of rows or columns in the collection. [Visual Basic] Overridable Public Property Count As Integer [C#] virtual public int Count {get;set;} [Delphi] public property Count: Int32 read get_Count write set_Count; See Also RowColCollection Class | RowColCollection Members | C1.Win.C1FlexGrid Namespace

RowColCollection.DefaultSize Property
Gets or sets the default size for the rows or columns in the collection. [Visual Basic] Public Property DefaultSize As Integer [C#] public int DefaultSize {get;set;}

RowColCollection.Fixed Property 737

[Delphi] public property DefaultSize: Int32 read get_DefaultSize write set_DefaultSize; Remarks This value is set automatically when the grid's Font property changes. See Also RowColCollection Class | RowColCollection Members | C1.Win.C1FlexGrid Namespace

RowColCollection.Fixed Property
Gets or sets the number of fixed rows or columns in the collection. [Visual Basic] Overridable Public Property Fixed As Integer [C#] virtual public int Fixed {get;set;} [Delphi] public property Fixed: Int32 read get_Fixed write set_Fixed; See Also RowColCollection Class | RowColCollection Members | C1.Win.C1FlexGrid Namespace

RowColCollection.Frozen Property
Gets or sets the number of frozen rows or columns in the collection. [Visual Basic] Overridable Public Property Frozen As Integer [C#] virtual public int Frozen {get;set;} [Delphi] public property Frozen: Int32 read get_Frozen write set_Frozen; See Also RowColCollection Class | RowColCollection Members | C1.Win.C1FlexGrid Namespace

RowColCollection.MaxSize Property
Gets or sets the maximum size for rows and columns in the collection. [Visual Basic] Public Property MaxSize As Integer [C#] public int MaxSize {get;set;} [Delphi] public property MaxSize: Int32 read get_MaxSize write set_MaxSize;

738 C1.Win.C1FlexGrid Namespace

Remarks The MaxSize property limits the maximum size of rows or columns when they are resized by the user or adjusted to fit the contents with the C1FlexGridBase.AutoSizeRows or C1FlexGridBase.AutoSizeCols method. Setting this property to zero disables it. See Also RowColCollection Class | RowColCollection Members | C1.Win.C1FlexGrid Namespace

RowColCollection.MinSize Property
Gets or sets the minimum size for rows and columns in the collection. [Visual Basic] Public Property MinSize As Integer [C#] public int MinSize {get;set;} [Delphi] public property MinSize: Int32 read get_MinSize write set_MinSize; Remarks The MinSize property limits the minimum size of rows or columns when they are resized by the user or adjusted to fit the contents with the C1FlexGridBase.AutoSizeRows or C1FlexGridBase.AutoSizeCols method. See Also RowColCollection Class | RowColCollection Members | C1.Win.C1FlexGrid Namespace

RowColCollection Methods
The methods of the RowColCollection class are listed here. For a complete list of RowColCollection class members, see the RowColCollection Members topic. Public Methods Contains Move MoveRange See Also RowColCollection Class | C1.Win.C1FlexGrid Namespace Determines whether the collection contains a given row or column. Moves a row or column to a new position in the collection. Moves a range of rows or columns to a new position in the collection.

RowColCollection.Contains Method
Determines whether the collection contains a given row or column.

RowColCollection.Move Method 739

[Visual Basic] Public Function Contains( _ ByVal item As RowCol _ ) As Boolean [C#] public bool Contains( RowCol item ); [Delphi] public function Contains( item: RowCol ): Boolean; Parameters item Row or column items to be detected. Return Value True if the row or column is a member of the collection, False otherwise. See Also RowColCollection Class | RowColCollection Members | C1.Win.C1FlexGrid Namespace

RowColCollection.Move Method
Moves a row or column to a new position in the collection. [Visual Basic] Overridable Public Sub Move( _ ByVal indexOld As Integer, _ ByVal indexNew As Integer _ ) [C#] virtual public void Move( int indexOld, int indexNew ); [Delphi] public procedure Move( indexOld: Int32; indexNew: Int32 ); virtual; Parameters indexOld Index of row or column to be moved. indexNew New position.

740 C1.Win.C1FlexGrid Namespace

See Also RowColCollection Class | RowColCollection Members | C1.Win.C1FlexGrid Namespace

RowColCollection.MoveRange Method
Moves a range of rows or columns to a new position in the collection. [Visual Basic] Overridable Public Sub MoveRange( _ ByVal index As Integer, _ ByVal count As Integer, _ ByVal indexNew As Integer _ ) [C#] virtual public void MoveRange( int index, int count, int indexNew ); [Delphi] public procedure MoveRange( index: Int32; count: Int32; indexNew: Int32 ); virtual; Parameters index The index of the first row or column in the range to be moved. count The number of rows or columns that will be moved. indexNew New position. See Also RowColCollection Class | RowColCollection Members | C1.Win.C1FlexGrid Namespace

RowColEventArgs Class
Provides data for the C1FlexGridBase.AfterEdit, C1FlexGridBase.AfterResizeColumn, C1FlexGridBase.AfterResizeRow, C1FlexGridBase.BeforeEdit, C1FlexGridBase.BeforePageBreak, C1FlexGridBase.BeforeResizeColumn, C1FlexGridBase.BeforeResizeRow, ShowScrollTip, C1FlexGridBase.CellButtonClick, C1FlexGridBase.ComboCloseUp, C1FlexGridBase.ComboDropDown, C1FlexGridBase.SetupEditor, and C1FlexGridBase.StartEdit events. For a list of all members of this type, see RowColEventArgs Members.

RowColEventArgs Members 741

System.Object System.EventArgs C1.Win.C1FlexGrid.RowColEventArgs C1.Win.C1FlexGrid.ToolTipEventArgs [Visual Basic] Public Class RowColEventArgs Inherits EventArgs [C#] public class RowColEventArgs : EventArgs [Delphi] type RowColEventArgs = class (EventArgs); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also RowColEventArgs Members | C1.Win.C1FlexGrid Namespace

RowColEventArgs Members
RowColEventArgs overview Public Constructors RowColEventArgs Constructor Public Fields Cancel Col Row See Also RowColEventArgs Class | C1.Win.C1FlexGrid Namespace Gets or sets a value indicating whether the operation should be canceled. Gets the index of the column that caused the event. Gets the index of the row that caused the event. Initializes a new instance of the RowColEventArgs class.

RowColEventArgs Constructor
Initializes a new instance of the RowColEventArgs class. [Visual Basic] Public Function New( _ ByVal row As Integer, _ ByVal col As Integer _ )

742 C1.Win.C1FlexGrid Namespace

[C#] public RowColEventArgs( int row, int col ); [Delphi] public constructor Create( row: Int32; col: Int32 ); Parameters row Index of the row that caused the event. col Index of the column that caused the event. See Also RowColEventArgs Class | RowColEventArgs Members | C1.Win.C1FlexGrid Namespace

RowColEventArgs Fields
The fields of the RowColEventArgs class are listed here. For a complete list of RowColEventArgs class members, see the RowColEventArgs Members topic. Public Fields Cancel Col Row See Also RowColEventArgs Class | C1.Win.C1FlexGrid Namespace Gets or sets a value indicating whether the operation should be canceled. Gets the index of the column that caused the event. Gets the index of the row that caused the event.

RowColEventArgs.Cancel Field
Gets or sets a value indicating whether the operation should be canceled. [Visual Basic] Public Cancel As Boolean [C#] public bool Cancel [Delphi] public Cancel: Boolean; See Also RowColEventArgs Class | RowColEventArgs Members | C1.Win.C1FlexGrid Namespace

RowColEventArgs.Col Field 743

RowColEventArgs.Col Field
Gets the index of the column that caused the event. [Visual Basic] Public ReadOnly Col As Integer [C#] public readonly int Col [Delphi] public Col: Int32; Remarks This value may be set to -1 if the event was caused by a row. See Also RowColEventArgs Class | RowColEventArgs Members | C1.Win.C1FlexGrid Namespace

RowColEventArgs.Row Field
Gets the index of the row that caused the event. [Visual Basic] Public ReadOnly Row As Integer [C#] public readonly int Row [Delphi] public Row: Int32; Remarks This value may be set to -1 if the event was caused by a column. See Also RowColEventArgs Class | RowColEventArgs Members | C1.Win.C1FlexGrid Namespace

RowColEventHandler Delegate
Represents the method that will handle the C1FlexGridBase.AfterEdit, C1FlexGridBase.AfterResizeColumn, C1FlexGridBase.AfterResizeRow, C1FlexGridBase.BeforeEdit, C1FlexGridBase.BeforePageBreak, C1FlexGridBase.BeforeResizeColumn, C1FlexGridBase.BeforeResizeRow, ShowScrollTip, C1FlexGridBase.CellButtonClick, C1FlexGridBase.ComboCloseUp, C1FlexGridBase.ComboDropDown, C1FlexGridBase.SetupEditor, and C1FlexGridBase.StartEdit events. [Visual Basic] Public Delegate Sub RowColEventHandler( _ ByVal sender As Object, _ ByVal e As RowColEventArgs _ )

744 C1.Win.C1FlexGrid Namespace

[C#] public delegate void RowColEventHandler( object sender, RowColEventArgs e ); [Delphi] type RowColEventHandler = procedure ( sender: Object; e: RowColEventArgs ) of object; Parameters sender Object that fired the event. e RowColEventArgs object that contains the event data. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also C1.Win.C1FlexGrid Namespace

RowCollection Class
Collection of grid Row objects. For a list of all members of this type, see RowCollection Members. System.Object C1.Win.C1FlexGrid.RowColCollection C1.Win.C1FlexGrid.RowCollection [Visual Basic] Public Class RowCollection Inherits RowColCollection [C#] public class RowCollection : RowColCollection [Delphi] type RowCollection = class (RowColCollection); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also RowCollection Members | C1.Win.C1FlexGrid Namespace

RowCollection Members 745

RowCollection Members
RowCollection overview Public Properties Count DefaultSize (inherited from RowColCollection) Fixed Frozen (inherited from RowColCollection) Item MaxSize (inherited from RowColCollection) MinSize (inherited from RowColCollection) Selected Public Methods Add Insert InsertNode InsertRange Move MoveRange Remove RemoveRange See Also RowCollection Class | C1.Win.C1FlexGrid Namespace Appends a new Row object to the collection. Adds a new Row object to the collection at a specified position. Adds a new Node row to the row collection at a specified position. Adds a range of rows to the collection at a specified position. Overridden. Move a Row object to a new position in the collection. Overridden. Moves a range of rows to a new position in the collection. Overloaded. Removes a Row object from the collection. Removes a range of rows from the collection. Overridden. Gets or sets the number of rows in the collection. Gets or sets the default size for the rows or columns in the collection. Overridden. Gets or sets the number of fixed rows in the collection. Gets or sets the number of frozen rows or columns in the collection. Gets the Row at the specified index. Gets or sets the maximum size for rows and columns in the collection. Gets or sets the minimum size for rows and columns in the collection. Gets a collection of Row objects that are currently selected.

RowCollection Properties
The properties of the RowCollection class are listed here. For a complete list of RowCollection class members, see the RowCollection Members topic.

746 C1.Win.C1FlexGrid Namespace

Public Properties Count DefaultSize (inherited from RowColCollection) Fixed Frozen (inherited from RowColCollection) Item MaxSize (inherited from RowColCollection) MinSize (inherited from RowColCollection) Selected See Also RowCollection Class | C1.Win.C1FlexGrid Namespace Overridden. Gets or sets the number of rows in the collection. Gets or sets the default size for the rows or columns in the collection. Overridden. Gets or sets the number of fixed rows in the collection. Gets or sets the number of frozen rows or columns in the collection. Gets the Row at the specified index. Gets or sets the maximum size for rows and columns in the collection. Gets or sets the minimum size for rows and columns in the collection. Gets a collection of Row objects that are currently selected.

RowCollection.Count Property
Gets or sets the number of rows in the collection. [Visual Basic] Overrides Public Property Count As Integer [C#] override public int Count {get;set;} [Delphi] public property Count: Int32 read get_Count write set_Count; Remarks You can add or remove rows by assigning a new value to this property, or you can use the Add, Insert, InsertRange, and Remove methods. See Also RowCollection Class | RowCollection Members | C1.Win.C1FlexGrid Namespace

RowCollection.Fixed Property
Gets or sets the number of fixed rows in the collection. [Visual Basic] Overrides Public Property Fixed As Integer [C#] override public int Fixed {get;set;}

RowCollection.Item Property 747

[Delphi] public property Fixed: Int32 read get_Fixed write set_Fixed; See Also RowCollection Class | RowCollection Members | C1.Win.C1FlexGrid Namespace

RowCollection.Item Property
Gets the Row at the specified index. [Visual Basic] Public Default ReadOnly Property Item( _ ByVal index As Integer _ ) As Row [C#] public Row this[ int index ] {get;} [Delphi] public property Item[ index: Int32 ]: Row read get_Item; See Also RowCollection Class | RowCollection Members | C1.Win.C1FlexGrid Namespace

RowCollection.Selected Property
Gets a collection of Row objects that are currently selected. [Visual Basic] Public ReadOnly Property Selected As RowCollection [C#] public RowCollection Selected {get;} [Delphi] public property Selected: RowCollection read get_Selected; Remarks This property is especially useful when the grid's C1FlexGridBase.SelectionMode property is set to SelectionModeEnum.ListBox. Example The code below removes all selected rows from the grid. Note that foreach loops can't be used to modify the collections being iterated over. This example works because the Selected collection is being enumerated while the C1FlexGridBase.Rows collection is being modified. Visual Basic ' delete all selected rows Dim r As Row

748 C1.Win.C1FlexGrid Namespace

For Each r In _flex.Rows.Selected _flex.Rows.Remove(r) Next C# // delete all selected rows foreach (Row r in _flex.Rows.Selected) { _flex.Rows.Remove(r); } Delphi -- N/A

See Also RowCollection Class | RowCollection Members | C1.Win.C1FlexGrid Namespace

RowCollection Methods
The methods of the RowCollection class are listed here. For a complete list of RowCollection class members, see the RowCollection Members topic. Public Methods Add Insert InsertNode InsertRange Move MoveRange Remove RemoveRange See Also RowCollection Class | C1.Win.C1FlexGrid Namespace Appends a new Row object to the collection. Adds a new Row object to the collection at a specified position. Adds a new Node row to the row collection at a specified position. Adds a range of rows to the collection at a specified position. Overridden. Move a Row object to a new position in the collection. Overridden. Moves a range of rows to a new position in the collection. Overloaded. Removes a Row object from the collection. Removes a range of rows from the collection.

RowCollection.Add Method
Appends a new Row object to the collection. [Visual Basic] Public Function Add() As Row [C#] public Row Add() [Delphi] public function Add(): Row;

RowCollection.Insert Method 749

Return Value A reference to the Row that was added to the collection. Remarks The Add method appends a new row to the collection. To insert a row at a specific position, use the Insert method. See Also RowCollection Class | RowCollection Members | C1.Win.C1FlexGrid Namespace

RowCollection.Insert Method
Adds a new Row object to the collection at a specified position. [Visual Basic] Public Function Insert( _ ByVal index As Integer _ ) As Row [C#] public Row Insert( int index ); [Delphi] public function Insert( index: Int32 ): Row; Parameters index The position where the new row will be inserted. Return Value A reference to the Row that was added to the collection. See Also RowCollection Class | RowCollection Members | C1.Win.C1FlexGrid Namespace

RowCollection.InsertNode Method
Adds a new Node row to the row collection at a specified position. [Visual Basic] Public Function InsertNode( _ ByVal index As Integer, _ ByVal level As Integer _ ) As Node [C#] public Node InsertNode( int index, int level );

750 C1.Win.C1FlexGrid Namespace

[Delphi] public function InsertNode( index: Int32; level: Int32 ): Node; Parameters index The position where the new node row will be inserted. level Outline level for the new node row. Return Value A reference to the Node that was added to the collection. Remarks This method is especially useful when the grid is bound to a data source, because in this case you can't change the value of the Row.IsNode property. When the grid is unbound, you can add rows and turn them into nodes later using the Row.IsNode property. See Also RowCollection Class | RowCollection Members | C1.Win.C1FlexGrid Namespace

RowCollection.InsertRange Method
Adds a range of rows to the collection at a specified position. [Visual Basic] Public Sub InsertRange( _ ByVal index As Integer, _ ByVal count As Integer _ ) [C#] public void InsertRange( int index, int count ); [Delphi] public procedure InsertRange( index: Int32; count: Int32 ); Parameters index The position where the new range will be inserted. count The number of rows to add.

RowCollection.Move Method 751

See Also RowCollection Class | RowCollection Members | C1.Win.C1FlexGrid Namespace

RowCollection.Move Method
Move a Row object to a new position in the collection. [Visual Basic] Overrides Public Sub Move( _ ByVal indexOld As Integer, _ ByVal indexNew As Integer _ ) [C#] override public void Move( int indexOld, int indexNew ); [Delphi] public procedure Move( indexOld: Int32; indexNew: Int32 ); override; Parameters indexOld Index of row to be moved. indexNew New position for the row. See Also RowCollection Class | RowCollection Members | C1.Win.C1FlexGrid Namespace

RowCollection.MoveRange Method
Moves a range of rows to a new position in the collection. [Visual Basic] Overrides Public Sub MoveRange( _ ByVal index As Integer, _ ByVal count As Integer, _ ByVal indexNew As Integer _ ) [C#] override public void MoveRange( int index, int count, int indexNew );

752 C1.Win.C1FlexGrid Namespace

[Delphi] public procedure MoveRange( index: Int32; count: Int32; indexNew: Int32 ); override; Parameters index The index of the first row in the range that will be moved. count The number of rows that will be moved. indexNew New position for the first row in the range. See Also RowCollection Class | RowCollection Members | C1.Win.C1FlexGrid Namespace

RowCollection.Remove Method
Overload List Removes a Row object from the collection. [Visual Basic] Overloads Public Function Remove(Integer) As Row [C#] public Row Remove(int); [Delphi] public function Remove(Int32) : Row; overload; Removes a Row object from the collection. [Visual Basic] Overloads Public Function Remove(Row) As Row [C#] public Row Remove(Row); [Delphi] public function Remove(Row) : Row; overload; See Also RowCollection Class | RowCollection Members | C1.Win.C1FlexGrid Namespace

RowCollection.Remove Method (Int32)


Removes a Row object from the collection. [Visual Basic] Overloads Public Function Remove( _ ByVal index As Integer _ ) As Row [C#] public Row Remove( int index );

RowCollection.RemoveRange Method 753

[Delphi] public function Remove( index: Int32 ): Row; overload; Parameters index The index of the row to remove from the collection. Return Value A reference to the Row that was removed from the collection. See Also RowCollection Class | RowCollection Members | C1.Win.C1FlexGrid Namespace | RowCollection.Remove Overload List

RowCollection.Remove Method (Row)


Removes a Row object from the collection. [Visual Basic] Overloads Public Function Remove( _ ByVal row As Row _ ) As Row [C#] public Row Remove( Row row ); [Delphi] public function Remove( row: Row ): Row; overload; Parameters row The row to be removed. Return Value A reference to the Row that was removed from the collection. See Also RowCollection Class | RowCollection Members | C1.Win.C1FlexGrid Namespace | RowCollection.Remove Overload List

RowCollection.RemoveRange Method
Removes a range of rows from the collection.

754 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Sub RemoveRange( _ ByVal index As Integer, _ ByVal count As Integer _ ) [C#] public void RemoveRange( int index, int count ); [Delphi] public procedure RemoveRange( index: Int32; count: Int32 ); Parameters index The index of the first row to remove from the collection. count The number of rows to remove from the collection. See Also RowCollection Class | RowCollection Members | C1.Win.C1FlexGrid Namespace

RowColToolTipEventHandler Delegate
Represents the method that will handle the C1FlexGridBase.ShowScrollTip event. [Visual Basic] Public Delegate Sub RowColToolTipEventHandler( _ ByVal sender As Object, _ ByVal e As ToolTipEventArgs _ ) [C#] public delegate void RowColToolTipEventHandler( object sender, ToolTipEventArgs e ); [Delphi] type RowColToolTipEventHandler = procedure ( sender: Object; e: ToolTipEventArgs ) of object; Parameters sender Object that fired the event.

ScrollFlags Enumeration 755

e ToolTipEventArgs object that contains the event data. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also C1.Win.C1FlexGrid Namespace

ScrollFlags Enumeration
Specifies options that customize scrollbar behavior. [Visual Basic] Public Enum ScrollFlags [C#] public enum ScrollFlags [Delphi] type ScrollFlags = (AlwaysVisible, DelayedScroll, None, ScrollByRowColumn, ShowScrollTips); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name AlwaysVisible DelayedScroll None ScrollByRowColumn ShowScrollTips Description Keep scrollbars visible even when they are disabled. Do not scroll the control contents until the user releases the scrollbar thumb. Use the default scrolling behavior. Scroll by rows and columns (instead of by pixel). Fire the C1FlexGridBase.ShowScrollTip event and display a tooltip next to the vertical scrollbar while scrolling vertically.

See Also C1.Win.C1FlexGrid Namespace

SelectionModeEnum Enumeration
Specifies the type of selection provided by the grid. [Visual Basic] Public Enum SelectionModeEnum [C#] public enum SelectionModeEnum

756 C1.Win.C1FlexGrid Namespace

[Delphi] type SelectionModeEnum = (Cell, CellRange, Column, ColumnRange, Default, ListBox, Row, RowRange); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Cell CellRange Description The user can select only a single cell at a time. The user can select continuous blocks of cells using the keyboard and the mouse. Clicking on header cells does not affect the selection. The user can select a single column at a time. The user can select a range of contiguous columns at a time. The user can select continuous blocks of cells using the keyboard and the mouse. Clicking on header cells selects entire rows and columns. The user can select non-contiguous rows using controlclick. The user can select a single row at a time. The user can select a range of contiguous rows at a time.

Column ColumnRange Default

ListBox Row RowRange See Also C1.Win.C1FlexGrid Namespace

ShowButtonsEnum Enumeration
Specifies when the grid should display combo buttons in cells. [Visual Basic] Public Enum ShowButtonsEnum [C#] public enum ShowButtonsEnum [Delphi] type ShowButtonsEnum = (Always, WhenEditing, WithFocus); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Always Description Always show buttons.

ShowThemedHeadersEnum Enumeration 757

Member name WhenEditing WithFocus See Also C1.Win.C1FlexGrid Namespace

Description Show buttons only while editing the cell. Show buttons when the cell has the focus. This is the default setting.

ShowThemedHeadersEnum Enumeration
Specifies whether the control should use themes for displaying row or column headers. [Visual Basic] Public Enum ShowThemedHeadersEnum [C#] public enum ShowThemedHeadersEnum [Delphi] type ShowThemedHeadersEnum = (Auto, Both, Columns, None, Rows); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Auto Description Use themed headers when the Windows.Forms.BorderStyle property is set to XpThemes. Use themed headers for row and column headers. Use themed headers for column headers. Do not use themed headers. Use themed headers for row headers.

Both Columns None Rows See Also C1.Win.C1FlexGrid Namespace

SortColEventArgs Class
Provides data for the C1FlexGridBase.BeforeSort and C1FlexGridBase.AfterSort events. For a list of all members of this type, see SortColEventArgs Members. System.Object System.EventArgs C1.Win.C1FlexGrid.SortColEventArgs

758 C1.Win.C1FlexGrid Namespace

[Visual Basic] Public Class SortColEventArgs Inherits EventArgs [C#] public class SortColEventArgs : EventArgs [Delphi] type SortColEventArgs = class (EventArgs); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also SortColEventArgs Members | C1.Win.C1FlexGrid Namespace

SortColEventArgs Members
SortColEventArgs overview Public Constructors SortColEventArgs Constructor Public Fields Cancel Col Handled Order See Also SortColEventArgs Class | C1.Win.C1FlexGrid Namespace Gets or sets a value indicating whether the drag operation should be canceled. Gets the column that is being sorted. Gets or sets a value indicating whether the drag operation has been handled by the event handler. Sets or sets a SortFlags value that determines the sorting order. Initializes a new instance of the SortColEventArgs class.

SortColEventArgs Constructor
Initializes a new instance of the SortColEventArgs class. [Visual Basic] Public Function New( _ ByVal col As Integer, _ ByVal order As SortFlags _ ) [C#] public SortColEventArgs( int col, SortFlags order );

SortColEventArgs Fields 759

[Delphi] public constructor Create( col: Int32; order: SortFlags ); Parameters col The column that is being sorted. order SortFlags value that determines the sorting order. See Also SortColEventArgs Class | SortColEventArgs Members | C1.Win.C1FlexGrid Namespace

SortColEventArgs Fields
The fields of the SortColEventArgs class are listed here. For a complete list of SortColEventArgs class members, see the SortColEventArgs Members topic. Public Fields Cancel Col Handled Order See Also SortColEventArgs Class | C1.Win.C1FlexGrid Namespace Gets or sets a value indicating whether the drag operation should be canceled. Gets the column that is being sorted. Gets or sets a value indicating whether the drag operation has been handled by the event handler. Sets or sets a SortFlags value that determines the sorting order.

SortColEventArgs.Cancel Field
Gets or sets a value indicating whether the drag operation should be canceled. [Visual Basic] Public Cancel As Boolean [C#] public bool Cancel [Delphi] public Cancel: Boolean; Remarks Setting this parameter to true cancels the built-in sort operation and leaves the sorting glyph unchanged. See Also SortColEventArgs Class | SortColEventArgs Members | C1.Win.C1FlexGrid Namespace

760 C1.Win.C1FlexGrid Namespace

SortColEventArgs.Col Field
Gets the column that is being sorted. [Visual Basic] Public ReadOnly Col As Integer [C#] public readonly int Col [Delphi] public Col: Int32; See Also SortColEventArgs Class | SortColEventArgs Members | C1.Win.C1FlexGrid Namespace

SortColEventArgs.Handled Field
Gets or sets a value indicating whether the drag operation has been handled by the event handler. [Visual Basic] Public Handled As Boolean [C#] public bool Handled [Delphi] public Handled: Boolean; Remarks Setting this parameter to true cancels the built-in sort but updates the sorting glyph as if the sort had been performed. This is useful when the event handler performs custom sorting. See Also SortColEventArgs Class | SortColEventArgs Members | C1.Win.C1FlexGrid Namespace

SortColEventArgs.Order Field
Sets or sets a SortFlags value that determines the sorting order. [Visual Basic] Public Order As SortFlags [C#] public SortFlags Order [Delphi] public Order: SortFlags; See Also SortColEventArgs Class | SortColEventArgs Members | C1.Win.C1FlexGrid Namespace

SortColEventHandler Delegate 761

SortColEventHandler Delegate
Represents the method that will handle the C1FlexGridBase.BeforeSort and C1FlexGridBase.AfterSort events. [Visual Basic] Public Delegate Sub SortColEventHandler( _ ByVal sender As Object, _ ByVal e As SortColEventArgs _ ) [C#] public delegate void SortColEventHandler( object sender, SortColEventArgs e ); [Delphi] type SortColEventHandler = procedure ( sender: Object; e: SortColEventArgs ) of object; Parameters sender Object that fired the event. e SortColEventArgs object that contains the event data. Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also C1.Win.C1FlexGrid Namespace

SortFlags Enumeration
Specifies how grid columns should be sorted. [Visual Basic] Public Enum SortFlags [C#] public enum SortFlags [Delphi] type SortFlags = (Ascending, AsDisplayed, Descending, IgnoreCase, None, UseColSort); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll)

762 C1.Win.C1FlexGrid Namespace

Remarks This enumeration contains flags that can be combined to customize the sorting process. Example For example, the code below sorts two grid columns ignoring case. Visual Basic Dim order As SortFlags = SortFlags.Ascending Or SortFlags.IgnoreCase _flex.Sort(order, col1, col2) C# SortFlags order = SortFlags.Ascending | SortFlags.IgnoreCase; _flex.Sort(order, col1, col2); Delphi order := (SortFlags.Ascending or SortFlags.IgnoreCase); _flex.Sort(order, col1, col2);

Members Member name Ascending AsDisplayed Descending IgnoreCase None UseColSort See Also C1.Win.C1FlexGrid Namespace Description Sort in ascending order. Sort using the string representation of the data. In this mode, "100" appears before "2". Sort in ascending order. Ignore case when sorting strings. Do not sort. This setting is useful for skipping certain columns when sorting column ranges. Use the flags stored in the Column.Sort property of individual Column objects.

StyleElementFlags Enumeration
Contains flags that specify which style elements are defined in a CellStyle object. [Visual Basic] Public Enum StyleElementFlags [C#] public enum StyleElementFlags [Delphi] type StyleElementFlags = (All, BackColor, BackgroundImage, BackgroundImageLayout, Border, ComboList, DataMap, DataType, Display, EditMask, Editor, Font, ForeColor, Format, ImageAlign, ImageMap, ImageSpacing, Margins, None, TextAlign, TextDirection, TextEffect, Trimming, UserData, WordWrap); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll)

StyleElementFlags Enumeration 763

Remarks This enumeration can be used to inspect styles and determine which elements it defines, and it can also be used to clear specific elements from the style. Any elements not defined in the style are inherited from the parent style. Members Member name All BackColor BackgroundImage BackgroundImageLayout Border ComboList DataMap DataType Display EditMask Editor Font ForeColor Format ImageAlign ImageMap ImageSpacing Margins None TextAlign TextDirection TextEffect Trimming UserData Description All style elements. The style defines a background color. The style specifies a background image. The style specifies a background image aligment. The style defines borders. The style defines a list of choices used to populate drop down editors. The style defines an Collections.IDictionary used to associate cell data with display values. The style defines the Type of values contained in the cells. The style defines whether to display text and/or images, in the cells. The style defines an edit mask used to constrain values entered in the cells. The style defines an external control to be used as an editor for the cells. The style defines a font. The style defines a foreground color. The style defines a format string used to convert data into strings. The style defines the image alignment. The style defines an Collections.IDictionary used to associate cell data with images. The style defines the spacing between images and text. The style defines margins. No elements are defined. The style defines the text alignment. The style defines whether text should be rendered horizontally or vertically. The style defines a 3D effect for the text. The style defines how long strings are trimmed to fit within cells. The style contains arbitrary user data (not used by the control).

764 C1.Win.C1FlexGrid Namespace

Member name WordWrap See Also C1.Win.C1FlexGrid Namespace

Description The style defines whether long strings are allowed to wrap within cells.

SubtotalPositionEnum Enumeration
Specifies whether subtotals rows created with the C1FlexGridBase.Subtotal method should be inserted above or below the data they refer to. [Visual Basic] Public Enum SubtotalPositionEnum [C#] public enum SubtotalPositionEnum [Delphi] type SubtotalPositionEnum = (AboveData, BelowData); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name AboveData BelowData See Also C1.Win.C1FlexGrid Namespace Description Subtotal rows are inserted above the data (tree-style). Subtotal rows are inserted below the data (spreadsheetstyle).

TextAlignEnum Enumeration
Specifies how text is aligned in a grid cell. [Visual Basic] Public Enum TextAlignEnum [C#] public enum TextAlignEnum [Delphi] type TextAlignEnum = (CenterBottom, CenterCenter, CenterTop, GeneralBottom, GeneralCenter, GeneralTop, LeftBottom, LeftCenter, LeftTop, RightBottom, RightCenter, RightTop); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll)

TextDirectionEnum Enumeration 765

Members Member name CenterBottom CenterCenter CenterTop GeneralBottom GeneralCenter GeneralTop LeftBottom LeftCenter LeftTop RightBottom RightCenter RightTop See Also C1.Win.C1FlexGrid Namespace Description Text is horizontally aligned to the center and vertically aligned to the bottom of the cell. Text is horizontally aligned to the center and vertically aligned to the center of the cell. Text is horizontally aligned to the center and vertically aligned to the top of the cell. Numbers are aligned to the right, other values to the left, and vertically aligned to the bottom. Numbers are aligned to the right, other values to the left, and vertically aligned to the center. Numbers are aligned to the right, other values to the left, and vertically aligned to the top. Text is horizontally aligned to the left and vertically aligned to the bottom of the cell. Text is horizontally aligned to the left and vertically aligned to the center of the cell. Text is horizontally aligned to the left and vertically aligned to the top of the cell. Text is horizontally aligned to the right and vertically aligned to the bottom of the cell. Text is horizontally aligned to the right and vertically aligned to the center of the cell. Text is horizontally aligned to the right and vertically aligned to the top of the cell.

TextDirectionEnum Enumeration
Specifies the direction to use when rendering text in a grid cell. [Visual Basic] Public Enum TextDirectionEnum [C#] public enum TextDirectionEnum [Delphi] type TextDirectionEnum = (Down, Normal, Up); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll)

766 C1.Win.C1FlexGrid Namespace

Members Member name Down Normal Up See Also C1.Win.C1FlexGrid Namespace Description Text is rendered from the top of the cell to the bottom. Text is rendered in the horizontal direction. Text is rendered from the bottom of the cell to the top.

TextEffectEnum Enumeration
Specifies a 3D effect to use when rendering cell text. [Visual Basic] Public Enum TextEffectEnum [C#] public enum TextEffectEnum [Delphi] type TextEffectEnum = (Flat, Inset, Raised); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Flat Inset Raised See Also C1.Win.C1FlexGrid Namespace Description No 3D effect. Text is drawn with a shadow offset by one pixel to the left and above the text. Text is drawn with a shadow offset by one pixel to the right and below the text.

ToolTipEventArgs Class
Provides data for the C1FlexGridBase.ShowScrollTip event. For a list of all members of this type, see ToolTipEventArgs Members. System.Object System.EventArgs C1.Win.C1FlexGrid.RowColEventArgs C1.Win.C1FlexGrid.ToolTipEventArgs

ToolTipEventArgs Members 767

[Visual Basic] Public Class ToolTipEventArgs Inherits RowColEventArgs [C#] public class ToolTipEventArgs : RowColEventArgs [Delphi] type ToolTipEventArgs = class (RowColEventArgs); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also ToolTipEventArgs Members | C1.Win.C1FlexGrid Namespace

ToolTipEventArgs Members
ToolTipEventArgs overview Public Constructors ToolTipEventArgs Constructor Public Fields Cancel (inherited from RowColEventArgs) Col (inherited from RowColEventArgs) Row (inherited from RowColEventArgs) ToolTipText See Also ToolTipEventArgs Class | C1.Win.C1FlexGrid Namespace Gets or sets a value indicating whether the operation should be canceled. Gets the index of the column that caused the event. Gets the index of the row that caused the event. Gets or sets the text to be displayed in the tooltip. Initializes a new instance of the ToolTipEventArgs class.

ToolTipEventArgs Constructor
Initializes a new instance of the ToolTipEventArgs class. [Visual Basic] Public Function New( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal toolTipText As String _ ) [C#] public ToolTipEventArgs( int row, int col, string toolTipText );

768 C1.Win.C1FlexGrid Namespace

[Delphi] public constructor Create( row: Int32; col: Int32; toolTipText: String ); Parameters row Index of the row that caused the event. col Index of the column that caused the event. toolTipText Text to display in the ToolTip See Also ToolTipEventArgs Class | ToolTipEventArgs Members | C1.Win.C1FlexGrid Namespace

ToolTipEventArgs Fields
The fields of the ToolTipEventArgs class are listed here. For a complete list of ToolTipEventArgs class members, see the ToolTipEventArgs Members topic. Public Fields Cancel (inherited from RowColEventArgs) Col (inherited from RowColEventArgs) Row (inherited from RowColEventArgs) ToolTipText See Also ToolTipEventArgs Class | C1.Win.C1FlexGrid Namespace Gets or sets a value indicating whether the operation should be canceled. Gets the index of the column that caused the event. Gets the index of the row that caused the event. Gets or sets the text to be displayed in the tooltip.

ToolTipEventArgs.ToolTipText Field
Gets or sets the text to be displayed in the tooltip. [Visual Basic] Public ToolTipText As String [C#] public string ToolTipText [Delphi] public ToolTipText: String; See Also ToolTipEventArgs Class | ToolTipEventArgs Members | C1.Win.C1FlexGrid Namespace

TreeStyleFlags Enumeration 769

TreeStyleFlags Enumeration
Specifies the appearance of the outline tree. [Visual Basic] Public Enum TreeStyleFlags [C#] public enum TreeStyleFlags [Delphi] type TreeStyleFlags = (ButtonBar, Complete, CompleteLeaf, Leaf, Lines, None, Simple, SimpleLeaf, Symbols); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name ButtonBar Complete CompleteLeaf Leaf Lines None Simple SimpleLeaf Symbols See Also C1.Win.C1FlexGrid Namespace Description Show outline buttons across the top fixed row. Combination of Lines, Symbols, and ButtonBar. Combination of Lines, Symbols, ButtonBar and Leaf. Show tree lines next to all rows (nodes and data). Show tree lines next to node rows. Do not show the outline tree. Combination of Lines and Symbols. Combination of Lines, Symbols, and Leaf. Show expand/collapse symbols on node rows.

UnboundValueEventArgs Class
Provides data for the C1FlexGridBase.GetUnboundValue and C1FlexGridBase.SetUnboundValue events. For a list of all members of this type, see UnboundValueEventArgs Members. System.Object System.EventArgs C1.Win.C1FlexGrid.UnboundValueEventArgs [Visual Basic] Public Class UnboundValueEventArgs Inherits EventArgs

770 C1.Win.C1FlexGrid Namespace

[C#] public class UnboundValueEventArgs : EventArgs [Delphi] type UnboundValueEventArgs = class (EventArgs); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also UnboundValueEventArgs Members | C1.Win.C1FlexGrid Namespace

UnboundValueEventArgs Members
UnboundValueEventArgs overview Public Constructors UnboundValueEventArgs Constructor Public Fields Col Row Value See Also UnboundValueEventArgs Class | C1.Win.C1FlexGrid Namespace Gets the column index for the cell that has an unbound value. Gets the row index for the cell that has an unbound value. Gets or sets the unbound value that should be displayed in the cell. Initializes a new instance of the UnboundValueEventArgs class.

UnboundValueEventArgs Constructor
Initializes a new instance of the UnboundValueEventArgs class. [Visual Basic] Public Function New( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal value As Object _ ) [C#] public UnboundValueEventArgs( int row, int col, object value );

UnboundValueEventArgs Fields 771

[Delphi] public constructor Create( row: Int32; col: Int32; value: Object ); Parameters row Row index for the cell that has an unbound value. col Column index for the cell that has an unbound value. value Unbound value that should be displayed in the cell. See Also UnboundValueEventArgs Class | UnboundValueEventArgs Members | C1.Win.C1FlexGrid Namespace

UnboundValueEventArgs Fields
The fields of the UnboundValueEventArgs class are listed here. For a complete list of UnboundValueEventArgs class members, see the UnboundValueEventArgs Members topic. Public Fields Col Row Value See Also UnboundValueEventArgs Class | C1.Win.C1FlexGrid Namespace Gets the column index for the cell that has an unbound value. Gets the row index for the cell that has an unbound value. Gets or sets the unbound value that should be displayed in the cell.

UnboundValueEventArgs.Col Field
Gets the column index for the cell that has an unbound value. [Visual Basic] Public ReadOnly Col As Integer [C#] public readonly int Col [Delphi] public Col: Int32; See Also UnboundValueEventArgs Class | UnboundValueEventArgs Members | C1.Win.C1FlexGrid Namespace

772 C1.Win.C1FlexGrid Namespace

UnboundValueEventArgs.Row Field
Gets the row index for the cell that has an unbound value. [Visual Basic] Public ReadOnly Row As Integer [C#] public readonly int Row [Delphi] public Row: Int32; See Also UnboundValueEventArgs Class | UnboundValueEventArgs Members | C1.Win.C1FlexGrid Namespace

UnboundValueEventArgs.Value Field
Gets or sets the unbound value that should be displayed in the cell. [Visual Basic] Public Value As Object [C#] public object Value [Delphi] public Value: Object; See Also UnboundValueEventArgs Class | UnboundValueEventArgs Members | C1.Win.C1FlexGrid Namespace

UnboundValueEventHandler Delegate
Represents the method that will handle the C1FlexGridBase.GetUnboundValue and C1FlexGridBase.SetUnboundValue events. [Visual Basic] Public Delegate Sub UnboundValueEventHandler( _ ByVal sender As Object, _ ByVal e As UnboundValueEventArgs _ ) [C#] public delegate void UnboundValueEventHandler( object sender, UnboundValueEventArgs e );

ValidateEditEventArgs Class 773

[Delphi] type UnboundValueEventHandler = procedure ( sender: Object; e: UnboundValueEventArgs ) of object; Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also C1.Win.C1FlexGrid Namespace

ValidateEditEventArgs Class
Provides data for the C1FlexGridBase.ValidateEdit event. For a list of all members of this type, see ValidateEditEventArgs Members. System.Object System.EventArgs C1.Win.C1FlexGrid.ValidateEditEventArgs [Visual Basic] Public Class ValidateEditEventArgs Inherits EventArgs [C#] public class ValidateEditEventArgs : EventArgs [Delphi] type ValidateEditEventArgs = class (EventArgs); Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also ValidateEditEventArgs Members | C1.Win.C1FlexGrid Namespace

ValidateEditEventArgs Members
ValidateEditEventArgs overview Public Constructors ValidateEditEventArgs Constructor Public Fields Cancel Checkbox Col Gets or sets a value indicating whether the edit operation should be canceled. If the cell contains a checkbox, the new checkbox state about to be applied to the cell. Gets the column index of the cell being edited. Initializes a new instance of the ValidateEditEventArgs class.

774 C1.Win.C1FlexGrid Namespace

Row See Also

Gets the row index of the cell being edited.

ValidateEditEventArgs Class | C1.Win.C1FlexGrid Namespace

ValidateEditEventArgs Constructor
Initializes a new instance of the ValidateEditEventArgs class. [Visual Basic] Public Function New( _ ByVal row As Integer, _ ByVal col As Integer, _ ByVal check As CheckEnum _ ) [C#] public ValidateEditEventArgs( int row, int col, CheckEnum check ); [Delphi] public constructor Create( row: Int32; col: Int32; check: CheckEnum ); Parameters row The row index of the cell being edited. col The column index of the cell being edited. check The new checkbox state about to be applied to the cell, if any. See Also ValidateEditEventArgs Class | ValidateEditEventArgs Members | C1.Win.C1FlexGrid Namespace

ValidateEditEventArgs Fields
The fields of the ValidateEditEventArgs class are listed here. For a complete list of ValidateEditEventArgs class members, see the ValidateEditEventArgs Members topic. Public Fields Cancel Checkbox Gets or sets a value indicating whether the edit operation should be canceled. If the cell contains a checkbox, the new checkbox state about to be applied to the cell.

ValidateEditEventArgs.Cancel Field 775

Col Row See Also

Gets the column index of the cell being edited. Gets the row index of the cell being edited.

ValidateEditEventArgs Class | C1.Win.C1FlexGrid Namespace

ValidateEditEventArgs.Cancel Field
Gets or sets a value indicating whether the edit operation should be canceled. [Visual Basic] Public Cancel As Boolean [C#] public bool Cancel [Delphi] public Cancel: Boolean; Remarks If this parameter is set to true, the edits are considered invalid. The editor will remain open and the current cell selected until the user provides a valid entry or cancels the edit operation by pressing the ESC key. See Also ValidateEditEventArgs Class | ValidateEditEventArgs Members | C1.Win.C1FlexGrid Namespace

ValidateEditEventArgs.Checkbox Field
If the cell contains a checkbox, the new checkbox state about to be applied to the cell. [Visual Basic] Public ReadOnly Checkbox As CheckEnum [C#] public readonly CheckEnum Checkbox [Delphi] public Checkbox: CheckEnum; See Also ValidateEditEventArgs Class | ValidateEditEventArgs Members | C1.Win.C1FlexGrid Namespace

ValidateEditEventArgs.Col Field
Gets the column index of the cell being edited. [Visual Basic] Public ReadOnly Col As Integer [C#] public readonly int Col

776 C1.Win.C1FlexGrid Namespace

[Delphi] public Col: Int32; See Also ValidateEditEventArgs Class | ValidateEditEventArgs Members | C1.Win.C1FlexGrid Namespace

ValidateEditEventArgs.Row Field
Gets the row index of the cell being edited. [Visual Basic] Public ReadOnly Row As Integer [C#] public readonly int Row [Delphi] public Row: Int32; See Also ValidateEditEventArgs Class | ValidateEditEventArgs Members | C1.Win.C1FlexGrid Namespace

ValidateEditEventHandler Delegate
Represents the method that will handle the C1FlexGridBase.ValidateEdit event. [Visual Basic] Public Delegate Sub ValidateEditEventHandler( _ ByVal sender As Object, _ ByVal e As ValidateEditEventArgs _ ) [C#] public delegate void ValidateEditEventHandler( object sender, ValidateEditEventArgs e ); [Delphi] type ValidateEditEventHandler = procedure ( sender: Object; e: ValidateEditEventArgs ) of object; Namespace: C1.Win.C1FlexGrid Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) See Also C1.Win.C1FlexGrid Namespace

C1.Win.C1FlexGrid.Classic Hierarchy 777

C1.Win.C1FlexGrid.Classic Namespace
C1.Win.C1FlexGrid.Classic Hierarchy

Classes
Class C1FlexGridClassic See Also C1.Win.C1FlexGrid.Classic.2 Assembly Description Specifies support for transacted initialization.

C1.Win.C1FlexGrid.Classic Hierarchy
System.Object System.MarshalByRefObject System.ComponentModel.Component System.Windows.Forms.Control C1.Win.C1FlexGrid.Util.BaseControls.ScrollableControl C1.Win.C1FlexGrid.C1FlexGridBase ---- System.ComponentModel.ISupportInitialize, C1.Win.j C1.Win.C1FlexGrid.C1FlexGrid C1.Win.C1FlexGrid.Classic.C1FlexGridClassic See Also C1.Win.C1FlexGrid.Classic Namespace

C1FlexGridClassic Class
Specifies support for transacted initialization. For a list of all members of this type, see C1FlexGridClassic Members. System.Object System.MarshalByRefObject System.ComponentModel.Component System.Windows.Forms.Control C1.Win.C1FlexGrid.Util.BaseControls.ScrollableControl C1.Win.C1FlexGrid.C1FlexGridBase C1.Win.C1FlexGrid.C1FlexGrid C1.Win.C1FlexGrid.Classic.C1FlexGridClassic [Visual Basic] Public Class C1FlexGridClassic Inherits C1FlexGrid

778 C1.Win.C1FlexGrid.Classic Namespace

[C#] public class C1FlexGridClassic : C1FlexGrid [Delphi] type C1FlexGridClassic = class (C1FlexGrid); Namespace: C1.Win.C1FlexGrid.Classic Assembly: C1.Win.C1FlexGrid.Classic.2 (in C1.Win.C1FlexGrid.Classic.2.dll) See Also C1FlexGridClassic Members | C1.Win.C1FlexGrid.Classic Namespace

C1FlexGridClassic Members
C1FlexGridClassic overview Public Properties AllowAddNew (inherited from C1FlexGridBase) AllowDelete (inherited from C1FlexGridBase) AllowFreezing (inherited from C1FlexGridBase) AutoClipboard (inherited from C1FlexGridBase) Gets or sets whether the grid should display a new row template after the last data row. Gets or sets whether the grid should monitor the keyboard and handle the DEL key. Gets or sets whether the user is allowed to freeze rows and columns with the mouse. Gets or sets whether the grid should handle the clipboard keys and automatically perform cut, copy, paste, and delete operations. Gets or sets whether columns are automatically created when the grid is bound to a data source. Gets or sets whether column widths are automatically adjusted when data is loaded. Gets or sets whether the grid should move the cursor searching for entries as the user types. Gets or sets the delay (in seconds) before the AutoSearch buffer is reset. Gets or sets the background color for the control. Gets or sets the type of border around the control. Gets the last visible row in the scrollable area. Gets or sets the contents of the selected range. Gets or sets the characters used as row and column separators in clip strings. Gets or sets the column that contains the cursor. Gets or sets the last column in the current selection. Gets a ComboBoxEditor object that provides easy access to properties of the currently active ComboBox editor.

AutoGenerateColumns (inherited from C1FlexGridBase) AutoResize (inherited from C1FlexGridBase) AutoSearch (inherited from C1FlexGridBase) AutoSearchDelay (inherited from C1FlexGridBase) BackColor (inherited from C1FlexGridBase) BorderStyle (inherited from ScrollableControl) BottomRow (inherited from C1FlexGridBase) Clip (inherited from C1FlexGridBase) ClipSeparators (inherited from C1FlexGridBase) Col (inherited from C1FlexGridBase) ColSel (inherited from C1FlexGridBase) ComboBoxEditor (inherited from C1FlexGridBase)

C1FlexGridClassic Members 779

ComboList (inherited from C1FlexGridBase) CursorCell (inherited from C1FlexGridBase) CustomComparer (inherited from C1FlexGridBase)

Gets or sets the list of items to be used by the dropdown editor. Gets a CellRange object that contains the cell at coordinates Row, Col. Gets or sets a custom comparer object used by the grid to perform grouping, merging, and searching operations. Gets or sets the specific list in a DataSource object that the grid should display. Gets or sets the data source for the grid. Gets or sets whether the control should use an offscreen buffer when painting to reduce flicker. Gets or sets a value that determines if the user can drag data from the control. Gets or sets whether the control should fire the OwnerDrawCell event. Gets or sets a value that determines if the control can accept data that the user drags onto it. Gets or sets the input mask to use when editing cells. Gets or sets an EditFlags flags that affect the grid's editing behavior. Gets or sets a reference to the cell editor that is currently active. Gets or sets whether the last column should be extended to fill the control. Gets or sets the type of focus rectangle to display. Gets or sets the foreground color for the control. Gets the collection of control glyphs (images used to show sorting, checkboxes, and so on). Gets or sets when to highlight selected cells. Gets or sets the first visible column in the scrollable area. Gets the CellRangeCollection that determines which grid cells are merged when the AllowMerging property is set to AllowMergingEnum.Custom. Gets the index of the column under the cursor. Gets the index of the row under the cursor. Gets a GridPrinter object that specifies printing parameters for the grid. Gets the last visible column in the scrollable area. Gets or sets the row that contains the cursor. Gets or sets the last row in the current selection.

DataMember (inherited from C1FlexGridBase) DataSource (inherited from C1FlexGridBase) DoubleBuffer (inherited from C1FlexGridBase) DragMode (inherited from C1FlexGridBase) DrawMode (inherited from C1FlexGridBase) DropMode (inherited from C1FlexGridBase) EditMask (inherited from C1FlexGridBase) EditOptions (inherited from C1FlexGridBase) Editor (inherited from C1FlexGridBase) ExtendLastCol (inherited from C1FlexGridBase) FocusRect (inherited from C1FlexGridBase) ForeColor (inherited from C1FlexGridBase) Glyphs (inherited from C1FlexGridBase) HighLight (inherited from C1FlexGridBase) LeftCol (inherited from C1FlexGridBase) MergedRanges (inherited from C1FlexGrid)

MouseCol (inherited from C1FlexGridBase) MouseRow (inherited from C1FlexGridBase) PrintParameters (inherited from C1FlexGridBase) RightCol (inherited from C1FlexGridBase) Row (inherited from C1FlexGridBase) RowSel (inherited from C1FlexGridBase)

780 C1.Win.C1FlexGrid.Classic Namespace

ScrollableRectangle (inherited from C1FlexGridBase) ScrollBars (inherited from ScrollableControl) ScrollBarsVisible (inherited from ScrollableControl) ScrollOptions (inherited from C1FlexGridBase) ScrollPosition (inherited from ScrollableControl) Selection (inherited from C1FlexGridBase) ShowButtons (inherited from C1FlexGridBase) ShowCellLabels (inherited from C1FlexGridBase) ShowCursor (inherited from C1FlexGridBase) ShowErrors (inherited from C1FlexGridBase) ShowSort (inherited from C1FlexGridBase) ShowThemedHeaders (inherited from C1FlexGridBase) SortColumn (inherited from C1FlexGridBase) SubtotalPosition (inherited from C1FlexGridBase) TopRow (inherited from C1FlexGridBase) Tree (inherited from C1FlexGridBase) UseCompatibleTextRendering (inherited from C1FlexGridBase) Item (inherited from C1FlexGridBase) Public Methods AutoSizeCols (inherited from C1FlexGridBase) AutoSizeRows (inherited from C1FlexGridBase) BeginInit (inherited from C1FlexGridBase) CreateImage (inherited from C1FlexGridBase) EndInit (inherited from C1FlexGridBase) FinishEditing (inherited from C1FlexGridBase)

Gets a rectangle that defines the scrollable portion of the control. Gets or sets which scroll bars should appear on the control. Gets a ScrollBars value that indicates which scrollbars are currently visible. Gets or sets a ScrollFlags value that specifies the grid scrolling behavior. Gets or sets the location of the auto-scroll position. Gets the selected range in normalized form. Gets or sets when to display combo buttons in cells. Gets or sets whether the grid should display labels over cells whose contents are partially hidden. Gets or sets whether the grid should display a DB-style cursor on the first fixed column. Gets or sets whether the grid should display error information in cells and rows. Gets or sets whether the grid should display sorting glyphs (a triangle) on the headers of sorted columns. Gets or sets whether the control should use Xp themes for displaying row or column headers. Gets a reference to the column that defines the current sort applied to the grid. Gets or sets whether node rows appear above or below the data. Gets or sets the first visible row in the scrollable area. Gets a reference to the GridTree object that controls the appearance of the outline tree in the grid. Specifies whether text rendering should be compatible with previouse releases of WinForms.

Overloaded. Adjusts the width of all columns to fit the data. Overloaded. Adjusts the height of all rows to fit the data. Signals the object that initialization is starting. Overloaded. Creates an image of the entire grid. Signals the object that initialization is complete. Overloaded. Finishes editing the current cell and takes the grid out of edit mode.

C1FlexGridClassic Members 781

HitTest (inherited from C1FlexGridBase) IsCellCheckBox (inherited from C1FlexGridBase) IsCellSelected (inherited from C1FlexGridBase) RemoveItem (inherited from C1FlexGridBase) StartEditing (inherited from C1FlexGridBase) SaveExcel (inherited from C1FlexGridBase) Subtotal (inherited from C1FlexGridBase) Clear (inherited from C1FlexGridBase) GetDataDisplay (inherited from C1FlexGridBase) LoadExcel (inherited from C1FlexGridBase) Public Events AfterAddRow (inherited from C1FlexGridBase) AfterCollapse (inherited from C1FlexGridBase) AfterDataRefresh (inherited from C1FlexGridBase) AfterDeleteRow (inherited from C1FlexGridBase) AfterDragColumn (inherited from C1FlexGridBase) AfterDragRow (inherited from C1FlexGridBase) AfterEdit (inherited from C1FlexGridBase) AfterFreezeColumn (inherited from C1FlexGridBase) AfterFreezeRow (inherited from C1FlexGridBase) AfterResizeColumn (inherited from C1FlexGridBase) AfterResizeRow (inherited from C1FlexGridBase) AfterRowColChange (inherited from C1FlexGridBase) AfterScroll (inherited from C1FlexGridBase) AfterSelChange (inherited from C1FlexGridBase) AfterSort (inherited from C1FlexGridBase) BeforeAddRow (inherited from C1FlexGridBase) BeforeAutosizeColumn (inherited from C1FlexGridBase)

Overloaded. Returns information about the control at the current mouse position. Gets a value that determines whether the cell contents are displayed as a checkbox. Gets a value that determines if a cell is selected. Overloaded. Removes the last row from the grid. Overloaded. Puts the grid in edit mode and starts editing the current cell. Saves the grid contents to a Microsoft Excel (.xls) file. Groups rows based on cell contents and calculates aggregate values. Clears the grid. Gets the value in a grid cell, formatted as a string, and the image or checkbox in the cell. Loads the grid from the first worksheet in a Microsoft Excel (.xls) file. Fires after a new row is added by the user. Fires after a node row is collapsed or expanded. Fires after any data source change notifications. Fires after one or more rows are deleted by the user. Fires after the user finishes dragging a column. Fires after the user finishes dragging a row. Fires after a cell has been edited. Fires after columns are frozen by dragging the frozen column divider. Fires after rows are frozen by dragging the frozen row divider. Fires after a column is resized by dragging the column header. Fires after a row is resized by dragging the row header. Fires after the current cell changes ( Row and Col properties). Fires after the grid scrolls. Fires after the selection changes ( Row, Col, RowSel, ColSel properties). Fires after a column is sorted by a click on a column header. Fires before a new row is added by the user. Fires before a column is automatically resized by a double-click on a column header.

782 C1.Win.C1FlexGrid.Classic Namespace

BeforeAutosizeRow (inherited from C1FlexGridBase) BeforeCollapse (inherited from C1FlexGridBase) BeforeDeleteRow (inherited from C1FlexGridBase) BeforeDoubleClick (inherited from C1FlexGridBase) BeforeDragColumn (inherited from C1FlexGridBase) BeforeDragRow (inherited from C1FlexGridBase) BeforeEdit (inherited from C1FlexGridBase) BeforeFreezeColumn (inherited from C1FlexGridBase) BeforeFreezeRow (inherited from C1FlexGridBase) BeforeMouseDown (inherited from C1FlexGridBase) BeforePageBreak (inherited from C1FlexGridBase) BeforeResizeColumn (inherited from C1FlexGridBase) BeforeResizeRow (inherited from C1FlexGridBase) BeforeRowColChange (inherited from C1FlexGridBase) BeforeScroll (inherited from C1FlexGridBase) BeforeSelChange (inherited from C1FlexGridBase) BeforeSort (inherited from C1FlexGridBase) BeginPrint (inherited from C1FlexGridBase) CancelAddRow (inherited from C1FlexGridBase) CellButtonClick (inherited from C1FlexGridBase) CellChanged (inherited from C1FlexGridBase) ChangeEdit (inherited from C1FlexGridBase) ComboCloseUp (inherited from C1FlexGridBase) ComboDropDown (inherited from C1FlexGridBase) EndPrint (inherited from C1FlexGridBase)

Fires before a row is automatically resized by a doubleclick on a row header. Fires before a node row is collapsed or expanded. Fires before a row is deleted by the user. Fires before the DoubleClick event is handled by the grid. Fires before the user starts dragging a column. Fires before the user starts dragging a row. Fires before the grid enters edit mode, and also when the cell that has the focus needs to be painted. Fires before columns are frozen by dragging the frozen column divider. Fires before rows are frozen by dragging the frozen row divider. Fires before the MouseDown event is handled by the grid. Fires while the control is being printed to provide control over page breaks. Fires before a column is resized by dragging the column header. Fires before a row is resized by dragging the row header. Fires before the current cell changes ( Row and Col properties). Fires before the grid scrolls. Fires before the selection changes ( Row, Col, RowSel, ColSel properties). Fires before a column is sorted by a click on a column header. Fires before the grid starts printing. Fires when the cursor leaves the new row without making any changes to it. Fires after the user clicks a cell button. Fires after the contents of a cell have changed. Fires in edit mode, after the contents of the editor change. Fires in edit mode, when the dropdown portion of an editor closes. Fires in edit mode, when the dropdown portion of an editor opens. Fires after the grid finishes printing.

C1FlexGridClassic Members 783

EnterCell (inherited from C1FlexGridBase) GetCellErrorInfo (inherited from C1FlexGridBase) GetRowErrorInfo (inherited from C1FlexGridBase) GetUnboundValue (inherited from C1FlexGridBase) GridChanged (inherited from C1FlexGridBase) GridError (inherited from C1FlexGridBase) KeyDownEdit (inherited from C1FlexGridBase) KeyPressEdit (inherited from C1FlexGridBase) KeyUpEdit (inherited from C1FlexGridBase) LeaveCell (inherited from C1FlexGridBase) LeaveEdit (inherited from C1FlexGridBase) MouseHoverCell (inherited from C1FlexGridBase) OwnerDrawCell (inherited from C1FlexGridBase) PrintPage (inherited from C1FlexGridBase) RowColChange (inherited from C1FlexGridBase) SelChange (inherited from C1FlexGridBase) SetUnboundValue (inherited from C1FlexGridBase) SetupEditor (inherited from C1FlexGridBase) ShowScrollTip (inherited from C1FlexGridBase) StartDrag (inherited from C1FlexGridBase) StartEdit (inherited from C1FlexGridBase) ValidateEdit (inherited from C1FlexGridBase) Protected Methods CreateAccessibilityInstance (inherited from C1FlexGridBase) OnChangeScrollBarPosition (inherited from C1FlexGridBase) OnImeStartComposition (inherited from ScrollableControl)

Fires after the current cell changes ( Row and Col properties). Fires when ShowErrors is set to true and the control needs error information for a cell. Fires when ShowErrors is set to true and the control needs error information for a row. Fires when the grid needs to retrieve data for an unbound cell. Fires when the grid or its contents change. Fires after the data source reports an error condition. Fires in edit mode, when the user presses a key. Fires in edit mode, when the user presses a character key. Fires in edit mode, when the user releases a key. Fires before the current cell changes ( Row and Col properties). Fires after the control leaves edit mode. Fires when the mouse enters or leaves a cell. Fires before the grid draws a cell, when the DrawMode property is set to DrawModeEnum.OwnerDraw. Fires after the grid finishes printing a page. Fires after the current cell changes ( Row and Col properties). Fires after the selection changes ( Row, Col, RowSel, ColSel properties). Fires when the grid needs to store data in an unbound cell. Fires after a cell editor has been initialized by the grid, to allow additional custom initialization. Fires before the vertical scrolltip is displayed. Fires before the grid starts an automatic OLE drag operation. Fires before the control enters edit mode. Fires before the control exits cell edit mode, while the editor is still active. Creates a new accessibility object for the control. Calculates the new position of a scrollbar in response to a user command. Called when the control receives a WM_IME_STARTCOMPOSITION message.

784 C1.Win.C1FlexGrid.Classic Namespace

OnThemeChanged (inherited from C1FlexGridBase) See Also

Called when the control receives a WM_THEMECHANGED message.

C1FlexGridClassic Class | C1.Win.C1FlexGrid.Classic Namespace

C1FlexGridClassic Properties
The properties of the C1FlexGridClassic class are listed here. For a complete list of C1FlexGridClassic class members, see the C1FlexGridClassic Members topic. Public Properties AllowAddNew (inherited from C1FlexGridBase) AllowDelete (inherited from C1FlexGridBase) AllowFreezing (inherited from C1FlexGridBase) AutoClipboard (inherited from C1FlexGridBase) Gets or sets whether the grid should display a new row template after the last data row. Gets or sets whether the grid should monitor the keyboard and handle the DEL key. Gets or sets whether the user is allowed to freeze rows and columns with the mouse. Gets or sets whether the grid should handle the clipboard keys and automatically perform cut, copy, paste, and delete operations. Gets or sets whether columns are automatically created when the grid is bound to a data source. Gets or sets whether column widths are automatically adjusted when data is loaded. Gets or sets whether the grid should move the cursor searching for entries as the user types. Gets or sets the delay (in seconds) before the AutoSearch buffer is reset. Gets or sets the background color for the control. Gets or sets the type of border around the control. Gets the last visible row in the scrollable area. Gets or sets the contents of the selected range. Gets or sets the characters used as row and column separators in clip strings. Gets or sets the column that contains the cursor. Gets or sets the last column in the current selection. Gets a ComboBoxEditor object that provides easy access to properties of the currently active ComboBox editor. Gets or sets the list of items to be used by the dropdown editor. Gets a CellRange object that contains the cell at coordinates Row, Col.

AutoGenerateColumns (inherited from C1FlexGridBase) AutoResize (inherited from C1FlexGridBase) AutoSearch (inherited from C1FlexGridBase) AutoSearchDelay (inherited from C1FlexGridBase) BackColor (inherited from C1FlexGridBase) BorderStyle (inherited from ScrollableControl) BottomRow (inherited from C1FlexGridBase) Clip (inherited from C1FlexGridBase) ClipSeparators (inherited from C1FlexGridBase) Col (inherited from C1FlexGridBase) ColSel (inherited from C1FlexGridBase) ComboBoxEditor (inherited from C1FlexGridBase)

ComboList (inherited from C1FlexGridBase) CursorCell (inherited from C1FlexGridBase)

C1FlexGridClassic Properties 785

CustomComparer (inherited from C1FlexGridBase)

Gets or sets a custom comparer object used by the grid to perform grouping, merging, and searching operations. Gets or sets the specific list in a DataSource object that the grid should display. Gets or sets the data source for the grid. Gets or sets whether the control should use an offscreen buffer when painting to reduce flicker. Gets or sets a value that determines if the user can drag data from the control. Gets or sets whether the control should fire the OwnerDrawCell event. Gets or sets a value that determines if the control can accept data that the user drags onto it. Gets or sets the input mask to use when editing cells. Gets or sets an EditFlags flags that affect the grid's editing behavior. Gets or sets a reference to the cell editor that is currently active. Gets or sets whether the last column should be extended to fill the control. Gets or sets the type of focus rectangle to display. Gets or sets the foreground color for the control. Gets the collection of control glyphs (images used to show sorting, checkboxes, and so on). Gets or sets when to highlight selected cells. Gets or sets the first visible column in the scrollable area. Gets the CellRangeCollection that determines which grid cells are merged when the AllowMerging property is set to AllowMergingEnum.Custom. Gets the index of the column under the cursor. Gets the index of the row under the cursor. Gets a GridPrinter object that specifies printing parameters for the grid. Gets the last visible column in the scrollable area. Gets or sets the row that contains the cursor. Gets or sets the last row in the current selection. Gets a rectangle that defines the scrollable portion of the control. Gets or sets which scroll bars should appear on the control.

DataMember (inherited from C1FlexGridBase) DataSource (inherited from C1FlexGridBase) DoubleBuffer (inherited from C1FlexGridBase) DragMode (inherited from C1FlexGridBase) DrawMode (inherited from C1FlexGridBase) DropMode (inherited from C1FlexGridBase) EditMask (inherited from C1FlexGridBase) EditOptions (inherited from C1FlexGridBase) Editor (inherited from C1FlexGridBase) ExtendLastCol (inherited from C1FlexGridBase) FocusRect (inherited from C1FlexGridBase) ForeColor (inherited from C1FlexGridBase) Glyphs (inherited from C1FlexGridBase) HighLight (inherited from C1FlexGridBase) LeftCol (inherited from C1FlexGridBase) MergedRanges (inherited from C1FlexGrid)

MouseCol (inherited from C1FlexGridBase) MouseRow (inherited from C1FlexGridBase) PrintParameters (inherited from C1FlexGridBase) RightCol (inherited from C1FlexGridBase) Row (inherited from C1FlexGridBase) RowSel (inherited from C1FlexGridBase) ScrollableRectangle (inherited from C1FlexGridBase) ScrollBars (inherited from ScrollableControl)

786 C1.Win.C1FlexGrid.Classic Namespace

ScrollBarsVisible (inherited from ScrollableControl) ScrollOptions (inherited from C1FlexGridBase) ScrollPosition (inherited from ScrollableControl) Selection (inherited from C1FlexGridBase) ShowButtons (inherited from C1FlexGridBase) ShowCellLabels (inherited from C1FlexGridBase) ShowCursor (inherited from C1FlexGridBase) ShowErrors (inherited from C1FlexGridBase) ShowSort (inherited from C1FlexGridBase) ShowThemedHeaders (inherited from C1FlexGridBase) SortColumn (inherited from C1FlexGridBase) SubtotalPosition (inherited from C1FlexGridBase) TopRow (inherited from C1FlexGridBase) Tree (inherited from C1FlexGridBase) UseCompatibleTextRendering (inherited from C1FlexGridBase) Item (inherited from C1FlexGridBase) See Also

Gets a ScrollBars value that indicates which scrollbars are currently visible. Gets or sets a ScrollFlags value that specifies the grid scrolling behavior. Gets or sets the location of the auto-scroll position. Gets the selected range in normalized form. Gets or sets when to display combo buttons in cells. Gets or sets whether the grid should display labels over cells whose contents are partially hidden. Gets or sets whether the grid should display a DB-style cursor on the first fixed column. Gets or sets whether the grid should display error information in cells and rows. Gets or sets whether the grid should display sorting glyphs (a triangle) on the headers of sorted columns. Gets or sets whether the control should use Xp themes for displaying row or column headers. Gets a reference to the column that defines the current sort applied to the grid. Gets or sets whether node rows appear above or below the data. Gets or sets the first visible row in the scrollable area. Gets a reference to the GridTree object that controls the appearance of the outline tree in the grid. Specifies whether text rendering should be compatible with previouse releases of WinForms.

C1FlexGridClassic Class | C1.Win.C1FlexGrid.Classic Namespace

C1FlexGridClassic Methods
The methods of the C1FlexGridClassic class are listed here. For a complete list of C1FlexGridClassic class members, see the C1FlexGridClassic Members topic. Public Methods AutoSizeCols (inherited from C1FlexGridBase) AutoSizeRows (inherited from C1FlexGridBase) BeginInit (inherited from C1FlexGridBase) CreateImage (inherited from C1FlexGridBase) EndInit (inherited from C1FlexGridBase) Overloaded. Adjusts the width of all columns to fit the data. Overloaded. Adjusts the height of all rows to fit the data. Signals the object that initialization is starting. Overloaded. Creates an image of the entire grid. Signals the object that initialization is complete.

C1FlexGridClassic Events 787

FinishEditing (inherited from C1FlexGridBase) HitTest (inherited from C1FlexGridBase) IsCellCheckBox (inherited from C1FlexGridBase) IsCellSelected (inherited from C1FlexGridBase) RemoveItem (inherited from C1FlexGridBase) StartEditing (inherited from C1FlexGridBase) SaveExcel (inherited from C1FlexGridBase) Subtotal (inherited from C1FlexGridBase) Clear (inherited from C1FlexGridBase) GetDataDisplay (inherited from C1FlexGridBase) LoadExcel (inherited from C1FlexGridBase) Protected Methods CreateAccessibilityInstance (inherited from C1FlexGridBase) OnChangeScrollBarPosition (inherited from C1FlexGridBase) OnImeStartComposition (inherited from ScrollableControl) OnThemeChanged (inherited from C1FlexGridBase) See Also

Overloaded. Finishes editing the current cell and takes the grid out of edit mode. Overloaded. Returns information about the control at the current mouse position. Gets a value that determines whether the cell contents are displayed as a checkbox. Gets a value that determines if a cell is selected. Overloaded. Removes the last row from the grid. Overloaded. Puts the grid in edit mode and starts editing the current cell. Saves the grid contents to a Microsoft Excel (.xls) file. Groups rows based on cell contents and calculates aggregate values. Clears the grid. Gets the value in a grid cell, formatted as a string, and the image or checkbox in the cell. Loads the grid from the first worksheet in a Microsoft Excel (.xls) file. Creates a new accessibility object for the control. Calculates the new position of a scrollbar in response to a user command. Called when the control receives a WM_IME_STARTCOMPOSITION message. Called when the control receives a WM_THEMECHANGED message.

C1FlexGridClassic Class | C1.Win.C1FlexGrid.Classic Namespace

C1FlexGridClassic Events
The events of the C1FlexGridClassic class are listed here. For a complete list of C1FlexGridClassic class members, see the C1FlexGridClassic Members topic. Public Events AfterAddRow (inherited from C1FlexGridBase) AfterCollapse (inherited from C1FlexGridBase) AfterDataRefresh (inherited from C1FlexGridBase) AfterDeleteRow (inherited from C1FlexGridBase) AfterDragColumn (inherited from C1FlexGridBase) AfterDragRow (inherited from C1FlexGridBase) Fires after a new row is added by the user. Fires after a node row is collapsed or expanded. Fires after any data source change notifications. Fires after one or more rows are deleted by the user. Fires after the user finishes dragging a column. Fires after the user finishes dragging a row.

788 C1.Win.C1FlexGrid.Classic Namespace

AfterEdit (inherited from C1FlexGridBase) AfterFreezeColumn (inherited from C1FlexGridBase) AfterFreezeRow (inherited from C1FlexGridBase) AfterResizeColumn (inherited from C1FlexGridBase) AfterResizeRow (inherited from C1FlexGridBase) AfterRowColChange (inherited from C1FlexGridBase) AfterScroll (inherited from C1FlexGridBase) AfterSelChange (inherited from C1FlexGridBase) AfterSort (inherited from C1FlexGridBase) BeforeAddRow (inherited from C1FlexGridBase) BeforeAutosizeColumn (inherited from C1FlexGridBase) BeforeAutosizeRow (inherited from C1FlexGridBase) BeforeCollapse (inherited from C1FlexGridBase) BeforeDeleteRow (inherited from C1FlexGridBase) BeforeDoubleClick (inherited from C1FlexGridBase) BeforeDragColumn (inherited from C1FlexGridBase) BeforeDragRow (inherited from C1FlexGridBase) BeforeEdit (inherited from C1FlexGridBase) BeforeFreezeColumn (inherited from C1FlexGridBase) BeforeFreezeRow (inherited from C1FlexGridBase) BeforeMouseDown (inherited from C1FlexGridBase) BeforePageBreak (inherited from C1FlexGridBase) BeforeResizeColumn (inherited from C1FlexGridBase) BeforeResizeRow (inherited from C1FlexGridBase) BeforeRowColChange (inherited from C1FlexGridBase)

Fires after a cell has been edited. Fires after columns are frozen by dragging the frozen column divider. Fires after rows are frozen by dragging the frozen row divider. Fires after a column is resized by dragging the column header. Fires after a row is resized by dragging the row header. Fires after the current cell changes ( Row and Col properties). Fires after the grid scrolls. Fires after the selection changes ( Row, Col, RowSel, ColSel properties). Fires after a column is sorted by a click on a column header. Fires before a new row is added by the user. Fires before a column is automatically resized by a double-click on a column header. Fires before a row is automatically resized by a doubleclick on a row header. Fires before a node row is collapsed or expanded. Fires before a row is deleted by the user. Fires before the DoubleClick event is handled by the grid. Fires before the user starts dragging a column. Fires before the user starts dragging a row. Fires before the grid enters edit mode, and also when the cell that has the focus needs to be painted. Fires before columns are frozen by dragging the frozen column divider. Fires before rows are frozen by dragging the frozen row divider. Fires before the MouseDown event is handled by the grid. Fires while the control is being printed to provide control over page breaks. Fires before a column is resized by dragging the column header. Fires before a row is resized by dragging the row header. Fires before the current cell changes ( Row and Col properties).

C1FlexGridClassic Events 789

BeforeScroll (inherited from C1FlexGridBase) BeforeSelChange (inherited from C1FlexGridBase) BeforeSort (inherited from C1FlexGridBase) BeginPrint (inherited from C1FlexGridBase) CancelAddRow (inherited from C1FlexGridBase) CellButtonClick (inherited from C1FlexGridBase) CellChanged (inherited from C1FlexGridBase) ChangeEdit (inherited from C1FlexGridBase) ComboCloseUp (inherited from C1FlexGridBase) ComboDropDown (inherited from C1FlexGridBase) EndPrint (inherited from C1FlexGridBase) EnterCell (inherited from C1FlexGridBase) GetCellErrorInfo (inherited from C1FlexGridBase) GetRowErrorInfo (inherited from C1FlexGridBase) GetUnboundValue (inherited from C1FlexGridBase) GridChanged (inherited from C1FlexGridBase) GridError (inherited from C1FlexGridBase) KeyDownEdit (inherited from C1FlexGridBase) KeyPressEdit (inherited from C1FlexGridBase) KeyUpEdit (inherited from C1FlexGridBase) LeaveCell (inherited from C1FlexGridBase) LeaveEdit (inherited from C1FlexGridBase) MouseHoverCell (inherited from C1FlexGridBase) OwnerDrawCell (inherited from C1FlexGridBase) PrintPage (inherited from C1FlexGridBase) RowColChange (inherited from C1FlexGridBase)

Fires before the grid scrolls. Fires before the selection changes ( Row, Col, RowSel, ColSel properties). Fires before a column is sorted by a click on a column header. Fires before the grid starts printing. Fires when the cursor leaves the new row without making any changes to it. Fires after the user clicks a cell button. Fires after the contents of a cell have changed. Fires in edit mode, after the contents of the editor change. Fires in edit mode, when the dropdown portion of an editor closes. Fires in edit mode, when the dropdown portion of an editor opens. Fires after the grid finishes printing. Fires after the current cell changes ( Row and Col properties). Fires when ShowErrors is set to true and the control needs error information for a cell. Fires when ShowErrors is set to true and the control needs error information for a row. Fires when the grid needs to retrieve data for an unbound cell. Fires when the grid or its contents change. Fires after the data source reports an error condition. Fires in edit mode, when the user presses a key. Fires in edit mode, when the user presses a character key. Fires in edit mode, when the user releases a key. Fires before the current cell changes ( Row and Col properties). Fires after the control leaves edit mode. Fires when the mouse enters or leaves a cell. Fires before the grid draws a cell, when the DrawMode property is set to DrawModeEnum.OwnerDraw. Fires after the grid finishes printing a page. Fires after the current cell changes ( Row and Col properties).

790 C1.Win.C1FlexGrid.Classic Namespace

SelChange (inherited from C1FlexGridBase) SetUnboundValue (inherited from C1FlexGridBase) SetupEditor (inherited from C1FlexGridBase) ShowScrollTip (inherited from C1FlexGridBase) StartDrag (inherited from C1FlexGridBase) StartEdit (inherited from C1FlexGridBase) ValidateEdit (inherited from C1FlexGridBase) See Also

Fires after the selection changes ( Row, Col, RowSel, ColSel properties). Fires when the grid needs to store data in an unbound cell. Fires after a cell editor has been initialized by the grid, to allow additional custom initialization. Fires before the vertical scrolltip is displayed. Fires before the grid starts an automatic OLE drag operation. Fires before the control enters edit mode. Fires before the control exits cell edit mode, while the editor is still active.

C1FlexGridClassic Class | C1.Win.C1FlexGrid.Classic Namespace

C1.Win.C1FlexGrid.Util.BaseControls Hierarchy 791

C1.Win.C1FlexGrid.Util.BaseControls Namespace
C1.Win.C1FlexGrid.Util.BaseControls Hierarchy

Classes
Class ScrollableControl Description Base class for controls that support auto-scrolling behavior.

Enumerations
Enumeration BorderStyleEnum See Also C1.Win.C1FlexGrid.2 Assembly Description Specifies the type of border to be drawn around the control.

C1.Win.C1FlexGrid.Util.BaseControls Hierarchy
System.Object System.MarshalByRefObject System.ComponentModel.Component System.Windows.Forms.Control C1.Win.C1FlexGrid.Util.BaseControls.ScrollableControl System.ValueType System.[Enum] C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum See Also C1.Win.C1FlexGrid.Util.BaseControls Namespace

C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum Enumeration
Specifies the type of border to be drawn around the control. [Visual Basic] Public Enum C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum [C#] public enum C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum

792 C1.Win.C1FlexGrid.Util.BaseControls Namespace

[Delphi] type C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum = (Fixed3D, FixedSingle, Light3D, None, XpThemes); Namespace: C1.Win.C1FlexGrid.Util.BaseControls Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll) Members Member name Fixed3D FixedSingle Light3D None XpThemes See Also C1.Win.C1FlexGrid.Util.BaseControls Namespace Description A three-dimensional border. A single-line border. A light sunken border. No border. A border drawn using XP themes.

ScrollableControl Class
Base class for controls that support auto-scrolling behavior. For a list of all members of this type, see ScrollableControl Members. System.Object System.MarshalByRefObject System.ComponentModel.Component System.Windows.Forms.Control C1.Win.C1FlexGrid.Util.BaseControls.ScrollableControl C1.Win.C1FlexGrid.C1FlexGridBase [Visual Basic] MustInherit Public Class ScrollableControl Inherits Control [C#] public abstract class ScrollableControl : Control [Delphi] type ScrollableControl = class abstract (Control); Remarks This class is similar to Windows.Forms.ScrollableControl, but provides extra customization, better scroll notification, and support for scroll tracking and Windows XP themes. Namespace: C1.Win.C1FlexGrid.Util.BaseControls Assembly: C1.Win.C1FlexGrid.2 (in C1.Win.C1FlexGrid.2.dll)

ScrollableControl Members 793

See Also ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

ScrollableControl Members
ScrollableControl overview Public Properties BorderStyle ScrollableRectangle ScrollBars ScrollBarsVisible ScrollPosition Protected Constructors ScrollableControl Constructor Protected Methods BuildScrollableRectangle Dispose OnChangeScrollBarPosition OnImeStartComposition OnMouseWheel OnPaint OnScroll OnScrollTip OnSizeChanged OnThemeChanged See Also ScrollableControl Class | C1.Win.C1FlexGrid.Util.BaseControls Namespace Builds a rectangle that defines the scrollable portion of the control for a given pair of scroll offsets. Overloaded. Overridden. Releases all resources used by the Control. Calculates the new position of a scrollbar in response to a user command. Called when the control receives a WM_IME_STARTCOMPOSITION message. Overridden. Raises the MouseWheel event. Overridden. Raises the Paint event. Called after the control scrolls (see the ScrollPosition property). Called before the controls displays a scroll tip. Overridden. Raises the SizeChanged event. Called when the control receives a WM_THEMECHANGED message. Creates a new instance of a ScrollableControl class. Gets or sets the type of border around the control. Gets a rectangle that defines the scrollable portion of the control. Gets or sets which scroll bars should appear on the control. Gets a ScrollBars value that indicates which scrollbars are currently visible. Gets or sets the location of the auto-scroll position.

ScrollableControl Constructor
Creates a new instance of a ScrollableControl class. [Visual Basic] Protected Function New()

794 C1.Win.C1FlexGrid.Util.BaseControls Namespace

[C#] protected ScrollableControl() [Delphi] strict protected constructor Create(); See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

ScrollableControl Properties
The properties of the ScrollableControl class are listed here. For a complete list of ScrollableControl class members, see the ScrollableControl Members topic. Public Properties BorderStyle ScrollableRectangle ScrollBars ScrollBarsVisible ScrollPosition See Also ScrollableControl Class | C1.Win.C1FlexGrid.Util.BaseControls Namespace Gets or sets the type of border around the control. Gets a rectangle that defines the scrollable portion of the control. Gets or sets which scroll bars should appear on the control. Gets a ScrollBars value that indicates which scrollbars are currently visible. Gets or sets the location of the auto-scroll position.

ScrollableControl.BorderStyle Property
Gets or sets the type of border around the control. [Visual Basic] Overridable Public Property BorderStyle As C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum [C#] virtual public C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum BorderStyle {get;set;} [Delphi] public property BorderStyle: C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum read get_BorderStyle write set_BorderStyle; See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

ScrollableControl.ScrollableRectangle Property
Gets a rectangle that defines the scrollable portion of the control.

ScrollableControl.ScrollBars Property 795

[Visual Basic] Overridable Public ReadOnly Property ScrollableRectangle As Rectangle [C#] virtual public Rectangle ScrollableRectangle {get;} [Delphi] public property ScrollableRectangle: Rectangle read get_ScrollableRectangle; See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

ScrollableControl.ScrollBars Property
Gets or sets which scroll bars should appear on the control. [Visual Basic] Public Property ScrollBars As ScrollBars [C#] public ScrollBars ScrollBars {get;set;} [Delphi] public property ScrollBars: ScrollBars read get_ScrollBars write set_ScrollBars; Remarks Scroll bars are displayed only if the contents of the control extend beyond its client area. For example, if ScrollBars is set to Horizontal, a horizontal scroll bar is displayed only if the control is not wide enough to display all columns at once. Even when it has no scrollbars, the control will still scroll to keep the selection visible. If you want to prevent scrolling, handle the C1FlexGridBase.BeforeScroll event and set its RangeEventArgs.Cancel parameter to true. You can force the control to display scrollbars at all times with the ForceScrollBars property. You can determine which scrollbars are currently visible with the ScrollBarsVisible property. See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace | ScrollableControl.ScrollBarsVisible

ScrollableControl.ScrollBarsVisible Property
Gets a ScrollBars value that indicates which scrollbars are currently visible. [Visual Basic] Public ReadOnly Property ScrollBarsVisible As ScrollBars [C#] public ScrollBars ScrollBarsVisible {get;} [Delphi] public property ScrollBarsVisible: ScrollBars read get_ScrollBarsVisible;

796 C1.Win.C1FlexGrid.Util.BaseControls Namespace

See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace | ScrollableControl.ScrollBars

ScrollableControl.ScrollPosition Property
Gets or sets the location of the auto-scroll position. [Visual Basic] Public Property ScrollPosition As Point [C#] public Point ScrollPosition {get;set;} [Delphi] public property ScrollPosition: Point read get_ScrollPosition write set_ScrollPosition; Remarks Use the ScrollPosition property to get or set the scroll position using pixel coordinates. Use the C1FlexGridBase.TopRow and C1FlexGridBase.LeftCol properties to get or set the scroll position using cell coordinates. Example This code binds two grids (_flexLeft and _flexRight) together and synchronizes their scrolling in the vertical direction (the user can scroll the grids independently in the horizontal direction). Visual Basic ' bind grids together _flexRight.DataSource = _flexLeft _flexLeft.ScrollBars = ScrollBars.Horizontal ' syncronize vertical scrolling ' (this handles the AfterScroll event for both grids) Private Sub flex_AfterScroll(sender As Object, e As C1.Win.C1FlexGrid.RangeEventArgs) ' update sender grid (could be _flexLeft or _flexRight) Dim src As C1FlexGrid.C1FlexGrid = CType(sender, C1FlexGrid) src.Update() ' get new vertical position from sender grid Dim y As Integer = src.ScrollPosition.Y ' apply new vertical position to the other grid If src.Equals = _flexLeft Then _flexRight.ScrollPosition = New Point(_flexRight.ScrollPosition.X, y) Else _flexLeft.ScrollPosition = New Point(_flexLeft.ScrollPosition.X, y) End If End Sub

ScrollableControl.ScrollPosition Property 797

C# // bind grids together _flexRight.DataSource = _flexLeft; _flexLeft.ScrollBars = ScrollBars.Horizontal; // syncronize vertical scrolling // (this handles the AfterScroll event for both grids) private void flex_AfterScroll(object sender, C1.Win.C1FlexGrid.RangeEventArgs e) { // update sender grid (could be _flexLeft or _flexRight) C1FlexGrid.C1FlexGrid src = ((C1FlexGrid)sender); src.Update(); // get new vertical position from sender grid int y = src.ScrollPosition.Y; // apply new vertical position to the other grid if (src.Equals == _flexLeft) { _flexRight.ScrollPosition = new Point(_flexRight.ScrollPosition.X, y); } else { _flexLeft.ScrollPosition = new Point(_flexLeft.ScrollPosition.X, y); } }

Delphi // bind grids together _flexRight.DataSource := _flexLeft; _flexLeft.ScrollBars := ScrollBars.Horizontal; // synchronize vertical scrolling // (this handles the AfterScroll event for both grids) procedure flex_AfterScroll(sender: System.Object; e: C1.Win.C1FlexGrid.RangeEventArgs); var src:= C1FlexGrid.C1FlexGrid; y := integer; begin // update sender grid (could be _flexLeft or _flexRight) src := (C1FlexGrid(sender)); src.Update; // get new vertical position from sender grid y := src.ScrollPosition.Y; // apply new vertical position to the other grid if (src.Equals = _flexLeft) then _flexRight.ScrollPosition := Point.Create(_flexRight.ScrollPosition.X, y) else _flexLeft.ScrollPosition :=

798 C1.Win.C1FlexGrid.Util.BaseControls Namespace

Point.Create(_flexLeft.ScrollPosition.X, y); end; See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

ScrollableControl Methods
The methods of the ScrollableControl class are listed here. For a complete list of ScrollableControl class members, see the ScrollableControl Members topic. Protected Methods BuildScrollableRectangle Dispose OnChangeScrollBarPosition OnImeStartComposition OnMouseWheel OnPaint OnScroll OnScrollTip OnSizeChanged OnThemeChanged See Also ScrollableControl Class | C1.Win.C1FlexGrid.Util.BaseControls Namespace Builds a rectangle that defines the scrollable portion of the control for a given pair of scroll offsets. Overloaded. Overridden. Releases all resources used by the Control. Calculates the new position of a scrollbar in response to a user command. Called when the control receives a WM_IME_STARTCOMPOSITION message. Overridden. Raises the MouseWheel event. Overridden. Raises the Paint event. Called after the control scrolls (see the ScrollPosition property). Called before the controls displays a scroll tip. Overridden. Raises the SizeChanged event. Called when the control receives a WM_THEMECHANGED message.

ScrollableControl.BuildScrollableRectangle Method
Builds a rectangle that defines the scrollable portion of the control for a given pair of scroll offsets. [Visual Basic] Overridable Protected Function BuildScrollableRectangle( _ ByVal dx As Integer, _ ByVal dy As Integer _ ) As Rectangle [C#] virtual protected Rectangle BuildScrollableRectangle( int dx, int dy );

ScrollableControl.Dispose Method 799

[Delphi] strict protected function BuildScrollableRectangle( dx: Int32; dy: Int32 ): Rectangle; virtual; Parameters dx Horizontal scroll offset. dy Vertical scroll offset. Return Value A Drawing.Rectangle that defines the scrollable portion of the control. Remarks This method is for internal use. It allows derived classes to customize the control scrolling behavior. See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

ScrollableControl.Dispose Method
Releases all resources used by the Control. [Visual Basic] Overrides Protected Sub Dispose( _ ByVal disposing As Boolean _ ) [C#] override protected void Dispose( bool disposing ); [Delphi] strict protected procedure Dispose( disposing: Boolean ); overload; override; Parameters disposing True to release both managed and unmanaged resources, False to release only unmanaged resources. See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

ScrollableControl.OnChangeScrollBarPosition Method
Calculates the new position of a scrollbar in response to a user command.

800 C1.Win.C1FlexGrid.Util.BaseControls Namespace

[Visual Basic] Overridable Protected Function OnChangeScrollBarPosition( _ ByVal cmd As Integer, _ ByVal verticalBar As Boolean, _ ByVal curPos As Integer, _ ByVal trackPos As Integer _ ) As Integer [C#] virtual protected int OnChangeScrollBarPosition( int cmd, bool verticalBar, int curPos, int trackPos ); [Delphi] strict protected function OnChangeScrollBarPosition( cmd: Int32; verticalBar: Boolean; curPos: Int32; trackPos: Int32 ): Int32; virtual; Parameters cmd Scroll command (SB_LINEUP, and so on). verticalBar True for the vertical scrollbar, false for the horizontal scrollbar. curPos Current scrollbar position. trackPos Scrollbar thumb position. Return Value The new position for the scrollbar. Remarks Derived classes may override this method to customize the scrolling behavior. See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

ScrollableControl.OnImeStartComposition Method
Called when the control receives a WM_IME_STARTCOMPOSITION message. [Visual Basic] Overridable Protected Sub OnImeStartComposition() [C#] virtual protected void OnImeStartComposition()

ScrollableControl.OnMouseWheel Method 801

[Delphi] strict protected procedure OnImeStartComposition(); virtual; Remarks The WM_IME_STARTCOMPOSITION message is sent immediately before the IME generates the composition string as a result of a keystroke. The message is a notification to an IME window to open its composition window. An application should process this message if it displays composition characters itself. See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

ScrollableControl.OnMouseWheel Method
Raises the MouseWheel event. [Visual Basic] Overrides Protected Sub OnMouseWheel( _ ByVal e As MouseEventArgs _ ) [C#] override protected void OnMouseWheel( MouseEventArgs e ); [Delphi] strict protected procedure OnMouseWheel( e: MouseEventArgs ); override; Parameters e A Windows.Forms.MouseEventArgs that contains the event data. See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

ScrollableControl.OnPaint Method
Raises the Paint event. [Visual Basic] Overrides Protected Sub OnPaint( _ ByVal e As PaintEventArgs _ ) [C#] override protected void OnPaint( PaintEventArgs e );

802 C1.Win.C1FlexGrid.Util.BaseControls Namespace

[Delphi] strict protected procedure OnPaint( e: PaintEventArgs ); override; Parameters e A Windows.Forms.PaintEventArgs that contains the event data. See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

ScrollableControl.OnScroll Method
Called after the control scrolls (see the ScrollPosition property). [Visual Basic] Overridable Protected Sub OnScroll( _ ByVal sb As ScrollBars _ ) [C#] virtual protected void OnScroll( ScrollBars sb ); [Delphi] strict protected procedure OnScroll( sb: ScrollBars ); virtual; Parameters sb ScrollBars value that indicates the scroll direction. See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

ScrollableControl.OnScrollTip Method
Called before the controls displays a scroll tip. [Visual Basic] Overridable Protected Sub OnScrollTip( _ ByVal newValue As Integer _ ) [C#] virtual protected void OnScrollTip( int newValue );

ScrollableControl.OnSizeChanged Method 803

[Delphi] strict protected procedure OnScrollTip( newValue: Int32 ); virtual; Parameters newValue New value for the vertical scrollbar. See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

ScrollableControl.OnSizeChanged Method
Raises the SizeChanged event. [Visual Basic] Overrides Protected Sub OnSizeChanged( _ ByVal e As EventArgs _ ) [C#] override protected void OnSizeChanged( EventArgs e ); [Delphi] strict protected procedure OnSizeChanged( e: EventArgs ); override; Parameters e An EventArgs that contains the event data. See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

ScrollableControl.OnThemeChanged Method
Called when the control receives a WM_THEMECHANGED message. [Visual Basic] Overridable Protected Sub OnThemeChanged() [C#] virtual protected void OnThemeChanged() [Delphi] strict protected procedure OnThemeChanged(); virtual;

804 C1.Win.C1FlexGrid.Util.BaseControls Namespace

Remarks The WM_THEMECHANGED message is broadcast to every window following a theme change event. Examples of theme change events are the activation of a theme, the deactivation of a theme, or a transition from one theme to another. See Also ScrollableControl Class | ScrollableControl Members | C1.Win.C1FlexGrid.Util.BaseControls Namespace

Index 805

Index
2
2 assembly (C1.Win.C1FlexGrid) 245 2 assembly (C1.Win.C1FlexGrid.Classic) 245

A
AboveData enumeration member 764 ActualSize enumeration member 700 Add method 534, 572, 598, 748 AddItem method 346 AddNode method 682 AfterAddRow event 489 AfterCollapse enumeration member 626 AfterCollapse event 489 AfterDataRefresh event 490 AfterDeleteRow event 490 AfterDragColumn event 490 AfterDragRow event 491 AfterEdit event 491 AfterFreezeColumn event 492 AfterFreezeRow event 492 AfterResizeColumn event 492 AfterResizeRow event 493 AfterRowColChange event 493 AfterScroll event 493 AfterSelChange enumeration member 626 AfterSelChange event 494 AfterSort event 495 Aggregate method 351 AggregateBooleans enumeration member 256 AggregateDates enumeration member 256 AggregateEnum enumeration 255 AggregateFlags enumeration 256 All enumeration member 582, 614, 616, 762 AllowAddNew property 305 AllowDelete property 306 AllowDragging property 307, 721 AllowDraggingEnum enumeration 257 AllowEditing property 307, 721 AllowFreezing property 307 AllowFreezingEnum enumeration 257 AllowMerging property 280, 722 AllowMergingEnum enumeration 258 AllowResizing property 308, 722 AllowResizingEnum enumeration 259 AllowSorting property 308, 587 AllowSortingEnum enumeration 260 Alt field 660 Alternate enumeration member 579

Alternate property 565 Always enumeration member 645, 756 AlwaysVisible enumeration member 755 Ascending enumeration member 622, 761 AsDisplayed enumeration member 617, 761 Auto enumeration member 757 AutoClipboard property 309 AutoGenerateColumns property 309 Automatic enumeration member 609, 615 AutomaticCopy enumeration member 609 AutomaticMove enumeration member 609 AutoResize property 310 AutoSearch enumeration member 616 AutoSearch property 310 AutoSearchDelay property 311 AutoSearchEnum enumeration 260 AutoSizeCol method 357 AutoSizeCols method 359 AutoSizeFlags enumeration 261 AutoSizeRow method 362 AutoSizeRows method 363 Average enumeration member 255

B
BackColor enumeration member 762 BackColor property 311, 544 Background enumeration member 614 BackgroundImage enumeration member 762 BackgroundImage property 545 BackgroundImageLayout enumeration member 762 BackgroundImageLayout property 545 BaseControls hierarchy (C1.Win.C1FlexGrid.Util) 791 BaseControls namespace (C1.Win.C1FlexGrid.Util) 791 BeforeAddRow event 495 BeforeAutosizeColumn event 495 BeforeAutosizeRow event 496 BeforeCollapse enumeration member 626 BeforeCollapse event 496 BeforeDeleteRow event 496 BeforeDoubleClick event 497 BeforeDragColumn event 498 BeforeDragRow event 498 BeforeEdit event 499 BeforeFreezeColumn event 499 BeforeFreezeRow event 500 BeforeMouseDown event 500 BeforeMouseDownEventArgs class 261, 262 about BeforeMouseDownEventArgs class 261 all members 262 constructor 262 fields 264 BeforeMouseDownEventArgs.BeforeMouseDownEven tArgs constructor 262 BeforeMouseDownEventArgs.Button field 264

806 Index

BeforeMouseDownEventArgs.Cancel field 265 BeforeMouseDownEventArgs.Clicks field 265 BeforeMouseDownEventArgs.Delta field 265 BeforeMouseDownEventArgs.X field 266 BeforeMouseDownEventArgs.Y field 266 BeforeMouseDownEventHandler delegate 266 BeforePageBreak event 501 BeforeResizeColumn event 501 BeforeResizeRow event 502 BeforeRowColChange event 502 BeforeScroll event 502 BeforeSelChange enumeration member 626 BeforeSelChange event 503 BeforeSort event 503 BeginInit method 365 BeginPrint event 503 BelowData enumeration member 764 Border enumeration member 614, 762 Border property 545 BorderDirEnum enumeration 267 BorderStyle property 794 BorderStyleEnum enumeration (C1.Win.C1FlexGrid) 268 BorderStyleEnum enumeration (C1.Win.C1FlexGrid.Util.BaseControls) 791 Both enumeration member 257, 259, 267, 757 BothUniform enumeration member 259 Bottom property 709 BottomRow property 311, 522 Bounds field 693 BuildScrollableRectangle method 365, 798 BuildString method 553, 574 Button field 264 ButtonBar enumeration member 769

C
c1 field 520, 624 C1EditorFormat method 650 C1EditorGetStyle method 651 C1EditorGetValue method 651 C1EditorInitialize method 652 C1EditorKeyDownFinishEdit method 653 C1EditorUpdateBounds method 653 C1EditorValueIsValid method 654 C1FlexGrid class 268, 269 about C1FlexGrid class 268 all members 269 constructor 276 events 290 methods 281 properties 276 C1FlexGrid hierarchy (C1.Win) 252 C1FlexGrid namespace (C1.Win) 247 C1FlexGrid.AllowMerging property 280 C1FlexGrid.C1FlexGrid constructor 276

C1FlexGrid.DrawCell method 282 C1FlexGrid.DrawRow method 283 C1FlexGrid.GetHeaderThemeState method 283 C1FlexGrid.GetMergedRange method 284 C1FlexGrid.Invalidate method 288 C1FlexGrid.IsCellCursor method 288 C1FlexGrid.IsCellHighlighted method 289 C1FlexGrid.MergedRanges property 280 C1FlexGrid.OnScroll method 290 C1FlexGridBase class 293, 294 about C1FlexGridBase class 293 all members 294 constructor 302 events 487 methods 343 properties 302 C1FlexGridBase.AddItem method 346 C1FlexGridBase.AfterAddRow event 489 C1FlexGridBase.AfterCollapse event 489 C1FlexGridBase.AfterDataRefresh event 490 C1FlexGridBase.AfterDeleteRow event 490 C1FlexGridBase.AfterDragColumn event 490 C1FlexGridBase.AfterDragRow event 491 C1FlexGridBase.AfterEdit event 491 C1FlexGridBase.AfterFreezeColumn event 492 C1FlexGridBase.AfterFreezeRow event 492 C1FlexGridBase.AfterResizeColumn event 492 C1FlexGridBase.AfterResizeRow event 493 C1FlexGridBase.AfterRowColChange event 493 C1FlexGridBase.AfterScroll event 493 C1FlexGridBase.AfterSelChange event 494 C1FlexGridBase.AfterSort event 495 C1FlexGridBase.Aggregate method 351 C1FlexGridBase.AllowAddNew property 305 C1FlexGridBase.AllowDelete property 306 C1FlexGridBase.AllowDragging property 307 C1FlexGridBase.AllowEditing property 307 C1FlexGridBase.AllowFreezing property 307 C1FlexGridBase.AllowResizing property 308 C1FlexGridBase.AllowSorting property 308 C1FlexGridBase.AutoClipboard property 309 C1FlexGridBase.AutoGenerateColumns property 309 C1FlexGridBase.AutoResize property 310 C1FlexGridBase.AutoSearch property 310 C1FlexGridBase.AutoSearchDelay property 311 C1FlexGridBase.AutoSizeCol method 357 C1FlexGridBase.AutoSizeCols method 359 C1FlexGridBase.AutoSizeRow method 362 C1FlexGridBase.AutoSizeRows method 363 C1FlexGridBase.BackColor property 311 C1FlexGridBase.BeforeAddRow event 495 C1FlexGridBase.BeforeAutosizeColumn event 495 C1FlexGridBase.BeforeAutosizeRow event 496 C1FlexGridBase.BeforeCollapse event 496 C1FlexGridBase.BeforeDeleteRow event 496 C1FlexGridBase.BeforeDoubleClick event 497

Index 807

C1FlexGridBase.BeforeDragColumn event 498 C1FlexGridBase.BeforeDragRow event 498 C1FlexGridBase.BeforeEdit event 499 C1FlexGridBase.BeforeFreezeColumn event 499 C1FlexGridBase.BeforeFreezeRow event 500 C1FlexGridBase.BeforeMouseDown event 500 C1FlexGridBase.BeforePageBreak event 501 C1FlexGridBase.BeforeResizeColumn event 501 C1FlexGridBase.BeforeResizeRow event 502 C1FlexGridBase.BeforeRowColChange event 502 C1FlexGridBase.BeforeScroll event 502 C1FlexGridBase.BeforeSelChange event 503 C1FlexGridBase.BeforeSort event 503 C1FlexGridBase.BeginInit method 365 C1FlexGridBase.BeginPrint event 503 C1FlexGridBase.BottomRow property 311 C1FlexGridBase.BuildScrollableRectangle method 365 C1FlexGridBase.C1FlexGridBase constructor 302 C1FlexGridBase.CancelAddRow event 504 C1FlexGridBase.CellButtonClick event 504 C1FlexGridBase.CellButtonImage property 312 C1FlexGridBase.CellChanged event 504 C1FlexGridBase.ChangeEdit event 505 C1FlexGridBase.Clear method 366 C1FlexGridBase.Clip property 312 C1FlexGridBase.ClipSeparators property 313 C1FlexGridBase.Col property 314 C1FlexGridBase.Cols property 314 C1FlexGridBase.ColSel property 315 C1FlexGridBase.ComboBoxEditor property 316 C1FlexGridBase.ComboCloseUp event 505 C1FlexGridBase.ComboDropDown event 505 C1FlexGridBase.ComboList property 317 C1FlexGridBase.CreateAccessibilityInstance method 370 C1FlexGridBase.CreateImage method 370 C1FlexGridBase.CursorCell property 319 C1FlexGridBase.CustomComparer property 319 C1FlexGridBase.DataMember property 320 C1FlexGridBase.DataSource property 321 C1FlexGridBase.Dispose method 375 C1FlexGridBase.DoubleBuffer property 322 C1FlexGridBase.DragMode property 322 C1FlexGridBase.DrawCell method 375 C1FlexGridBase.DrawMode property 322 C1FlexGridBase.DrawRow method 376 C1FlexGridBase.DropMode property 323 C1FlexGridBase.EditMask property 324 C1FlexGridBase.EditOptions property 325 C1FlexGridBase.Editor property 325 C1FlexGridBase.EndInit method 377 C1FlexGridBase.EndPrint event 506 C1FlexGridBase.EnterCell event 506 C1FlexGridBase.ExtendLastCol property 327 C1FlexGridBase.FindRow method 377 C1FlexGridBase.FinishEditing method 380

C1FlexGridBase.FocusRect property 327 C1FlexGridBase.ForeColor property 327 C1FlexGridBase.GetCellCheck method 381 C1FlexGridBase.GetCellErrorInfo event 506 C1FlexGridBase.GetCellImage method 382 C1FlexGridBase.GetCellRange method 383 C1FlexGridBase.GetCellRect method 386 C1FlexGridBase.GetCellStyle method 387 C1FlexGridBase.GetCellStyleDisplay method 388 C1FlexGridBase.GetData method 389 C1FlexGridBase.GetDataDisplay method 391 C1FlexGridBase.GetHeaderThemeState method 395 C1FlexGridBase.GetRowErrorInfo event 507 C1FlexGridBase.GetUnboundValue event 507 C1FlexGridBase.GetUserData method 396 C1FlexGridBase.Glyphs property 328 C1FlexGridBase.GridChanged event 507 C1FlexGridBase.GridError event 508 C1FlexGridBase.HighLight property 329 C1FlexGridBase.HitTest method 398 C1FlexGridBase.Invalidate method 401 C1FlexGridBase.IsCellCheckBox method 403 C1FlexGridBase.IsCellCursor method 404 C1FlexGridBase.IsCellFixed method 405 C1FlexGridBase.IsCellHighlighted method 406 C1FlexGridBase.IsCellSelected method 406 C1FlexGridBase.IsCellValid method 407 C1FlexGridBase.IsInputChar method 408 C1FlexGridBase.IsInputKey method 408 C1FlexGridBase.Item property 329 C1FlexGridBase.KeyActionEnter property 329 C1FlexGridBase.KeyActionTab property 330 C1FlexGridBase.KeyDownEdit event 508 C1FlexGridBase.KeyPressEdit event 508 C1FlexGridBase.KeyUpEdit event 508 C1FlexGridBase.LeaveCell event 509 C1FlexGridBase.LeaveEdit event 509 C1FlexGridBase.LeftCol property 330 C1FlexGridBase.LoadExcel method 409 C1FlexGridBase.LoadExcelSheetNames method 412 C1FlexGridBase.LoadGrid method 413 C1FlexGridBase.MouseCol property 331 C1FlexGridBase.MouseHoverCell event 509 C1FlexGridBase.MouseRow property 331 C1FlexGridBase.OnBackColorChanged method 416 C1FlexGridBase.OnBindingContextChanged method 417 C1FlexGridBase.OnChangeScrollBarPosition method 417 C1FlexGridBase.OnDoubleClick method 418 C1FlexGridBase.OnDragDrop method 418 C1FlexGridBase.OnDragEnter method 419 C1FlexGridBase.OnDragOver method 419 C1FlexGridBase.OnFontChanged method 420 C1FlexGridBase.OnForeColorChanged method 420 C1FlexGridBase.OnGotFocus method 421

808 Index

C1FlexGridBase.OnHandleDestroyed method 421 C1FlexGridBase.OnKeyDown method 422 C1FlexGridBase.OnKeyPress method 422 C1FlexGridBase.OnLeave method 423 C1FlexGridBase.OnLostFocus method 423 C1FlexGridBase.OnMouseDown method 424 C1FlexGridBase.OnMouseLeave method 424 C1FlexGridBase.OnMouseMove method 425 C1FlexGridBase.OnMouseUp method 425 C1FlexGridBase.OnPaint method 426 C1FlexGridBase.OnPaintBackground method 426 C1FlexGridBase.OnScroll method 427 C1FlexGridBase.OnScrollTip method 428 C1FlexGridBase.OnSizeChanged method 428 C1FlexGridBase.OnThemeChanged method 428 C1FlexGridBase.OnValidating method 429 C1FlexGridBase.OnVisibleChanged method 429 C1FlexGridBase.OwnerDrawCell event 510 C1FlexGridBase.PrintGrid method 430 C1FlexGridBase.PrintPage event 510 C1FlexGridBase.PrintParameters property 332 C1FlexGridBase.ReadXml method 433 C1FlexGridBase.Redraw property 332 C1FlexGridBase.RemoveItem method 437 C1FlexGridBase.RightCol property 333 C1FlexGridBase.Row property 334 C1FlexGridBase.RowColChange event 510 C1FlexGridBase.Rows property 334 C1FlexGridBase.RowSel property 335 C1FlexGridBase.SaveExcel method 438 C1FlexGridBase.SaveGrid method 441 C1FlexGridBase.ScrollableRectangle property 335 C1FlexGridBase.ScrollOptions property 336 C1FlexGridBase.SelChange event 511 C1FlexGridBase.Select method 444 C1FlexGridBase.Selection property 336 C1FlexGridBase.SelectionMode property 337 C1FlexGridBase.SetCellCheck method 449 C1FlexGridBase.SetCellImage method 450 C1FlexGridBase.SetCellStyle method 451 C1FlexGridBase.SetData method 453 C1FlexGridBase.SetDataBinding method 460 C1FlexGridBase.SetUnboundValue event 511 C1FlexGridBase.SetupEditor event 512 C1FlexGridBase.SetUserData method 461 C1FlexGridBase.ShowButtons property 338 C1FlexGridBase.ShowCell method 463 C1FlexGridBase.ShowCellLabels property 338 C1FlexGridBase.ShowCursor property 338 C1FlexGridBase.ShowErrors property 339 C1FlexGridBase.ShowScrollTip event 513 C1FlexGridBase.ShowSort property 339 C1FlexGridBase.ShowSortAt method 464 C1FlexGridBase.ShowThemedHeaders property 339 C1FlexGridBase.Sort method 465 C1FlexGridBase.SortColumn property 340

C1FlexGridBase.StartDrag event 514 C1FlexGridBase.StartEdit event 514 C1FlexGridBase.StartEditing method 469 C1FlexGridBase.Styles property 340 C1FlexGridBase.Subtotal method 472 C1FlexGridBase.SubtotalPosition property 341 C1FlexGridBase.TopRow property 341 C1FlexGridBase.Tree property 342 C1FlexGridBase.UseCompatibleTextRendering property 342 C1FlexGridBase.ValidateEdit event 514 C1FlexGridBase.WriteXml method 482 C1FlexGridClassic class 777, 778 about C1FlexGridClassic class 777 all members 778 events 787 methods 786 properties 784 c2 field 520, 624 Cancel field 265, 612, 703, 742, 759, 775 CancelAddRow event 504 Caption property 587, 710 Cell enumeration member 648, 755 CellBorder class 516 about CellBorder class 516 all members 516 properties 516 CellBorder.Color property 517 CellBorder.Direction property 517 CellBorder.Style property 517 CellBorder.Width property 518 CellButtonClick event 504 CellButtonImage property 312 CellChanged event 504 CellDown enumeration member 668 CellLeft enumeration member 668 CellNext enumeration member 668 CellPrev enumeration member 668 CellRange enumeration member 755 CellRange structure 519 about CellRange structure 518 all members 519 fields 520 methods 528 properties 521 CellRange.BottomRow property 522 CellRange.c1 field 520 CellRange.c2 field 520 CellRange.Checkbox property 522 CellRange.Clear method 528 CellRange.Clip property 522 CellRange.Contains method 529 CellRange.ContainsCol method 529 CellRange.ContainsRow method 530 CellRange.Data property 523 CellRange.DataDisplay property 523

Index 809

CellRange.Image property 523 CellRange.IsSingleCell property 524 CellRange.IsValid property 524 CellRange.LeftCol property 524 CellRange.Normalize method 530 CellRange.r1 field 521 CellRange.r2 field 521 CellRange.RightCol property 525 CellRange.Style property 525 CellRange.StyleDisplay property 526 CellRange.StyleNew property 526 CellRange.TopRow property 527 CellRange.ToString method 531 CellRange.UserData property 527 CellRangeCollection class 531, 532 about CellRangeCollection class 531 all members 532 constructor 532 methods 534 properties 533 CellRangeCollection.Add method 534 CellRangeCollection.CellRangeCollection constructor 532 CellRangeCollection.Clear method 536 CellRangeCollection.Contains method 536 CellRangeCollection.Count property 533 CellRangeCollection.IndexOf method 537 CellRangeCollection.Insert method 538 CellRangeCollection.Item property 533 CellRangeCollection.Remove method 539 CellRangeCollection.RemoveAt method 539 CellRight enumeration member 668 CellStyle class 540, 542 about CellStyle class 540 all members 542 methods 553 properties 543 CellStyle.BackColor property 544 CellStyle.BackgroundImage property 545 CellStyle.BackgroundImageLayout property 545 CellStyle.Border property 545 CellStyle.BuildString method 553 CellStyle.Clear method 556 CellStyle.ComboList property 546 CellStyle.DataMap property 546 CellStyle.DataType property 547 CellStyle.DefinedElements property 547 CellStyle.Display property 547 CellStyle.EditMask property 548 CellStyle.Editor property 548 CellStyle.Equals method 557 CellStyle.Font property 548 CellStyle.ForeColor property 549 CellStyle.Format property 549 CellStyle.GetHashCode method 558 CellStyle.ImageAlign property 549

CellStyle.ImageMap property 549 CellStyle.ImageSpacing property 550 CellStyle.Margins property 550 CellStyle.MergeWith method 558 CellStyle.Name property 550 CellStyle.ParseString method 559 CellStyle.Render method 559 CellStyle.TextAlign property 551 CellStyle.TextDirection property 551 CellStyle.TextEffect property 551 CellStyle.Trimming property 552 CellStyle.UserData property 552 CellStyle.WordWrap property 552 CellStyleCollection class 563 about CellStyleCollection class 563 all members 563 methods 571 properties 564 CellStyleCollection.Add method 572 CellStyleCollection.Alternate property 565 CellStyleCollection.BuildString method 574 CellStyleCollection.Clear method 575 CellStyleCollection.ClearUnused method 575 CellStyleCollection.Contains method 575 CellStyleCollection.Count property 565 CellStyleCollection.Editor property 566 CellStyleCollection.EmptyArea property 566 CellStyleCollection.Fixed property 566 CellStyleCollection.Focus property 567 CellStyleCollection.Frozen property 567 CellStyleCollection.Highlight property 567 CellStyleCollection.IndexOf method 576 CellStyleCollection.Item property 568 CellStyleCollection.NewRow property 570 CellStyleCollection.Normal property 570 CellStyleCollection.ParseString method 576 CellStyleCollection.Remove method 577 CellStyleCollection.Search property 570 CellStyleCollection.SelectedColumnHeader property 571 CellStyleCollection.SelectedRowHeader property 571 CellStyleEnum enumeration 579 CellUp enumeration member 668 CenterBottom enumeration member 656, 764 CenterCenter enumeration member 656, 764 CenterTop enumeration member 656, 764 ChangeEdit event 505 Checkbox enumeration member 648 Checkbox field 775 Checkbox property 522 Checked enumeration member 581, 622 CheckEnum enumeration 581 ChildOf enumeration member 689 Children property 679 Classic hierarchy (C1.Win.C1FlexGrid) 777 Classic namespace (C1.Win.C1FlexGrid) 777

810 Index

Clear enumeration member 255 Clear method 366, 528, 536, 556, 575, 592, 643, 677, 716, 733 ClearFlags enumeration 582 ClearUnused method 575 Clicks field 265 Clip property 312, 522 ClipSeparators property 313 Col field 612, 621, 629, 661, 666, 694, 743, 760, 771, 775 Col property 314 ColAdded enumeration member 626 Collapsed enumeration member 622 Collapsed property 679 ColMoved enumeration member 626 Color property 517 ColRemoved enumeration member 626 Cols property 314 ColSel property 315 ColSelected enumeration member 626 Column class 582, 583 about Column class 582 all members 583 methods 592 properties 585 Column enumeration member 755 Column field 646 Column property 640 Column.AllowSorting property 587 Column.Caption property 587 Column.Clear method 592 Column.DataIndex property 588 Column.Index property 588 Column.Invalidate method 592 Column.Item property 588 Column.Left property 589 Column.Move method 593 Column.Name property 589 Column.Right property 590 Column.SafeIndex property 590 Column.Selected property 590 Column.Sort property 591 Column.Width property 591 Column.WidthDisplay property 591 ColumnCollection class 593, 594 about ColumnCollection class 593 all members 594 methods 597 properties 595 ColumnCollection.Add method 598 ColumnCollection.Contains method 598 ColumnCollection.Count property 595 ColumnCollection.Fixed property 596 ColumnCollection.IndexOf method 599 ColumnCollection.Insert method 601 ColumnCollection.InsertRange method 602

ColumnCollection.Item property 596 ColumnCollection.Move method 602 ColumnCollection.MoveRange method 603 ColumnCollection.Remove method 603 ColumnCollection.RemoveRange method 606 ColumnCollection.Selected property 597 ColumnFreeze enumeration member 648 ColumnHeader enumeration member 648 ColumnRange enumeration member 755 ColumnResize enumeration member 648 Columns enumeration member 257, 259, 757 ColumnsUniform enumeration member 259 ComboBoxEditor class 606, 607 about ComboBoxEditor class 606 all members 607 properties 607 ComboBoxEditor property 316 ComboBoxEditor.Items property 607 ComboBoxEditor.SelectedIndex property 608 ComboBoxEditor.SelectedItem property 608 ComboBoxEditor.SelectedKey property 608 ComboCloseUp event 505 ComboDropDown event 505 ComboList enumeration member 762 ComboList property 317, 546, 723 Complete enumeration member 769 CompleteLeaf enumeration member 769 Contains method 529, 536, 575, 598, 738 ContainsCol method 529 ContainsRow method 530 Content enumeration member 582, 614 Control field 661 Count enumeration member 255 Count property 533, 565, 595, 736, 746 CreateAccessibilityInstance method 370 CreateImage method 370 CursorCell property 319 Custom enumeration member 258 CustomComparer property 319 CycleOnDoubleClick enumeration member 616

D
Data property 523, 679 DataDisplay property 523 DataIndex property 588, 710 DataMap enumeration member 762 DataMap property 546, 724 DataMember property 320 DataSource property 321, 710 DataType enumeration member 762 DataType property 547, 724 DBAdd enumeration member 622 DBCursor enumeration member 622 Default enumeration member 755 DefaultSize property 736

Index 811

DefinedElements property 547 DelayedCommit enumeration member 616 DelayedScroll enumeration member 755 Delta field 265 Descending enumeration member 622, 761 Direction property 517 Display enumeration member 762 Display property 547 DisplayEnum enumeration 609 Dispose method 375, 799 Dotted enumeration member 268 Double enumeration member 268 DoubleBuffer property 322 Down enumeration member 689, 765 DragMode property 322 DragModeEnum enumeration 609 DragRowColEventArgs class 610, 611 about DragRowColEventArgs class 610 all members 611 constructor 611 fields 612 DragRowColEventArgs.Cancel field 612 DragRowColEventArgs.Col field 612 DragRowColEventArgs.DragRowColEventArgs constructor 611 DragRowColEventArgs.Position field 613 DragRowColEventArgs.Row field 613 DragRowColEventHandler delegate 613 DrawCell method 282, 375, 699 DrawCellFlags enumeration 614 DrawMode property 322 DrawModeEnum enumeration 615 DrawRow method 283, 376 DropMode property 323 DropModeEnum enumeration 615

ErrorText field 621 Excel enumeration member 618 Exception field 630 ExcludeNodes enumeration member 256 Expanded enumeration member 622 Expanded property 680 ExtendLastCol enumeration member 700 ExtendLastCol property 327

F
FileFlags enumeration 617 FileFormatEnum enumeration 618 Fillet enumeration member 268 FindRow method 377 FinishEditing method 380 First enumeration member 689 FirstChild enumeration member 690 FirstCustomStyle enumeration member 579 FirstSibling enumeration member 690 FitToPage enumeration member 700 FitToPageWidth enumeration member 700 Fixed enumeration member 579 Fixed property 566, 596, 737, 746 Fixed3D enumeration member 791 FixedOnly enumeration member 258 FixedSingle enumeration member 791 Flat enumeration member 268, 766 Focus enumeration member 579 Focus property 567 FocusRect property 327 FocusRectEnum enumeration 618 Font enumeration member 762 Font property 548 Footer property 634 FooterFont property 635 ForeColor enumeration member 762 ForeColor property 327, 549 Format enumeration member 762 Format property 549, 726 Free enumeration member 258 FromCursor enumeration member 260 FromTop enumeration member 260 Frozen enumeration member 579 Frozen property 567, 737

E
EditButton enumeration member 648 EditFlags enumeration 616 EditMask enumeration member 762 EditMask property 324, 548, 725 EditOptions property 325 Editor enumeration member 579, 762 Editor property 325, 548, 566, 725 EmptyArea enumeration member 579 EmptyArea property 566 EndDown enumeration member 668 EndInit method 377 EndPrint event 506 EndRight enumeration member 668 EnsureVisible enumeration member 626 EnsureVisible method 683 EnterCell event 506 Equals method 557 ErrorInfo enumeration member 622

G
GeneralBottom enumeration member 764 GeneralCenter enumeration member 764 GeneralTop enumeration member 764 GetCellCheck method 381 GetCellErrorInfo event 506 GetCellImage method 382 GetCellRange method 383, 684 GetCellRect method 386

812 Index

GetCellStyle method 387 GetCellStyleDisplay method 388 GetData method 389 GetDataDisplay method 391 GetDisplayValue method 655 GetErrorInfoEventArgs class 619 about GetErrorInfoEventArgs class 619 all members 619 constructor 620 fields 620 GetErrorInfoEventArgs.Col field 621 GetErrorInfoEventArgs.ErrorText field 621 GetErrorInfoEventArgs.GetErrorInfoEventArgs constructor 620 GetErrorInfoEventArgs.Row field 621 GetErrorInfoEventHandler delegate 621 GetHashCode method 558 GetHeaderThemeState method 283, 395 GetMergedRange method 284 GetNode method 684 GetRowErrorInfo event 507 GetUnboundValue event 507 GetUserData method 396 GlyphEnum enumeration 622 Glyphs property 328 GrandTotal enumeration member 579 Graphics field 694 Grayed enumeration member 622 GridChanged enumeration member 626 GridChanged event 507 GridChangedEventArgs class 623 about GridChangedEventArgs class 623 all members 623 fields 624 GridChangedEventArgs.c1 field 624 GridChangedEventArgs.c2 field 624 GridChangedEventArgs.GridChangedType field 625 GridChangedEventArgs.r1 field 625 GridChangedEventArgs.r2 field 625 GridChangedEventHandler delegate 625 GridChangedType field 625 GridChangedTypeEnum enumeration 626 GridError event 508 GridErrorEventArgs class 627, 628 about GridErrorEventArgs class 627 all members 628 constructor 628 fields 629 GridErrorEventArgs.Col field 629 GridErrorEventArgs.Exception field 630 GridErrorEventArgs.GridErrorEventArgs constructor 628 GridErrorEventArgs.Handled field 630 GridErrorEventArgs.Row field 630 GridErrorEventHandler delegate 631 GridGlyphs class 631, 632

about GridGlyphs class 631 all members 632 properties 632 GridGlyphs.Item property 632 GridPrinter class 633 about GridPrinter class 633 all members 633 properties 634 GridPrinter.Footer property 634 GridPrinter.FooterFont property 635 GridPrinter.Header property 635 GridPrinter.HeaderFont property 636 GridPrinter.PageCount property 636 GridPrinter.PageNumber property 636 GridPrinter.PrintDocument property 637 GridPrinter.PrintGridFlags property 637 GridPrinter.PrintPreviewDialog property 637 GridTree class 638, 639 about GridTree class 638 all members 639 methods 643 properties 639 GridTree.Clear method 643 GridTree.Column property 640 GridTree.Indent property 640 GridTree.LineColor property 641 GridTree.LineStyle property 641 GridTree.MaximumLevel property 641 GridTree.NodeImageCollapsed property 642 GridTree.NodeImageExpanded property 642 GridTree.Show method 643 GridTree.Sort method 644 GridTree.Style property 642 Groove enumeration member 268

H
Handled field 630, 661, 666, 694, 760 Header property 635 HeaderFont property 636 Heavy enumeration member 618 Height property 711 HeightDisplay property 711 Hide enumeration member 656 Highlight enumeration member 579 HighLight property 329, 567 HighLightEnum enumeration 645 HitTest method 398 HitTestInfo structure 646 about HitTestInfo structure 645 all members 646 fields 646 HitTestInfo.Column field 646 HitTestInfo.Row field 647 HitTestInfo.Type field 647 HitTestInfo.X field 647

Index 813

HitTestInfo.Y field 648 HitTestTypeEnum enumeration 648 HomeLeft enumeration member 668 HomeUp enumeration member 668 Horizontal enumeration member 267

I
IC1EmbeddedEditor interface 649 about IC1EmbeddedEditor interface 649 all members 649 methods 650 IC1EmbeddedEditor.C1EditorFormat method 650 IC1EmbeddedEditor.C1EditorGetStyle method 651 IC1EmbeddedEditor.C1EditorGetValue method 651 IC1EmbeddedEditor.C1EditorInitialize method 652 IC1EmbeddedEditor.C1EditorKeyDownFinishEdit method 653 IC1EmbeddedEditor.C1EditorUpdateBounds method 653 IC1EmbeddedEditor.C1EditorValueIsValid method 654 IC1MultiColumnDictionary interface 655 about IC1MultiColumnDictionary interface 654 all members 655 methods 655 IC1MultiColumnDictionary.GetDisplayValue method 655 IgnoreCase enumeration member 761 IgnoreHidden enumeration member 261 IgnoreMerged enumeration member 261 Image property 523, 680, 696 ImageAlign enumeration member 762 ImageAlign property 549, 727 ImageAlignEnum enumeration 656 ImageAlignFixed property 727 ImageAndText property 727 ImageMap enumeration member 762 ImageMap property 549, 728 ImageOnly enumeration member 609 ImageSpacing enumeration member 762 ImageSpacing property 550 In enumeration member 689 IncludeFixedCells enumeration member 617 IncludeMergedRanges enumeration member 617 Indent property 640 Index property 588, 712, 728 IndexOf method 537, 576, 599 Insert method 538, 601, 749 InsertNode method 749 InsertRange method 602, 750 Inset enumeration member 268, 618, 766 Invalidate method 288, 401, 592, 716, 734 IsCellCheckBox method 403 IsCellCursor method 288, 404 IsCellFixed method 405

IsCellHighlighted method 289, 406 IsCellSelected method 406 IsCellValid method 407 IsInputChar method 408 IsInputKey method 408 IsNew property 712 IsNode property 712 IsSingleCell property 524 IsValid property 524 Item property 329, 533, 568, 588, 596, 632, 713, 747 Items property 607

K
Key property 680 KeyActionEnter property 329 KeyActionEnum enumeration 657 KeyActionTab property 330 KeyChar field 666 KeyCode field 661 KeyData field 662 KeyDownEdit event 508 KeyEditEventArgs class 658 about KeyEditEventArgs class 658 all members 658 constructor 659 fields 660 KeyEditEventArgs.Alt field 660 KeyEditEventArgs.Col field 661 KeyEditEventArgs.Control field 661 KeyEditEventArgs.Handled field 661 KeyEditEventArgs.KeyCode field 661 KeyEditEventArgs.KeyData field 662 KeyEditEventArgs.KeyEditEventArgs constructor 659 KeyEditEventArgs.KeyValue field 662 KeyEditEventArgs.Modifiers field 662 KeyEditEventArgs.Row field 663 KeyEditEventArgs.Shift field 663 KeyEditEventHandler delegate 663 KeyPressEdit event 508 KeyPressEditEventArgs class 664 about KeyPressEditEventArgs class 664 all members 664 constructor 665 fields 666 KeyPressEditEventArgs.Col field 666 KeyPressEditEventArgs.Handled field 666 KeyPressEditEventArgs.KeyChar field 666 KeyPressEditEventArgs.KeyPressEditEventArgs constructor 665 KeyPressEditEventArgs.Row field 667 KeyPressEditEventHandler delegate 667 KeyUpEdit event 508 KeyValue field 662

814 Index

L
Last enumeration member 689 LastChild enumeration member 690 LastSibling enumeration member 690 LayoutChanged enumeration member 626 Leaf enumeration member 769 LeaveCell event 509 LeaveEdit event 509 Left property 589 LeftBottom enumeration member 656, 764 LeftCenter enumeration member 656, 764 LeftCol property 330, 524 LeftTop enumeration member 656, 764 Level property 680 Light enumeration member 618 Light3D enumeration member 791 LineColor property 641 Lines enumeration member 769 LineStyle property 641 ListBox enumeration member 755 LoadExcel method 409 LoadExcelSheetNames method 412 LoadGrid method 413 LoadMergedRanges enumeration member 617

MultiColumnDictionary.Clear method 677 MultiColumnDictionary.MultiColumnDictionary constructor 671

N
Name property 550, 589 Never enumeration member 645 NewRange field 703 NewRow enumeration member 579 NewRow property 570 NextSibling enumeration member 690 Node class 677 about Node class 677 all members 677 methods 681 properties 678 Node property 714 Node.AddNode method 682 Node.Children property 679 Node.Collapsed property 679 Node.Data property 679 Node.EnsureVisible method 683 Node.Expanded property 680 Node.GetCellRange method 684 Node.GetNode method 684 Node.Image property 680 Node.Key property 680 Node.Level property 680 Node.Move method 685 Node.RemoveNode method 686 Node.Row property 681 Node.Select method 687 Node.Sort method 687 NodeImageCollapsed property 642 NodeImageExpanded property 642 NodeMoveEnum enumeration 689 Nodes enumeration member 258 NodeTypeEnum enumeration 690 NoFreezing enumeration member 617 None enumeration member 255, 256, 257, 258, 259, 260, 261, 268, 581, 609, 615, 616, 617, 618, 626, 648, 657, 668, 755, 757, 761, 762, 769, 791 Normal enumeration member 579, 615, 765 Normal property 570 Normalize method 530

M
Manual enumeration member 609, 615 Margins enumeration member 762 Margins property 550 Max enumeration member 255 MaximumLevel property 641 MaxSize property 737 Measuring field 695 MergedRanges property 280 MergeWith method 558 Min enumeration member 255 MinSize property 738 Modifiers field 662 MouseCol property 331 MouseHoverCell event 509 MouseRow property 331 Move method 593, 602, 685, 717, 734, 739, 751 MoveAcross enumeration member 657 MoveAcrossOut enumeration member 657 MoveCursorEnum enumeration 668 MoveDown enumeration member 657 MoveRange method 603, 740, 751 MultiCheck enumeration member 616 MultiColumn enumeration member 260 MultiColumnDictionary class 669, 671 about MultiColumnDictionary class 669 all members 671 constructor 671 methods 676

O
OldRange field 704 OnBackColorChanged method 416 OnBindingContextChanged method 417 OnChangeScrollBarPosition method 417, 799 OnDoubleClick method 418 OnDragDrop method 418 OnDragEnter method 419

Index 815

OnDragOver method 419 OnFontChanged method 420 OnForeColorChanged method 420 OnGotFocus method 421 OnHandleDestroyed method 421 OnImeStartComposition method 800 OnKeyDown method 422 OnKeyPress method 422 OnLeave method 423 OnLostFocus method 423 OnMouseDown method 424 OnMouseLeave method 424 OnMouseMove method 425 OnMouseUp method 425 OnMouseWheel method 801 OnPaint method 426, 801 OnPaintBackground method 426 OnScroll method 290, 427, 802 OnScrollTip method 428, 802 OnSizeChanged method 428, 803 OnThemeChanged method 428, 803 OnValidating method 429 OnVisibleChanged method 429 Order field 760 Out enumeration member 689 OutlineBar enumeration member 648 OutlineTree enumeration member 648 Overlay enumeration member 609 OwnerDraw enumeration member 615 OwnerDrawCell event 510 OwnerDrawCellEventArgs class 691 about OwnerDrawCellEventArgs class 691 all members 691 constructor 692 fields 693 methods 698 properties 695 OwnerDrawCellEventArgs.Bounds field 693 OwnerDrawCellEventArgs.Col field 694 OwnerDrawCellEventArgs.DrawCell method 699 OwnerDrawCellEventArgs.Graphics field 694 OwnerDrawCellEventArgs.Handled field 694 OwnerDrawCellEventArgs.Image property 696 OwnerDrawCellEventArgs.Measuring field 695 OwnerDrawCellEventArgs.OwnerDrawCellEventArgs constructor 692 OwnerDrawCellEventArgs.Row field 695 OwnerDrawCellEventArgs.Style property 696 OwnerDrawCellEventArgs.Text property 698 OwnerDrawCellEventHandler delegate 700

PageNumber property 636 PageRight enumeration member 668 PageUp enumeration member 668 Parent enumeration member 690 ParseString method 559, 576 Percent enumeration member 255 Position field 613 PreviousSibling enumeration member 690 PrintDocument property 637 PrintGrid method 430 PrintGridFlags enumeration 700 PrintGridFlags property 637 PrintPage event 510 PrintParameters property 332 PrintPreviewDialog property 637

R
r1 field 521, 625 r2 field 521, 625 Raised enumeration member 268, 618, 766 RangeEventArgs class 701, 702 about RangeEventArgs class 701 all members 702 constructor 702 fields 703 RangeEventArgs.Cancel field 703 RangeEventArgs.NewRange field 703 RangeEventArgs.OldRange field 704 RangeEventArgs.RangeEventArgs constructor 702 RangeEventHandler delegate 704 ReadXml method 433 Redraw property 332 Remove method 539, 577, 603, 752 RemoveAt method 539 RemoveItem method 437 RemoveNode method 686 RemoveRange method 606, 753 Render method 559 RepaintCell enumeration member 626 RepaintGrid enumeration member 626 RepaintRange enumeration member 626 RestrictAll enumeration member 258 RestrictCols enumeration member 258 RestrictRows enumeration member 258 Right property 590 RightBottom enumeration member 656, 764 RightCenter enumeration member 656, 764 RightCol property 333, 525 RightTop enumeration member 656, 764 Root enumeration member 690 Row class 705 about Row class 705 all members 705 methods 715 properties 707

P
PageCount property 636 PageDown enumeration member 668 PageLeft enumeration member 668

816 Index

Row enumeration member 755 Row field 613, 621, 630, 647, 663, 667, 695, 743, 772, 776 Row property 334, 681 Row.Bottom property 709 Row.Caption property 710 Row.Clear method 716 Row.DataIndex property 710 Row.DataSource property 710 Row.Height property 711 Row.HeightDisplay property 711 Row.Index property 712 Row.Invalidate method 716 Row.IsNew property 712 Row.IsNode property 712 Row.Item property 713 Row.Move method 717 Row.Node property 714 Row.SafeIndex property 714 Row.Selected property 715 Row.Top property 715 RowAdded enumeration member 626 RowCol class 717, 718 about RowCol class 717 all members 718 constructor 719 methods 733 properties 720 RowCol.AllowDragging property 721 RowCol.AllowEditing property 721 RowCol.AllowMerging property 722 RowCol.AllowResizing property 722 RowCol.Clear method 733 RowCol.ComboList property 723 RowCol.DataMap property 724 RowCol.DataType property 724 RowCol.EditMask property 725 RowCol.Editor property 725 RowCol.Format property 726 RowCol.ImageAlign property 727 RowCol.ImageAlignFixed property 727 RowCol.ImageAndText property 727 RowCol.ImageMap property 728 RowCol.Index property 728 RowCol.Invalidate method 734 RowCol.Move method 734 RowCol.RowCol constructor 719 RowCol.Selected property 728 RowCol.Style property 729 RowCol.StyleDisplay property 729 RowCol.StyleFixed property 730 RowCol.StyleFixedDisplay property 730 RowCol.StyleFixedNew property 730 RowCol.StyleNew property 731 RowCol.TextAlign property 731 RowCol.TextAlignFixed property 732

RowCol.UserData property 732 RowCol.Visible property 732 RowColChange event 510 RowColCollection class 734, 735 about RowColCollection class 734 all members 735 methods 738 properties 736 RowColCollection.Contains method 738 RowColCollection.Count property 736 RowColCollection.DefaultSize property 736 RowColCollection.Fixed property 737 RowColCollection.Frozen property 737 RowColCollection.MaxSize property 737 RowColCollection.MinSize property 738 RowColCollection.Move method 739 RowColCollection.MoveRange method 740 RowColEventArgs class 740, 741 about RowColEventArgs class 740 all members 741 constructor 741 fields 742 RowColEventArgs.Cancel field 742 RowColEventArgs.Col field 743 RowColEventArgs.Row field 743 RowColEventArgs.RowColEventArgs constructor 741 RowColEventHandler delegate 743 RowCollection class 744, 745 about RowCollection class 744 all members 745 methods 748 properties 745 RowCollection.Add method 748 RowCollection.Count property 746 RowCollection.Fixed property 746 RowCollection.Insert method 749 RowCollection.InsertNode method 749 RowCollection.InsertRange method 750 RowCollection.Item property 747 RowCollection.Move method 751 RowCollection.MoveRange method 751 RowCollection.Remove method 752 RowCollection.RemoveRange method 753 RowCollection.Selected property 747 RowColToolTipEventHandler delegate 754 RowFreeze enumeration member 648 RowHeader enumeration member 648 RowMoved enumeration member 626 RowRange enumeration member 755 RowRemoved enumeration member 626 RowResize enumeration member 648 Rows enumeration member 257, 259, 757 Rows property 334 RowSel property 335 RowSelected enumeration member 626 RowsUniform enumeration member 259

Index 817

S
SafeIndex property 590, 714 SameSize enumeration member 261 SaveExcel method 438 SaveGrid method 441 SaveMergedRanges enumeration member 617 Scale enumeration member 656 ScrollableControl class 792, 793 about ScrollableControl class 792 all members 793 constructor 793 methods 798 properties 794 ScrollableControl.BorderStyle property 794 ScrollableControl.BuildScrollableRectangle method 798 ScrollableControl.Dispose method 799 ScrollableControl.OnChangeScrollBarPosition method 799 ScrollableControl.OnImeStartComposition method 800 ScrollableControl.OnMouseWheel method 801 ScrollableControl.OnPaint method 801 ScrollableControl.OnScroll method 802 ScrollableControl.OnScrollTip method 802 ScrollableControl.OnSizeChanged method 803 ScrollableControl.OnThemeChanged method 803 ScrollableControl.ScrollableControl constructor 793 ScrollableControl.ScrollableRectangle property 794 ScrollableControl.ScrollBars property 795 ScrollableControl.ScrollBarsVisible property 795 ScrollableControl.ScrollPosition property 796 ScrollableRectangle property 335, 794 ScrollBars property 795 ScrollBarsVisible property 795 ScrollByRowColumn enumeration member 755 ScrollFlags enumeration 755 ScrollOptions property 336 ScrollPosition property 796 Search enumeration member 579 Search property 570 SelChange event 511 Select enumeration member 626 Select method 444, 687 Selected property 590, 597, 715, 728, 747 SelectedColumnHeader enumeration member 579 SelectedColumnHeader property 571 SelectedIndex property 608 SelectedItem property 608 SelectedKey property 608 SelectedRowHeader enumeration member 579 SelectedRowHeader property 571 SelectedRowsOnly enumeration member 617 Selection property 336 SelectionMode property 337 SelectionModeEnum enumeration 755

SetCellCheck method 449 SetCellImage method 450 SetCellStyle method 451 SetData method 453 SetDataBinding method 460 SetUnboundValue event 511 SetupEditor event 512 SetUserData method 461 Shift field 663 Show method 643 ShowButtons property 338 ShowButtonsEnum enumeration 756 ShowCell method 463 ShowCellLabels property 338 ShowCursor property 338 ShowErrors property 339 ShowHighlight enumeration member 700 ShowPageSetupDialog enumeration member 700 ShowPreviewDialog enumeration member 700 ShowPrintDialog enumeration member 700 ShowScrollTip event 513 ShowScrollTips enumeration member 755 ShowSort property 339 ShowSortAt method 464 ShowThemedHeaders property 339 ShowThemedHeadersEnum enumeration 757 Simple enumeration member 769 SimpleLeaf enumeration member 769 SingleColumn enumeration member 260 Solid enumeration member 618 Sort method 465, 644, 687 Sort property 591 SortColEventArgs class 757, 758 about SortColEventArgs class 757 all members 758 constructor 758 fields 759 SortColEventArgs.Cancel field 759 SortColEventArgs.Col field 760 SortColEventArgs.Handled field 760 SortColEventArgs.Order field 760 SortColEventArgs.SortColEventArgs constructor 758 SortColEventHandler delegate 761 SortColumn property 340 SortFlags enumeration 761 Spill enumeration member 258 Stack enumeration member 609 StartDrag event 514 StartEdit event 514 StartEditing method 469 Std enumeration member 255 StdPop enumeration member 255 Stretch enumeration member 656 Style enumeration member 582 Style property 517, 525, 642, 696, 729 StyleApplied enumeration member 626

818 Index

StyleChanged enumeration member 626 StyleDisplay property 526, 729 StyleElementFlags enumeration 762 StyleFixed property 730 StyleFixedDisplay property 730 StyleFixedNew property 730 StyleNew property 526, 731 Styles property 340 Subtotal method 472 Subtotal0 enumeration member 579 Subtotal1 enumeration member 579 Subtotal2 enumeration member 579 Subtotal3 enumeration member 579 Subtotal4 enumeration member 579 Subtotal5 enumeration member 579 SubtotalPosition property 341 SubtotalPositionEnum enumeration 764 Sum enumeration member 255 Symbols enumeration member 769

TSUnchecked enumeration member 581 Type field 647

U
UnboundValueEventArgs class 769, 770 about UnboundValueEventArgs class 769 all members 770 constructor 770 fields 771 UnboundValueEventArgs.Col field 771 UnboundValueEventArgs.Row field 772 UnboundValueEventArgs.UnboundValueEventArgs constructor 770 UnboundValueEventArgs.Value field 772 UnboundValueEventHandler delegate 772 Unchecked enumeration member 581, 622 Up enumeration member 689, 765 Update enumeration member 626 UseColSort enumeration member 761 UseCompatibleTextRendering property 342 UseNumericEditor enumeration member 616 UserData enumeration member 582, 762 UserData property 527, 552, 732

T
Text property 698 TextAlign enumeration member 762 TextAlign property 551, 731 TextAlignEnum enumeration 764 TextAlignFixed property 732 TextComma enumeration member 618 TextCustom enumeration member 618 TextDirection enumeration member 762 TextDirection property 551 TextDirectionEnum enumeration 765 TextEffect enumeration member 762 TextEffect property 551 TextEffectEnum enumeration 766 TextOnly enumeration member 609 TextTab enumeration member 618 Tile enumeration member 656 TileStretch enumeration member 656 ToolTipEventArgs class 766, 767 about ToolTipEventArgs class 766 all members 767 constructor 767 fields 768 ToolTipEventArgs.ToolTipEventArgs constructor 767 ToolTipEventArgs.ToolTipText field 768 ToolTipText field 768 Top property 715 TopRow property 341, 527 ToString method 531 Tree property 342 TreeStyleFlags enumeration 769 Trimming enumeration member 762 Trimming property 552 TSChecked enumeration member 581 TSGrayed enumeration member 581

V
ValidateEdit event 514 ValidateEditEventArgs class 773 about ValidateEditEventArgs class 773 all members 773 constructor 774 fields 774 ValidateEditEventArgs.Cancel field 775 ValidateEditEventArgs.Checkbox field 775 ValidateEditEventArgs.Col field 775 ValidateEditEventArgs.Row field 776 ValidateEditEventArgs.ValidateEditEventArgs constructor 774 ValidateEditEventHandler delegate 776 Value field 772 Var enumeration member 255 VarPop enumeration member 255 Vertical enumeration member 267 Visible property 732 VisibleOnly enumeration member 617

W
WhenEditing enumeration member 756 Width property 518, 591 WidthDisplay property 591 WithFocus enumeration member 645, 756 WordWrap enumeration member 762 WordWrap property 552 WriteXml method 482

Index 819

X
X field 266, 647 XpThemes enumeration member 791

Y
Y field 266, 648

Вам также может понравиться