using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Media;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using DevComponents.DotNetBar.Controls;
using DevComponents.DotNetBar.ScrollBar;
using DevComponents.DotNetBar.SuperGrid.Style;
using DevComponents.SuperGrid.TextMarkup;
using Timer = System.Windows.Forms.Timer;
namespace DevComponents.DotNetBar.SuperGrid
{
    /// 
    /// Represents a Super Grid Control.
    /// 
    [ToolboxItem(true), ToolboxBitmap(typeof(SuperGridControl), "SuperGridControl.png")]
    [Designer("DevComponents.SuperGrid.Design.SuperGridDesigner, DevComponents.SuperGrid.Design, Version=14.1.0.37, Culture=neutral,  PublicKeyToken=26d81176cfa2b486")]
    public class SuperGridControl : Control, INotifyPropertyChanged, IMessageFilter, IOwnerLocalize
    {
        #region Events
        #region ActiveGridChanged
        /// 
        /// Occurs when the active grid changes
        /// 
        [Description("Occurs when the active grid changes.")]
        public event EventHandler ActiveGridChanged;
        #endregion
        #region CellActivated
        /// 
        /// Occurs when a cell has been made the Active Cell
        /// 
        [Description("Occurs when a cell has been made the Active Cell.")]
        public event EventHandler CellActivated;
        #endregion
        #region CellActivating
        /// 
        /// Occurs when a cell is about to be made the Active Cell
        /// 
        [Description("Occurs when a cell is about to be made the Active Cell.")]
        public event EventHandler CellActivating;
        #endregion
        #region CellClick
        /// 
        /// Occurs when a cell has been clicked
        /// 
        [Description("Occurs when a cell has been clicked.")]
        public event EventHandler CellClick;
        #endregion
        #region CellDoubleClick
        /// 
        /// Occurs when a cell has been double clicked
        /// 
        [Description("Occurs when a cell has been double clicked.")]
        public event EventHandler CellDoubleClick;
        #endregion
        #region CellInfoClick
        /// 
        /// Occurs when a cell InfoImage has been clicked
        /// 
        [Description("Occurs when a cell InfoImage has been clicked.")]
        public event EventHandler CellInfoClick;
        #endregion
        #region CellInfoDoubleClick
        /// 
        /// Occurs when a cell InfoImage has been double clicked
        /// 
        [Description("Occurs when a cell InfoImage has been double clicked.")]
        public event EventHandler CellInfoDoubleClick;
        #endregion
        #region CellInfoEnter
        /// 
        /// Occurs when a Cell InfoImage has been entered via the mouse
        /// 
        [Description("Occurs when a Cell InfoImage has been entered via the mouse.")]
        public event EventHandler CellInfoEnter;
        #endregion
        #region CellInfoLeave
        /// 
        /// Occurs when a Cell InfoImage has been exited via the mouse
        /// 
        [Description("Occurs when a Cell InfoImage has been exited via the mouse.")]
        public event EventHandler CellInfoLeave;
        #endregion
        #region CellMouseDown
        /// 
        /// Occurs when a mouse button is pressed
        /// while the mouse pointer is within a cell
        /// 
        [Description("Occurs when a mouse button is pressed while the mouse pointer is within a cell.")]
        public event EventHandler CellMouseDown;
        #endregion
        #region CellMouseEnter
        /// 
        /// Occurs when the mouse pointer enters a cell
        /// 
        [Description("Occurs when the mouse pointer enters a cell.")]
        public event EventHandler CellMouseEnter;
        #endregion
        #region CellMouseLeave
        /// 
        /// Occurs when the mouse pointer leaves a cell
        /// 
        [Description("Occurs when the mouse pointer leaves a cell.")]
        public event EventHandler CellMouseLeave;
        #endregion
        #region CellMouseMove
        /// 
        /// Occurs when the mouse pointer moves within a cell
        /// 
        [Description("Occurs when the mouse pointer leaves a cell.")]
        public event EventHandler CellMouseMove;
        #endregion
        #region CellMouseUp
        /// 
        /// Occurs when a mouse button is released
        /// while the mouse pointer is within a cell
        /// 
        [Description("Occurs when a mouse button is released while the mouse pointer is within a cell.")]
        public event EventHandler CellMouseUp;
        #endregion
        #region CellValidating
        /// 
        /// Occurs when a cell needs validating
        /// 
        [Description("Occurs when a cell needs validating.")]
        public event EventHandler CellValidating;
        #endregion
        #region CellValidated
        /// 
        /// Occurs when a cell has finished validating
        /// 
        [Description("Occurs when a cell has finished validating.")]
        public event EventHandler CellValidated;
        #endregion
        #region Check events
        /// 
        /// Occurs when a row check state is about to change
        /// 
        [Description("Occurs when a row check state is about to change.")]
        public event EventHandler BeforeCheck;
        /// 
        /// Occurs when a row check state has changed
        /// 
        [Description("Occurs when a row check state has changed.")]
        public event EventHandler AfterCheck;
        #endregion
        #region Collapse events
        /// 
        /// Occurs when a row is about to collapse
        /// 
        [Description("Occurs when a row is about to collapse.")]
        public event EventHandler BeforeCollapse;
        /// 
        /// Occurs when a row has just been collapsed
        /// 
        [Description("Occurs when a row has just been collapsed.")]
        public event EventHandler AfterCollapse;
        #endregion
        #region CellUserFunction
        /// 
        /// Occurs when a cell User function needs evaluated
        /// 
        [Description("Occurs when a cell User function needs evaluated.")]
        public event EventHandler CellUserFunction;
        #endregion
        #region CellValueChanged
        /// 
        /// Occurs when any cell Value changes
        /// 
        [Description("Occurs when any cell Value changes.")]
        public event EventHandler CellValueChanged;
        #endregion
        #region ColumnGrouped
        /// 
        /// Occurs when a column has been Grouped
        /// 
        [Description("Occurs when a column has been Grouped.")]
        public event EventHandler ColumnGrouped;
        #endregion
        #region ColumnHeaderClick
        /// 
        /// Occurs when a column header has been clicked
        /// 
        [Description("Occurs when a column header has been clicked.")]
        public event EventHandler ColumnHeaderClick;
        #endregion
        #region ColumnHeaderDoubleClick
        /// 
        /// Occurs when a column header has been double clicked
        /// 
        [Description("Occurs when a column header has been double clicked.")]
        public event EventHandler ColumnHeaderDoubleClick;
        #endregion
        #region ColumnHeaderMarkupLinkClick
        /// 
        /// Occurs when a GridColumn Header has a MarkupLink that has been clicked
        /// 
        [Description("Occurs when a GridColumn Header has a MarkupLink that has been clicked.")]
        public event EventHandler ColumnHeaderMarkupLinkClick;
        #endregion
        #region ColumnHeaderMouseDown
        /// 
        /// Occurs when a mouse button is pressed
        /// while the mouse pointer is within the Column Header
        /// 
        [Description("Occurs when a mouse button is pressed while the mouse pointer is within the Column Header.")]
        public event EventHandler ColumnHeaderMouseDown;
        #endregion
        #region ColumnHeaderMouseEnter
        /// 
        /// Occurs when the mouse pointer enters the Column Header
        /// 
        [Description("Occurs when the mouse pointer enters the Column Header.")]
        public event EventHandler ColumnHeaderMouseEnter;
        #endregion
        #region ColumnHeaderMouseLeave
        /// 
        /// Occurs when the mouse pointer leaves the Column Header
        /// 
        [Description("Occurs when the mouse pointer leaves the Column Header.")]
        public event EventHandler ColumnHeaderMouseLeave;
        #endregion
        #region ColumnHeaderMouseMove
        /// 
        /// Occurs when the mouse pointer moves within the Column Header
        /// 
        [Description("Occurs when the mouse pointer leaves the Column Header.")]
        public event EventHandler ColumnHeaderMouseMove;
        #endregion
        #region ColumnHeaderMouseUp
        /// 
        /// Occurs when a mouse button is released
        /// while the mouse pointer is within the Column Header
        /// 
        [Description("Occurs when a mouse button is released while the mouse pointer is within the Column Header.")]
        public event EventHandler ColumnHeaderMouseUp;
        #endregion
        #region ColumnGroupHeaderClick
        /// 
        /// Occurs when a column GroupHeader has been clicked
        /// 
        [Description("Occurs when a column GroupHeader has been clicked.")]
        public event EventHandler ColumnGroupHeaderClick;
        #endregion
        #region ColumnGroupHeaderDoubleClick
        /// 
        /// Occurs when a column GroupHeader has been double clicked
        /// 
        [Description("Occurs when a column GroupHeader has been double clicked.")]
        public event EventHandler ColumnGroupHeaderDoubleClick;
        #endregion
        #region ColumnGroupHeaderMarkupLinkClick
        /// 
        /// Occurs when a GridColumn GroupHeader has a MarkupLink that has been clicked
        /// 
        [Description("Occurs when a GridColumn GroupHeader has a MarkupLink that has been clicked.")]
        public event EventHandler ColumnGroupHeaderMarkupLinkClick;
        #endregion
        #region ColumnResized
        /// 
        /// Occurs when a column GroupHeader has been resized
        /// 
        [Description("Occurs when a column GroupHeader has been resized.")]
        public event EventHandler ColumnGroupHeaderResized;
        #endregion
        #region ColumnMoved
        /// 
        /// Occurs when a column has been moved or reordered
        /// 
        [Description("Occurs when a column has been moved or reordered.")]
        public event EventHandler ColumnMoved;
        #endregion
        #region ColumnResized
        /// 
        /// Occurs when a column has been resized
        /// 
        [Description("Occurs when a column has been resized.")]
        public event EventHandler ColumnResized;
        #endregion
        #region ColumnRowHeaderClick
        /// 
        /// Occurs when a column RowHeader has been clicked
        /// 
        [Description("Occurs when a column RowHeader has been clicked.")]
        public event EventHandler ColumnRowHeaderClick;
        #endregion
        #region ColumnRowHeaderDoubleClick
        /// 
        /// Occurs when a column RowHeader has been double clicked
        /// 
        [Description("Occurs when a column RowHeader has been double clicked.")]
        public event EventHandler ColumnRowHeaderDoubleClick;
        #endregion
        #region CompareElements
        /// 
        /// Occurs when the grid needs to compare 1 element with another
        /// 
        [Description("Occurs when the grid needs to compare 1 element with another.")]
        public event EventHandler CompareElements;
        #endregion
        #region DataBindingStart
        /// 
        /// Occurs when the grid is about to start a nested binding operation
        /// 
        [Description("Occurs when the grid is about to start a nested binding operation.")]
        public event EventHandler DataBindingStart;
        #endregion
        #region DataBindingComplete
        /// 
        /// Occurs when a grid's data binding is complete
        /// 
        [Description("Occurs when a grid's data binding is complete.")]
        public event EventHandler DataBindingComplete;
        #endregion
        #region DataError
        /// 
        /// Occurs when an error is encountered while dealing with data
        /// 
        [Description("Occurs when an error is encountered while dealing with data.")]
        public event EventHandler DataError;
        #endregion
        #region DataFilteringStart
        /// 
        /// Occurs when the grid is about to start a data filtering operation
        /// 
        [Description("Occurs when the grid is about to start a data filtering operation.")]
        public event EventHandler DataFilteringStart;
        #endregion
        #region DataFilteringComplete
        /// 
        /// Occurs when a grid's data Filtering is complete
        /// 
        [Description("Occurs when a grid's data filtering is complete.")]
        public event EventHandler DataFilteringComplete;
        #endregion
        #region ItemDrag
        /// 
        /// Occurs when a user begins dragging an item
        /// 
        [Description("Occurs when a user begins dragging an item.")]
        public event EventHandler ItemDrag;
        #endregion
        #region Editor events
        #region BeginEdit
        /// 
        /// Occurs when a modal cell edit is about to begin
        /// 
        [Description("Occurs when a modal cell edit is about to begin.")]
        public event EventHandler BeginEdit;
        #endregion
        #region CancelEdit
        /// 
        /// Occurs when a modal cell edit has been canceled
        /// 
        [Description("Occurs when a modal cell edit has been canceled.")]
        public event EventHandler CancelEdit;
        #endregion
        #region CloseEdit
        /// 
        /// Occurs when a modal cell edit has closed
        /// 
        [Description("Occurs when a modal cell edit has closed.")]
        public event EventHandler CloseEdit;
        #endregion
        #region EditorValueChanged
        /// 
        /// Occurs when a cell editor value has changed
        /// 
        [Description("Occurs when a cell editor value has changed.")]
        public event EventHandler EditorValueChanged;
        #endregion
        #region EndEdit
        /// 
        /// Occurs when a modal cell edit is ending
        /// 
        [Description("Occurs when a modal cell edit is ending.")]
        public event EventHandler EndEdit;
        #endregion
        #region GetEditor
        /// 
        /// Occurs when a cell editor is needed
        /// 
        [Description("Occurs when a cell editor is needed.")]
        public event EventHandler GetEditor;
        #endregion
        #region GetRenderer
        /// 
        /// Occurs when a cell renderer is needed
        /// 
        [Description("Occurs when a cell renderer is needed.")]
        public event EventHandler GetRenderer;
        #endregion
        #region InitEditContext
        /// 
        /// Occurs when a cell editor needs it's context initialized
        /// 
        [Description("Occurs when a cell editor needs it's context initialized.")]
        public event EventHandler InitEditContext;
        #endregion
        #endregion
        #region Expand events
        /// 
        /// Occurs when a row is about to be expanded
        /// 
        [Description("Occurs when a row is about to be expanded.")]
        public event EventHandler BeforeExpand;
        /// 
        /// Occurs when a row has just been expanded
        /// 
        [Description("Occurs when a row has just been expanded.")]
        public event EventHandler AfterExpand;
        #endregion
        #region Filter events
        #region FilterBeginEdit
        /// 
        /// Occurs when a column filter edit is about to begin
        /// 
        [Description("Occurs when a column filter edit is about to begin.")]
        public event EventHandler FilterBeginEdit;
        #endregion
        #region FilterCancelEdit
        /// 
        /// Occurs when a column filter edit has been canceled
        /// 
        [Description("Occurs when a column filter edit has been canceled.")]
        public event EventHandler FilterCancelEdit;
        #endregion
        #region FilterColumnError
        /// 
        /// Occurs when a column filter error has occurred
        /// 
        [Description("Occurs when a column filter error has ocurred.")]
        public event EventHandler FilterColumnError;
        #endregion
        #region FilterEditValueChanged
        /// 
        /// Occurs when a filter edit value has changed
        /// 
        [Description("Occurs when a filter edit value has changed.")]
        public event EventHandler FilterEditValueChanged;
        #endregion
        #region FilterEndEdit
        /// 
        /// Occurs when a column filter edit has ended
        /// 
        [Description("Occurs when a column filter edit has ended.")]
        public event EventHandler FilterEndEdit;
        #endregion
        #region FilterHeaderClick
        /// 
        /// Occurs when a Filter header has been clicked
        /// 
        [Description("Occurs when a Filter header has been clicked.")]
        public event EventHandler FilterHeaderClick;
        #endregion
        #region FilterHelpClosing
        /// 
        /// Occurs when a filter expression help window is about to close
        /// 
        [Description("Occurs when a filter expression help window is about to close.")]
        public event EventHandler FilterHelpClosing;
        #endregion
        #region FilterHelpOpening
        /// 
        /// Occurs when a filter expression help window is about to open
        /// 
        [Description("Occurs when a filter expression help window is about to open.")]
        public event EventHandler FilterHelpOpening;
        #endregion
        #region FilterItemsLoaded
        /// 
        /// Occurs following the loading of the items in the
        /// ComboBox, when a ComboBox filter edit is about to begin
        /// 
        [Description("Occurs following the loading of the items in the ComboBox, when a ComboBox filter edit is about to begin.")]
        public event EventHandler FilterItemsLoaded;
        #endregion
        #region FilterLoadItems
        /// 
        /// Occurs when a ComboBox filter edit is about to begin
        /// and the items in the comboBox need to be loaded
        /// 
        [Description("Occurs when a ComboBox filter edit is about to begin and the items in the comboBox need to be loaded.")]
        public event EventHandler FilterLoadItems;
        #endregion
        #region FilterLoadUserData
        /// 
        /// Occurs when user defined Filter data needs to be loaded
        /// 
        [Description("Occurs when user defined Filter data needs to be loaded.")]
        public event EventHandler FilterLoadUserData;
        #endregion
        #region FilterPopupClosing
        /// 
        /// Occurs when a column filter menu is closing
        /// 
        [Description("Occurs when a column filter menu is closing.")]
        public event EventHandler FilterPopupClosing;
        #endregion
        #region FilterPopupLoad
        /// 
        /// Occurs when a column filter menu needs loaded
        /// 
        [Description("Occurs when a column filter menu needs loaded.")]
        public event EventHandler FilterPopupLoad;
        #endregion
        #region FilterPopupLoaded
        /// 
        /// Occurs after a column filter menu has been loaded
        /// 
        [Description("Occurs after a column filter menu has been loaded.")]
        public event EventHandler FilterPopupLoaded;
        #endregion
        #region FilterPopupOpening
        /// 
        /// Occurs when a column filter menu is about to open
        /// 
        [Description("Occurs when a column filter menu is about to open.")]
        public event EventHandler FilterPopupOpening;
        #endregion
        #region FilterPopupValueChanged
        /// 
        /// Occurs when a filter popup value has changed
        /// 
        [Description("Occurs when a filter popup value has changed.")]
        public event EventHandler FilterPopupValueChanged;
        #endregion
        #region FilterRowError
        /// 
        /// Occurs when a row filter error has occurred
        /// 
        [Description("Occurs when a row filter error has occurred.")]
        public event EventHandler FilterRowError;
        #endregion
        #region FilterRowHeaderClick
        /// 
        /// Occurs when a Filter RowHeader has been clicked
        /// 
        [Description("Occurs when a Filter RowHeader has been clicked.")]
        public event EventHandler FilterRowHeaderClick;
        #endregion
        #region FilterStoreUserData
        /// 
        /// Occurs when user defined Filter data needs to be stored
        /// 
        [Description("Occurs when user defined Filter data needs to be loaded.")]
        public event EventHandler FilterStoreUserData;
        #endregion
        #region FilterUserFunction
        /// 
        /// Occurs when a Filter User function needs evaluated
        /// 
        [Description("Occurs when a Filter User function needs evaluated.")]
        public event EventHandler FilterUserFunction;
        #endregion
        #region GetFilterEditType
        /// 
        /// Occurs when the column filter edit type is needed
        /// 
        [Description("Occurs when the column filter edit type is needed.")]
        public event EventHandler GetFilterEditType;
        #endregion
        #endregion
        #region GetCellRanges
        /// 
        /// Occurs when the grid needs to get the current merged cell ranges
        /// 
        [Description("Occurs when the grid needs to get the current merged cell ranges.")]
        public event EventHandler GetCellRanges;
        #endregion
        #region GetCellFormattedValue
        /// 
        /// Occurs when a Modal cell Value needs formatted
        /// 
        [Description("Occurs when a Modal cell Value needs formatted.")]
        public event EventHandler GetCellFormattedValue;
        #endregion
        #region GetCellRangeFormattedValue
        /// 
        /// Occurs when a CellRange Formatted Value is needed
        /// 
        [Description("Occurs when a CellRange Formatted Value is needed.")]
        public event EventHandler GetCellRangeFormattedValue;
        #endregion
        #region GetCellStyle
        /// 
        /// Occurs when a Cell Style is needed
        /// 
        [Description("Occurs when a Cell Style is needed.")]
        public event EventHandler GetCellStyle;
        #endregion
        #region GetCellToolTip
        /// 
        /// Occurs when a Cell ToolTip is needed
        /// 
        [Description("Occurs when a Cell ToolTip is needed.")]
        public event EventHandler GetCellToolTip;
        #endregion
        #region GetCellValue
        /// 
        /// Occurs when a Cell Value is needed
        /// 
        [Description("Occurs when a Cell Value is needed.")]
        public event EventHandler GetCellValue;
        #endregion
        #region GetColumnGroupHeaderStyle
        /// 
        /// Occurs when a ColumnGroupHeader style is needed
        /// 
        [Description("Occurs when a ColumnGroupHeader style is needed.")]
        public event EventHandler GetColumnGroupHeaderStyle;
        #endregion
        #region GetColumnHeaderRowHeaderStyle
        /// 
        /// Occurs when a ColumnHeader RowHeader style is needed
        /// 
        [Description("Occurs when a ColumnHeader RowHeader style is needed.")]
        public event EventHandler GetColumnHeaderRowHeaderStyle;
        #endregion
        #region GetColumnHeaderStyle
        /// 
        /// Occurs when a ColumnHeader style is needed
        /// 
        [Description("Occurs when a ColumnHeader style is needed.")]
        public event EventHandler GetColumnHeaderStyle;
        #endregion
        #region GetColumnHeaderToolTip
        /// 
        /// Occurs when a ColumnHeader ToolTip is needed
        /// 
        [Description("Occurs when a ColumnHeader ToolTip is needed.")]
        public event EventHandler GetColumnHeaderToolTip;
        #endregion
        #region GetDisplayRanges
        /// 
        /// Occurs when the grid needs to get the current display ranges
        /// 
        [Description("Occurs when the grid needs to get the current display ranges.")]
        public event EventHandler GetDisplayRanges;
        #endregion
        #region GetFilterRowStyle
        /// 
        /// Occurs when a FilterRow style is needed
        /// 
        [Description("Occurs when a FilterRow style is needed.")]
        public event EventHandler GetFilterRowStyle;
        #endregion
        #region GetFilterColumnHeaderStyle
        /// 
        /// Occurs when a Filter ColumnHeader style is needed
        /// 
        [Description("Occurs when a Filter ColumnHeader style is needed.")]
        public event EventHandler GetFilterColumnHeaderStyle;
        #endregion
        #region ConfigureGroupBox
        /// 
        /// Occurs when a GroupBox Size is needed
        /// 
        [Description("Occurs when a GroupBox needs configured.")]
        public event EventHandler ConfigureGroupBox;
        #endregion
        #region GetGroupDetailRows
        /// 
        /// Occurs when a list of group detail rows is needed
        /// 
        [Description("Occurs when a list of group detail rows is needed.")]
        public event EventHandler GetGroupDetailRows;
        #endregion
        #region GetGroupHeaderStyle
        /// 
        /// Occurs when an GroupHeader style is needed
        /// 
        [Description("Occurs when a GroupHeader style is needed.")]
        public event EventHandler GetGroupHeaderStyle;
        #endregion
        #region GetColumnGroupHeaderToolTip
        /// 
        /// Occurs when a ColumnGroupHeader ToolTip is needed
        /// 
        [Description("Occurs when a ColumnGroupHeader ToolTip is needed.")]
        public event EventHandler GetColumnGroupHeaderToolTip;
        #endregion
        #region GetMergedCellStyle
        /// 
        /// Occurs when a Merged Cell Style is needed
        /// 
        [Description("Occurs when a Merged Cell Style is needed.")]
        public event EventHandler GetMergedCellStyle;
        #endregion
        #region GetPanelStyle
        /// 
        /// Occurs when a GridPanel style is needed
        /// 
        [Description("Occurs when a GridPanel style is needed.")]
        public event EventHandler GetPanelStyle;
        #endregion
        #region GetGroupId
        /// 
        /// Occurs when an element Group identifier is needed
        /// 
        [Description("Occurs when an element Group identifier is needed.")]
        public event EventHandler GetGroupId;
        #endregion
        #region GetRowCellStyle
        /// 
        /// Occurs when a row CellStyle is needed
        /// 
        [Description("Occurs when a row CellStyle is needed.")]
        public event EventHandler GetRowCellStyle;
        #endregion
        #region GetRowHeaderStyle
        /// 
        /// Occurs when a row RowHeader style is needed
        /// 
        [Description("Occurs when a row RowHeader style is needed.")]
        public event EventHandler GetRowHeaderStyle;
        #endregion
        #region GetRowHeaderText
        /// 
        /// Occurs when a row's header text is needed
        /// 
        [Description("Occurs when a row's header text is needed.")]
        public event EventHandler GetRowHeaderText;
        #endregion
        #region GetRowStyle
        /// 
        /// Occurs when a row style is needed
        /// 
        [Description("Occurs when a row style is needed.")]
        public event EventHandler GetRowStyle;
        #endregion
        #region GroupSorting
        /// 
        /// Occurs when a grid Group is about to be sorted
        /// 
        [Description("Occurs when a grid Group are about to be sorted.")]
        public event EventHandler GroupSorting;
        #endregion
        #region GroupSorted
        /// 
        /// Occurs when a grid Group has been sorted
        /// 
        [Description("Occurs when a grid Group has been sorted.")]
        public event EventHandler GroupSorted;
        #endregion
        #region GetTextRowStyle
        /// 
        /// Occurs when a GridTextRow (Header, footer, etc) style is needed
        /// 
        [Description("Occurs when a GridTextRow (Header, footer, etc) style is needed.")]
        public event EventHandler GetTextRowStyle;
        #endregion
        #region GroupChanged
        /// 
        /// Occurs when column Grouping has changed
        /// 
        [Description("Occurs when column Grouping has changed.")]
        public event EventHandler GroupChanged;
        #endregion
        #region GroupHeaderClick
        /// 
        /// Occurs when a Group Header has been clicked
        /// 
        [Description("Occurs when a Group Header has been clicked.")]
        public event EventHandler GroupHeaderClick;
        #endregion
        #region GroupHeaderDoubleClick
        /// 
        /// Occurs when a Group Header has been double clicked
        /// 
        [Description("Occurs when a Group Header has been double clicked.")]
        public event EventHandler GroupHeaderDoubleClick;
        #endregion
        #region LayoutOrderUpdating
        /// 
        /// Occurs when a grid panel's order layout is being updated
        /// 
        [Description("Occurs when a grid panel's order layout is being updated.")]
        public event EventHandler LayoutOrderUpdating;
        #endregion
        #region LayoutOrderUpdated
        /// 
        /// Occurs when a grid panel's order layout has been updated
        /// 
        [Description("Occurs when a grid panel's order layout has been updated.")]
        public event EventHandler LayoutOrderUpdated;
        #endregion
        #region LocalizeString
        /// 
        /// Occurs when the SuperGrid is looking for translated text for one of the internal text that are
        /// displayed on menus, toolbars and customize forms. You need to set Handled=true if you want
        /// your custom text to be used instead of the built-in system value.
        /// 
        public event DotNetBarManager.LocalizeStringEventHandler LocalizeString;
        #endregion
        #region NoRowsMarkupLinkClick
        /// 
        /// Occurs when a GridPanel's NoRowsText has a MarkupLink that has been clicked
        /// 
        [Description("Occurs when a GridPanel's NoRowsText has a MarkupLink that has been clicked.")]
        public event EventHandler NoRowsMarkupLinkClick;
        #endregion
        #region PlayingSound
        /// 
        /// Occurs when the grid is about to play a system sound (beep).
        /// 
        [Description("Occurs when the grid is about to play a system sound (beep)..")]
        public event EventHandler PlayingSound;
        #endregion
        #region GridPreviewKeyDown
        ///
        /// GridPreviewKeyDown
        ///
        [Description("PreviewKeyDown event, with the ability to specify that the key has been handled.")]
        public event EventHandler GridPreviewKeyDown;
        #endregion
        #region PreviewKeyDown
        ///
        /// PreviewKeyDown
        ///
        [Description("Occurs before the System.Windows.Forms.Control.KeyDown event when a key is pressed while focus is on this control.")]
        public new event EventHandler PreviewKeyDown;
        #endregion
        #region RefreshFilter
        /// 
        /// Occurs when the Virtual row filter needs refreshed
        /// 
        [Description("Occurs when the Virtual row filter needs refreshed.")]
        public event EventHandler RefreshFilter;
        #endregion
        #region Render events
        #region PostRenderCell
        /// 
        /// Occurs after a cell has been rendered
        /// 
        [Description("Occurs after a cell has been rendered.")]
        public event EventHandler PostRenderCell;
        #endregion
        #region PreRenderCell
        /// 
        /// Occurs when a cell is about to be rendered
        /// 
        [Description("Occurs when a cell is about to be rendered.")]
        public event EventHandler PreRenderCell;
        #endregion
        #region PostRenderPanelRow
        /// 
        /// Occurs when a nested Panel Row has been rendered
        /// 
        [Description("Occurs when a nested Panel Row has been rendered.")]
        public event EventHandler PostRenderPanelRow;
        #endregion
        #region PreRenderPanelRow
        /// 
        /// Occurs when a nested Panel Row is about to be rendered
        /// 
        [Description("Occurs when a nested Panel Row is about to be rendered.")]
        public event EventHandler PreRenderPanelRow;
        #endregion
        #region PostRenderRow
        /// 
        /// Occurs after a row has been rendered
        /// 
        [Description("Occurs after a row has been rendered.")]
        public event EventHandler PostRenderRow;
        #endregion
        #region PreRenderRow
        /// 
        /// Occurs when a row is about to be rendered
        /// 
        [Description("Occurs when a row is about to be rendered.")]
        public event EventHandler PreRenderRow;
        #endregion
        #region PostRenderTextRow
        /// 
        /// Occurs after a TextRow (Caption, Footer, etc) has been rendered
        /// 
        [Description("Occurs after a TextRow has been rendered.")]
        public event EventHandler PostRenderTextRow;
        #endregion
        #region PreRenderTextRow
        /// 
        /// Occurs when a TextRow (Caption, Footer, etc) is about to be rendered
        /// 
        [Description("Occurs when a TextRow is about to be rendered.")]
        public event EventHandler PreRenderTextRow;
        #endregion
        #region PostRenderGroupHeader
        /// 
        /// Occurs after a Group header has been rendered
        /// 
        [Description("Occurs after a Group header has been rendered.")]
        public event EventHandler PostRenderGroupHeader;
        #endregion
        #region PreRenderGroupHeader
        /// 
        /// Occurs when a Group header is about to be rendered
        /// 
        [Description("Occurs when a Group header is about to be rendered.")]
        public event EventHandler PreRenderGroupHeader;
        #endregion
        #region PostRenderColumnHeader
        /// 
        /// Occurs after a Column header has been rendered
        /// 
        [Description("Occurs after a Column header has been rendered.")]
        public event EventHandler PostRenderColumnHeader;
        #endregion
        #region PreRenderColumnHeader
        /// 
        /// Occurs when a Column header is about to be rendered
        /// 
        [Description("Occurs when a Column header is about to be rendered.")]
        public event EventHandler PreRenderColumnHeader;
        #endregion
        #region PostRenderColumnGroupHeader
        /// 
        /// Occurs after a Column GroupHeader has been rendered
        /// 
        [Description("Occurs after a Column GroupHeader has been rendered.")]
        public event EventHandler PostRenderColumnGroupHeader;
        #endregion
        #region PreRenderColumnGroupHeader
        /// 
        /// Occurs when a Column GroupHeader is about to be rendered
        /// 
        [Description("Occurs when a Column GroupHeader is about to be rendered.")]
        public event EventHandler PreRenderColumnGroupHeader;
        #endregion
        #region PostRenderFilterPopupGripBar
        /// 
        /// Occurs after a FilterPopup GripBar has been rendered
        /// 
        [Description("Occurs after a FilterPopup GripBar has been rendered.")]
        public event EventHandler PostRenderFilterPopupGripBar;
        #endregion
        #region PreRenderFilterPopupGripBar
        /// 
        /// Occurs when a FilterPopup GripBar is about to be rendered
        /// 
        [Description("Occurs when a FilterPopup GripBar is about to be rendered.")]
        public event EventHandler PreRenderFilterPopupGripBar;
        #endregion
        #region PostRenderFilterRow
        /// 
        /// Occurs after a Filter Row has been rendered
        /// 
        [Description("Occurs after a Filter Row has been rendered.")]
        public event EventHandler PostRenderFilterRow;
        #endregion
        #region PreRenderFilterRow
        /// 
        /// Occurs when a Filter Row is about to be rendered
        /// 
        [Description("Occurs when a Filter Row is about to be rendered.")]
        public event EventHandler PreRenderFilterRow;
        #endregion
        #region PostRenderGroupBox
        /// 
        /// Occurs after a GroupBox has been rendered
        /// 
        [Description("Occurs after a GroupBox has been rendered.")]
        public event EventHandler PostRenderGroupBox;
        #endregion
        #region PreRenderGroupBox
        /// 
        /// Occurs when a GroupBox is about to be rendered
        /// 
        [Description("Occurs when a GroupBox is about to be rendered.")]
        public event EventHandler PreRenderGroupBox;
        #endregion
        #region PostRenderGroupBoxConnector
        /// 
        /// Occurs after a GroupBox Connector been rendered
        /// 
        [Description("Occurs after a GroupBox Connectorhas been rendered.")]
        public event EventHandler PostRenderGroupBoxConnector;
        #endregion
        #region PreRenderGroupBoxConnector
        /// 
        /// Occurs when a GroupBox Connector is about to be rendered
        /// 
        [Description("Occurs when a GroupBox Connector is about to be rendered.")]
        public event EventHandler PreRenderGroupBoxConnector;
        #endregion
        #endregion
        #region Row events
        #region LoadVirtualRow
        /// 
        /// Occurs when a virtual row needs loaded
        /// 
        [Description("Occurs when a virtual row needs loaded.")]
        public event EventHandler LoadVirtualRow;
        #endregion
        #region RowActivated
        /// 
        /// Occurs when a row has been made the Active Row
        /// 
        [Description("Occurs when a row has been made the Active Row.")]
        public event EventHandler RowActivated;
        #endregion
        #region RowActivating
        /// 
        /// Occurs when a row is about to be made the Active Row
        /// 
        [Description("Occurs when a row is about to be made the Active Row.")]
        public event EventHandler RowActivating;
        #endregion
        #region RowAdded
        /// 
        /// Occurs when a row has been added
        /// 
        [Description("Occurs when a row has been added.")]
        public event EventHandler RowAdded;
        #endregion
        #region RowAdding
        /// 
        /// Occurs when a row is about to be added
        /// 
        [Description("Occurs when a row is about to be added.")]
        public event EventHandler RowAdding;
        #endregion
        #region RowDeleted
        /// 
        /// Occurs when a row has been deleted
        /// 
        [Description("Occurs when a row has been deleted.")]
        public event EventHandler RowDeleted;
        #endregion
        #region RowDeleting
        /// 
        /// Occurs when a row is about to be deleted
        /// 
        [Description("Occurs when a row is about to be deleted.")]
        public event EventHandler RowDeleting;
        #endregion
        #region GetDetailRowHeight
        /// 
        /// Occurs when a row's 'detail' height is needed
        /// 
        [Description("Occurs when a row's 'detail' height is needed.")]
        public event EventHandler GetDetailRowHeight;
        #endregion
        #region RowClick
        /// 
        /// Occurs when a row has been clicked
        /// 
        [Description("Occurs when a row has been clicked.")]
        public event EventHandler RowClick;
        #endregion
        #region RowDoubleClick
        /// 
        /// Occurs when a row has been double clicked
        /// 
        [Description("Occurs when a row has been double clicked.")]
        public event EventHandler RowDoubleClick;
        #endregion
        #region RowHeaderClick
        /// 
        /// Occurs when a row header has been clicked
        /// 
        [Description("Occurs when a row header has been clicked.")]
        public event EventHandler RowHeaderClick;
        #endregion
        #region RowHeaderDoubleClick
        /// 
        /// Occurs when a row header has been double clicked
        /// 
        [Description("Occurs when a row header has been double clicked.")]
        public event EventHandler RowHeaderDoubleClick;
        #endregion
        #region RowHeaderResized
        /// 
        /// Occurs when the grid Row Header has been resized
        /// 
        [Description("Occurs when the grid Row Header has been resized.")]
        public event EventHandler RowHeaderResized;
        #endregion
        #region RowInfoClick
        /// 
        /// Occurs when a row InfoImage has been clicked
        /// 
        [Description("Occurs when a row InfoImage has been clicked.")]
        public event EventHandler RowInfoClick;
        #endregion
        #region RowInfoDoubleClick
        /// 
        /// Occurs when a row InfoImage has been double clicked
        /// 
        [Description("Occurs when a row InfoImage has been double clicked.")]
        public event EventHandler RowInfoDoubleClick;
        #endregion
        #region RowInfoEnter
        /// 
        /// Occurs when a row InfoImage has been entered via the mouse
        /// 
        [Description("Occurs when a row InfoImage has been entered via the mouse.")]
        public event EventHandler RowInfoEnter;
        #endregion
        #region RowInfoLeave
        /// 
        /// Occurs when a row InfoImage has been exited via the mouse
        /// 
        [Description("Occurs when a row InfoImage has been exited via the mouse.")]
        public event EventHandler RowInfoLeave;
        #endregion
        #region RowLoaded
        /// 
        /// Occurs when a 'bound' data row has been loaded
        /// 
        [Description("Occurs when a 'bound' data row has been loaded.")]
        public event EventHandler RowLoaded;
        #endregion
        #region RowMarkedDirty
        /// 
        /// Occurs when a cell editor marks a row as Dirty
        /// 
        [Description("Occurs when a cell editor marks a row as Dirty.")]
        public event EventHandler RowMarkedDirty;
        #endregion
        #region RowMouseDown
        /// 
        /// Occurs when a mouse button is pressed
        /// while the mouse pointer is within a Row
        /// 
        [Description("Occurs when a mouse button is pressed while the mouse pointer is within a Row.")]
        public event EventHandler RowMouseDown;
        #endregion
        #region RowMouseEnter
        /// 
        /// Occurs when the mouse pointer enters a Row
        /// 
        [Description("Occurs when the mouse pointer enters a Row.")]
        public event EventHandler RowMouseEnter;
        #endregion
        #region RowMouseLeave
        /// 
        /// Occurs when the mouse pointer leaves a Row
        /// 
        [Description("Occurs when the mouse pointer leaves a Row.")]
        public event EventHandler RowMouseLeave;
        #endregion
        #region RowMouseMove
        /// 
        /// Occurs when the mouse pointer moves within a Row
        /// 
        [Description("Occurs when the mouse pointer leaves a Row.")]
        public event EventHandler RowMouseMove;
        #endregion
        #region RowMouseUp
        /// 
        /// Occurs when a mouse button is released
        /// while the mouse pointer is within a Row
        /// 
        [Description("Occurs when a mouse button is released while the mouse pointer is within a Row.")]
        public event EventHandler RowMouseUp;
        #endregion
        #region RowMoved
        /// 
        /// Occurs when a row has been moved or reordered
        /// 
        [Description("Occurs when a row has been moved or reordered.")]
        public event EventHandler RowMoved;
        #endregion
        #region RowMoving
        /// 
        /// Occurs when a row is about to be moved or reordered
        /// 
        [Description("Occurs when a row is about to be moved or reordered.")]
        public event EventHandler RowMoving;
        #endregion
        #region RowResized
        /// 
        /// Occurs when a row has been resized
        /// 
        [Description("Occurs when a row has been resized.")]
        public event EventHandler RowResized;
        #endregion
        #region RowRestored
        /// 
        /// Occurs when a deleted row has been restored (undeleted)
        /// 
        [Description("Occurs when a deleted row has been restored (undeleted).")]
        public event EventHandler RowRestored;
        #endregion
        #region RowRestoring
        /// 
        /// Occurs when a deleted row is about to be restored (undeleted)
        /// 
        [Description("Occurs when a deleted row is about to be restored (undeleted).")]
        public event EventHandler RowRestoring;
        #endregion
        #region RowSetDefaultValues
        /// 
        /// Occurs when a user enters the Insertion Row
        /// or presses the 'insert' key to add a new row,
        /// permitting default values to be set for each cell
        /// 
        [Description("Occurs when a user enters the Insertion Row or presses the 'insert' key to add a new row, permitting default values to be set for each cell.")]
        public event EventHandler RowSetDefaultValues;
        #endregion
        #region RowsGrouped
        /// 
        /// Occurs when the grid Rows have been grouped (or ungrouped)
        /// 
        [Description("Occurs when the grids Row have been grouped (or ungrouped).")]
        public event EventHandler RowsGrouped;
        #endregion
        #region RowsGrouping
        /// 
        /// Occurs when the grid Rows are about to be grouped (or ungrouped)
        /// 
        [Description("Occurs when the Rows are about to be grouped (or ungrouped).")]
        public event EventHandler RowsGrouping;
        #endregion
        #region RowsPurged
        /// 
        /// Occurs when grid rows have been purged
        /// 
        [Description("Occurs when grid rows have been purged.")]
        public event EventHandler RowsPurged;
        #endregion
        #region RowsPurging
        /// 
        /// Occurs when grid rows are about to be purged
        /// 
        [Description("Occurs when grid rows are about to be purged.")]
        public event EventHandler RowsPurging;
        #endregion
        #region RowsSorting
        /// 
        /// Occurs when the grid Rows are about to be sorted
        /// 
        [Description("Occurs when the grid Rows are about to be sorted.")]
        public event EventHandler RowsSorting;
        #endregion
        #region RowsSorted
        /// 
        /// Occurs when the grid Rows have been sorted
        /// 
        [Description("Occurs when the grid Rows have been sorted.")]
        public event EventHandler RowsSorted;
        #endregion
        #region RowValidating
        /// 
        /// Occurs when a row needs validating
        /// 
        [Description("Occurs when a row needs validating.")]
        public event EventHandler RowValidating;
        #endregion
        #region RowValidated
        /// 
        /// Occurs after a row has been validated
        /// 
        [Description("Occurs after a row has been validated.")]
        public event EventHandler RowValidated;
        #endregion
        #region StoreVirtualRow
        /// 
        /// Occurs when a virtual row has changed and
        /// it's contents need stored
        /// 
        [Description("Occurs when a virtual row has changed and it's contents need stored.")]
        public event EventHandler StoreVirtualRow;
        #endregion
        #region VirtualRowLoaded
        /// 
        /// Occurs when after a virtual row has been loaded
        /// 
        [Description("Occurs after a virtual row has been loaded.")]
        public event EventHandler VirtualRowLoaded;
        #endregion
        #endregion
        #region Scroll
        /// 
        /// Occurs when the Horizontal or Vertical scrollbar has been scrolled
        /// 
        [Description("Occurs when the Horizontal or Vertical scrollbar has been scrolled.")]
        public event EventHandler Scroll;
        #endregion
        #region ScrollMin
        /// 
        /// Occurs when the Horizontal or Vertical
        /// scrollbar has been scrolled to the Minimum and released
        /// 
        [Description("Occurs when the Horizontal or Vertical scrollbar has been scrolled to the Minimum and released.")]
        public event EventHandler ScrollMin;
        #endregion
        #region ScrollMax
        /// 
        /// Occurs when the Horizontal or Vertical scrollbar has been scrolled to the Maximum and released
        /// 
        [Description("Occurs when the Horizontal or Vertical scrollbar has been scrolled to the Maximum and released.")]
        public event EventHandler ScrollMax;
        #endregion
        #region SelectionChanged
        /// 
        /// Occurs when the selected items in the grid has changed
        /// 
        [Description("Occurs when the selected items in the grid has changed.")]
        public event EventHandler SelectionChanged;
        #endregion
        #region SelectionChanging
        /// 
        /// Occurs when the selected items in the grid is about to change
        /// 
        [Description("Occurs when the selected items in the grid is about to change.")]
        public event EventHandler SelectionChanging;
        #endregion
        #region SortChanged
        /// 
        /// Occurs when the grid sort order has changed
        /// 
        [Description("Occurs when the grid sort order has changed.")]
        public event EventHandler SortChanged;
        #endregion
        #region StyleManagerChanged
        /// 
        /// Occurs when the StyleManager style has changed
        /// 
        [Description("Occurs when the StyleManager style has changed.")]
        public event EventHandler StyleManagerChanged;
        #endregion
        #region TextRowClick
        /// 
        /// Occurs when a GridTextRow (Title, footer, ...) has been clicked
        /// 
        [Description("Occurs when a GridTextRow (Title, footer, ...) has been clicked.")]
        public event EventHandler TextRowClick;
        #endregion
        #region TextRowHeaderClick
        /// 
        /// Occurs when a GridTextRow (Title, footer, ...) Row Header has been clicked
        /// 
        [Description("Occurs when a GridTextRow (Title, footer, ...) Row Header has been clicked.")]
        public event EventHandler TextRowHeaderClick;
        #endregion
        #region TextRowMarkupLinkClick
        /// 
        /// Occurs when a GridTextRow (Title, footer, ...) has a MarkupLink that has been clicked
        /// 
        [Description("Occurs when a GridTextRow (Title, footer, ...) has a MarkupLink that has been clicked.")]
        public event EventHandler TextRowMarkupLinkClick;
        #endregion
        #region UpdateCellDisplayRanges
        /// 
        /// Occurs after the grid has created its CellDisplayRanges list
        /// 
        [Description("Occurs after the grid has created its CellDisplayRanges list.")]
        public event EventHandler UpdateCellDisplayRanges;
        #endregion
        #endregion
        #region Constants
        const int WmSetFocus = 0x7;
        const int WmKeyDown = 0x100;
        const int WmKeyUp = 0x101;
        const int WmMouseMove = 0x200;
        const int WmMouseDown = 0x201;
        const int WmMouseLeave = 0x2a3;
        const int WmMouseWheel = 0x20a;
        const int InputKeyboard = 1;
        #endregion
        #region DllImports
        #region SendInput
        #region SendInput32
        [StructLayout(LayoutKind.Explicit)]
        struct Input32
        {
            [FieldOffset(0)]
            public int type;
            [FieldOffset(4)]
            public MouseInput mi;
            [FieldOffset(4)]
            public KeyBoardInput ki;
            [FieldOffset(4)]
            public HardwareInput hi;
        }
        [StructLayout(LayoutKind.Sequential)]
        struct KeyBoardInput
        {
            private ushort vk;
            private ushort scan;
            private uint flags;
            private uint time;
            private IntPtr extraInfo;
            public KeyBoardInput(ushort key)
            {
                vk = key;
                scan = 0;
                time = 0;
                extraInfo = IntPtr.Zero;
                flags = 0;
            }
        }
        [StructLayout(LayoutKind.Sequential)]
        struct MouseInput
        {
            public int dx;
            public int dy;
            public uint mouseData;
            public uint dwFlags;
            public uint time;
            public IntPtr dwExtraInfo;
        }
        [StructLayout(LayoutKind.Sequential)]
        struct HardwareInput
        {
            public uint uMsg;
            public ushort wParamL;
            public ushort wParamH;
        }
        [DllImport("user32.dll", SetLastError = true)]
        private static extern uint SendInput(uint nInputs, Input32[] pInputs, int cbSize);
        #endregion
        #region SendInput64
        [StructLayout(LayoutKind.Explicit, Pack = 1)]
        internal struct Input64
        {
            [FieldOffset(0)]
            public uint type;
            [FieldOffset(8)]
            public KeyboardInput64 ki;
        }
        [StructLayout(LayoutKind.Explicit, Pack = 1)]
        internal struct KeyboardInput64
        {
            [FieldOffset(0)]
            public ushort vk;
            [FieldOffset(2)]
            public ushort scan;
            [FieldOffset(4)]
            public uint flags;
            [FieldOffset(12)]
            public uint time;
            [FieldOffset(20)]
            public uint extraInfo1;
            [FieldOffset(28)]
            public uint extraInfo2;
            public KeyboardInput64(ushort key)
            {
                vk = key;
                scan = 0;
                time = 0;
                extraInfo1 = 0;
                extraInfo2 = 0;
                flags = 0;
            }
        } 
        [DllImport("user32.dll", SetLastError = true)]
        private static extern uint SendInput(uint nInputs, Input64[] pInputs, int cbSize);
        #endregion
        #endregion
        #region ScrollWindowEx
        #region RECT definition
        [StructLayout(LayoutKind.Sequential)]
        internal struct RECT
        {
            public int Left, Top, Right, Bottom;
            public RECT(int left, int top, int right, int bottom)
            {
                Left = left;
                Top = top;
                Right = right;
                Bottom = bottom;
            }
            public RECT(System.Drawing.Rectangle r) : this(r.Left, r.Top, r.Right, r.Bottom) { }
            public int X
            {
                get { return Left; }
                set { Right -= (Left - value); Left = value; }
            }
            public int Y
            {
                get { return Top; }
                set { Bottom -= (Top - value); Top = value; }
            }
            public int Height
            {
                get { return Bottom - Top; }
                set { Bottom = value + Top; }
            }
            public int Width
            {
                get { return Right - Left; }
                set { Right = value + Left; }
            }
            public Point Location
            {
                get { return new Point(Left, Top); }
                set { X = value.X; Y = value.Y; }
            }
            public Size Size
            {
                get { return new Size(Width, Height); }
                set { Width = value.Width; Height = value.Height; }
            }
            public static implicit operator Rectangle(RECT r)
            {
                return new Rectangle(r.Left, r.Top, r.Width, r.Height);
            }
            public static implicit operator RECT(Rectangle r)
            {
                return new RECT(r);
            }
            public static bool operator == (RECT r1, RECT r2)
            {
                return r1.Equals(r2);
            }
            public static bool operator != (RECT r1, RECT r2)
            {
                return !r1.Equals(r2);
            }
            public bool Equals(RECT r)
            {
                return r.Left == Left && r.Top == Top && r.Right == Right && r.Bottom == Bottom;
            }
            public override bool Equals(object obj)
            {
                if (obj is RECT)
                    return Equals((RECT)obj);
                else if (obj is Rectangle)
                    return Equals(new RECT((Rectangle)obj));
                return false;
            }
            public override int GetHashCode()
            {
                return ((Rectangle)this).GetHashCode();
            }
            public override string ToString()
            {
                return string.Format(System.Globalization.CultureInfo.CurrentCulture, "{{Left={0},Top={1},Right={2},Bottom={3}}}", Left, Top, Right, Bottom);
            }
        }
        #endregion
        const uint SW_ERASE = (1 << 1);
        const uint SW_INVALIDATE = (1 << 2);
        [DllImport("user32.dll")]
        private static extern int ScrollWindowEx(IntPtr hWnd, int dx, int dy,
            ref RECT scrollRect, ref RECT clipRect, IntPtr hrgn, ref RECT updateRect, uint flags);
        #endregion
        #region GetKeyState
        #region Keyboard
        internal abstract class Keyboard
        {
            [Flags]
            private enum KeyStates
            {
                None = 0,
                Down = 1,
                Toggled = 2
            }
            [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
            private static extern short GetKeyState(int keyCode);
            private static KeyStates GetKeyState(Keys key)
            {
                KeyStates state = KeyStates.None;
                short retVal = GetKeyState((int)key);
                // If the high-order bit is 1, the key is down
                if ((retVal & 0x8000) == 0x8000)
                    state |= KeyStates.Down;
                // If the low-order bit is 1, the key is toggled
                if ((retVal & 1) == 1)
                    state |= KeyStates.Toggled;
                return state;
            }
            public static bool IsKeyDown(Keys key)
            {
                return KeyStates.Down == (GetKeyState(key) & KeyStates.Down);
            }
            public static bool IsKeyToggled(Keys key)
            {
                return KeyStates.Toggled == (GetKeyState(key) & KeyStates.Toggled);
            }
        }
        #endregion
        #endregion
        #endregion
        #region Private variables
        private readonly GridPanel _PrimaryGrid;
        private HScrollBarAdv _HScrollBar;
        private VScrollBarAdv _VScrollBar;
        private int _HScrollOffset;
        private int _VScrollOffset;
        private bool _HScrollBarEnabled;
        private bool _VScrollBarEnabled;
        private bool _ScrollBarScrolling;
        private Rectangle _ViewRect = Rectangle.Empty;
        private Rectangle _CViewRect = Rectangle.Empty;
        private GridElement _CapturedItem;
        private Timer _AutoScrollTimer;
        private AutoScrollEnable _AutoScrollEnable;
        private Rectangle _ScrollRect;
        private bool _PostMouseMove;
        private ushort _BoundsUpdateCount;
        private ushort _BeginUpdateCount;
        private Cursor _GridCursor = Cursors.Default;
        private GridCell _EditorCell;
        private GridCell _NonModalEditorCell;
        private IGridCellEditControl _ActiveEditor;
        private IGridCellEditControl _ActiveNonModalEditor;
        private FilterPanel _ActiveFilterPanel;
        private GridPanel _ActiveGrid;
        private GridContainer _ActiveRow;
        private GridCell _ActiveCell;
        private GridElement _LastProcessedItem;
        private int _LastCellIndex = -1;
        private GridCell _LastActiveCell;
        private string _ToolTipText;
        private System.Windows.Forms.ToolTip _ToolTip;
        private StyleType _SizingStyle = StyleType.NotSet;
        private DefaultVisualStyles _DefaultVisualStyles;
        private DefaultVisualStyles _BaseVisualStyles;
        private ushort _StyleUpdateCount = 1;
        private ushort _StyleMouseOverUpdateCount = 1;
        private ushort _StyleSelectedUpdateCount = 1;
        private ushort _StyleSelectedMouseOverUpdateCount = 1;
        private ushort _ArrangeLayoutCount = 1;
        private ushort _DisplayedMergeLayoutCount = 1;
        private bool _NeedToUpdateIndicees;
        private ushort _IndiceesUpdateCount;
        private GridElement _DesignerElement;
        private Keys _LastKeyDown;
        private Keys _LastModifierKeys;
        private TabSelection _TabSelection = TabSelection.Cell;
        private bool _KeyPressSent;
        private bool _IsInputKey;
        private string _FilterShowAllString = "Show all";
        private string _FilterShowNullString = "Show null";
        private string _FilterShowNotNullString = "Show not null";
        private string _FilterCustomString = "Custom";
        private string _FilterApplyString = "Apply";
        private string _FilterOkString = "OK";
        private string _FilterCancelString = "Cancel";
        private string _FilterCloseString = "Close";
        private string _GroupByWaterMarkText = "Drag a column header here to group by that column";
        private bool _FilterColorizeCustomExpr = true;
        private bool _ShowCustomFilterHelp = true;
        private bool _FilterUseExtendedCustomDialog;
        private int _FilterMaxDropDownHeight = 300;
        private ExpressionColors _FilterExprColors = new ExpressionColors();
        private PopupControl _PopupControl;
        private bool _LocalizedStringsLoaded;
        private ExpandButtonType _ExpandButtonType = ExpandButtonType.NotSet;
        private Cursor _DefaultCursor = Cursors.Default;
        private bool _SetGridCursor;
        private bool _HScrollBarVisible = true;
        private bool _VScrollBarVisible = true;
        private bool _InArrangeGrid;
        private bool _CanScrollEx;
        private bool _EnableFastScrolling = true;
        private int _MaxToolTipLength = 2000;
        #endregion
        /// 
        /// Initializes a new instance of the SuperGridControl class.
        /// 
        public SuperGridControl()
        {
            SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint |
                ControlStyles.Opaque | ControlStyles.ResizeRedraw |
                ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
            _PrimaryGrid = new GridPanel();
            _PrimaryGrid.SuperGrid = this;
            _PrimaryGrid.ContainerBounds = ClientRectangle;
            SetupScrollBars();
            if (DesignMode == false)
            {
                Application.AddMessageFilter(this);
                base.PreviewKeyDown += SuperGridControlPreviewKeyDown;
            }
            UpdateGridStyle();
            StyleManager.Register(this);
            if (BarFunctions.IsWindows7 && Touch.TouchHandler.IsTouchEnabled)
            {
                _TouchHandler = new Touch.TouchHandler(this, Touch.eTouchHandlerType.Gesture);
                _TouchHandler.PanBegin += TouchHandlerPanBegin;
                _TouchHandler.Pan += TouchHandlerPan;
                _TouchHandler.PanEnd += TouchHandlerPanEnd;
            }
        }
        protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
        {
            Dpi.SetScaling(factor);
            base.ScaleControl(factor, specified);
            SetupScrollBars();
        }
        #region OnEnabledChanged
        /// 
        /// OnEnabledChanged
        /// 
        /// 
        protected override void OnEnabledChanged(EventArgs e)
        {
            base.OnEnabledChanged(e);
            Refresh();
        }
        #endregion
        #region StyleManagerStyleChanged
        /// 
        /// Called by StyleManager to notify control that style on
        /// manager has changed and that control should refresh its
        /// appearance if its style is controlled by StyleManager.
        /// 
        /// New active style.
        [EditorBrowsable(EditorBrowsableState.Never)]
        public void StyleManagerStyleChanged(eDotNetBarStyle newStyle)
        {
            UpdateGridStyle();
        }
        private void UpdateGridStyle()
        {
            SuperGridStyle style = SuperGridStyle.Office2010Blue;
            switch (StyleManager.Style)
            {
                case eStyle.Office2007VistaGlass:
                case eStyle.VisualStudio2010Blue:
                case eStyle.Windows7Blue:
                case eStyle.Office2007Blue:
                case eStyle.Office2010Blue:
                    style = SuperGridStyle.Office2010Blue;
                    break;
                case eStyle.Office2007Black:
                case eStyle.Office2010Black:
                    style = SuperGridStyle.Office2010Black;
                    break;
                case eStyle.Office2007Silver:
                case eStyle.Office2010Silver:
                    style = SuperGridStyle.Office2010Silver;
                    break;
                case eStyle.Metro:
                case eStyle.VisualStudio2012Dark:
                case eStyle.VisualStudio2012Light:
                case eStyle.Office2016:
                case eStyle.OfficeMobile2014:
                    style = SuperGridStyle.Metro;
                    break;
            }
            _BaseVisualStyles = VisualStylesTable.GetStyle(style);
            if (IsHandleCreated == true)
            {
                UpdateStyleCount();
                Invalidate(true);
                if (StyleManagerChanged != null)
                    StyleManagerChanged(this, new EventArgs());
            }
        }
        #endregion
        #region Public properties
        #region ActiveCell
        ///
        /// Gets the current active cell
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public GridCell ActiveCell
        {
            get { return (_ActiveCell); }
            internal set
            {
                if (_ActiveCell != value)
                {
                    _LastActiveCell = _ActiveCell;
                    if (_ActiveCell != null)
                        _ActiveCell.EditorDirty = false;
                    _ActiveCell = value;
                    OnActiveCellChanged(_LastActiveCell, _ActiveCell);
                }
            }
        }
        private void OnActiveCellChanged(
            GridCell oldValue, GridCell newValue)
        {
            GridPanel panel =
                (oldValue != null) ? oldValue.GridPanel :
                (newValue != null) ? newValue.GridPanel : null;
            DoCellActivatedEvent(panel, oldValue, newValue);
        }
        #endregion
        #region ActiveEditor
        ///
        /// Gets the currently active cell editor, or null if
        /// no edit is in progress
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public IGridCellEditControl ActiveEditor
        {
            get { return (_ActiveEditor); }
            internal set {_ActiveEditor = value; }
        }
        #endregion
        #region ActiveElement
        ///
        /// Gets the current active grid element (Row/Cell), or null if
        /// there is no current active element
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public GridElement ActiveElement
        {
            get { return (_LastProcessedItem); }
            
            internal set
            {
                if (_LastProcessedItem != value)
                {
                    if (_LastProcessedItem != null)
                        _LastProcessedItem.InvalidateRender();
                    _LastProcessedItem = value;
                    if (_LastProcessedItem != null)
                        _LastProcessedItem.InvalidateRender();
                }
            }
        }
        #endregion
        #region ActiveFilterPanel
        ///
        /// Gets the currently active FilterPanel
        /// editor, or null if no edit is in progress
        ///
        public FilterPanel ActiveFilterPanel
        {
            get { return (_ActiveFilterPanel); }
            internal set { _ActiveFilterPanel = value; }
        }
        #endregion
        #region ActiveGrid
        ///
        /// Gets the current active grid
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public GridPanel ActiveGrid
        {
            get { return (_ActiveGrid); }
            internal set
            {
                if (_ActiveGrid != value)
                {
                    if (_ActiveGrid != null)
                    {
                        if (_ActiveGrid.ActiveRow is GridRow)
                            ((GridRow)_ActiveGrid.ActiveRow).EditorDirty = false;
                    }
                    GridPanel oldValue = _ActiveGrid;
                    _ActiveGrid = value;
                    OnActiveGridChanged(oldValue);
                    ActiveRow = (_ActiveGrid != null) ? _ActiveGrid.ActiveRow : null;
                }
            }
        }
        private void OnActiveGridChanged(GridPanel oldPanel)
        {
            DoActiveGridChangedEvent(oldPanel);
        }
        #endregion
        #region ActiveRow
        ///
        /// Gets the current active row, or null if no row
        /// is defined or active
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public GridContainer ActiveRow
        {
            get
            {
                if (_ActiveGrid != null)
                    return (_ActiveGrid.ActiveRow);
                return (null);
            }
            internal set
            {
                if (_ActiveRow != value)
                {
                    if (_ActiveRow != null)
                        _ActiveRow.FlushRow();
                    GridContainer oldValue = _ActiveRow;
                    _ActiveRow = value;
                    if (_ActiveRow != null)
                        ActiveGrid = _ActiveRow.GridPanel;
                    if (_ActiveGrid != null)
                        _ActiveGrid.ActiveRow = value;
                    OnActiveRowChanged(oldValue, _ActiveRow);
                }
            }
        }
        private void OnActiveRowChanged(
            GridContainer oldValue, GridContainer newValue)
        {
            GridPanel panel =
                (oldValue != null) ? oldValue.GridPanel :
                (newValue != null) ? newValue.GridPanel : null;
            DoRowActivatedEvent(panel, oldValue, newValue);
        }
        #endregion
        #region BaseVisualStyles
        ///
        /// BaseVisualStyles - the SuperGrid starting base styles
        ///
        [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public DefaultVisualStyles BaseVisualStyles
        {
            get { return (_BaseVisualStyles); }
            internal set { _BaseVisualStyles = value; }
        }
        #endregion
        #region DefaultVisualStyles
        ///
        /// Gets or sets the Default Visual Styles for each grid element
        ///
        [Browsable(true), Category("Appearance"), DefaultValue(null)]
        [Description("Indicates the Default Visual Styles for each grid elements.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public DefaultVisualStyles DefaultVisualStyles
        {
            get
            {
                if (_DefaultVisualStyles == null)
                {
                    _DefaultVisualStyles = new DefaultVisualStyles();
                    _DefaultVisualStyles.PropertyChanged += DefaultVisualStylesPropertyChanged;
                }
                return (_DefaultVisualStyles);
            }
            set
            {
                if (_DefaultVisualStyles != value)
                {
                    if (_DefaultVisualStyles != null)
                        _DefaultVisualStyles.PropertyChanged -= DefaultVisualStylesPropertyChanged;
                    _DefaultVisualStyles = value;
                    if (_DefaultVisualStyles != null)
                        _DefaultVisualStyles.PropertyChanged += DefaultVisualStylesPropertyChanged;
                }
            }
        }
        #region DefaultVisualStylesPropertyChanged
        private void DefaultVisualStylesPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            UpdateStyleCount();
            VisualChangeType changeType = ((VisualPropertyChangedEventArgs)e).ChangeType;
            switch (changeType)
            {
                case VisualChangeType.Layout:
                    _PrimaryGrid.NeedsMeasured = true;
                    _PrimaryGrid.InvalidateMerge();
                    break;
                case VisualChangeType.Render:
                    Invalidate();
                    break;
            }
        }
        #endregion
        #endregion
        #region DesignerElement
        ///
        /// For internal use only
        ///
        [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public GridElement DesignerElement
        {
            get { return (_DesignerElement); }
            set
            {
                _DesignerElement = value;
                if (value != null)
                {
                    if (value.NeedsMeasured == true)
                        ArrangeGrid();
                    value.EnsureVisible(true);
                }
                Refresh();
            }
        }
        #endregion
        #region EditorActive
        ///
        /// Gets whether a cell editor is currently active
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public bool EditorActive
        {
            get { return (_ActiveEditor != null); }
        }
        #endregion
        #region EditorCell
        ///
        /// Gets the currently active editor cell, or null
        /// if no cell is currently being edited
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public GridCell EditorCell
        {
            get { return (_EditorCell); }
            internal set { _EditorCell = value; }
        }
        #endregion
        #region EditorColumn
        ///
        /// Gets the column containing the current edit
        /// cell, or null if no edit is in progress
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public GridColumn EditorColumn
        {
            get
            {
                if (_EditorCell != null)
                    return (_EditorCell.GridColumn);
                return (null);
            }
        }
        #endregion
        #region EditorGrid
        ///
        /// Gets the grid containing the cell currently
        /// being edited, or null if no edit is in progress
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public GridPanel EditorGrid
        {
            get
            {
                if (_EditorCell != null)
                    return (_EditorCell.GridPanel);
                return (null);
            }
        }
        #endregion
        #region EditorRow
        ///
        /// Gets the row containing the cell currently
        /// being edited, or null if no edit is in progress
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public GridRow EditorRow
        {
            get
            {
                if (_EditorCell != null)
                    return (_EditorCell.GridRow);
                return (null);
            }
        }
        #endregion
        #region EnableFastScrolling
        /// 
        /// Gets or sets whether Fast Scrolling is enabled. Default is true.
        /// 
        [DefaultValue(true), Category("Behavior")]
        [Description("Indicates whether Fast Scrolling is enabled.")]
        public bool EnableFastScrolling
        {
            get { return (_EnableFastScrolling); }
            set
            {
                if (_EnableFastScrolling != value)
                {
                    _EnableFastScrolling = value;
                    
                    OnPropertyChanged("EnableFastScrolling");
                }
            }
        }
        #endregion
        #region ExpandButtonType
        /// 
        /// Gets or sets the ExpandButton Type
        /// 
        [DefaultValue(ExpandButtonType.NotSet), Category("Appearance")]
        [Description("Indicates the ExpandButton Type.")]
        public ExpandButtonType ExpandButtonType
        {
            get { return (_ExpandButtonType); }
            set
            {
                if (_ExpandButtonType != value)
                {
                    _ExpandButtonType = value;
                    UpdateStyleCount();
                    OnPropertyChanged("ExpandButtonType");
                }
            }
        }
        #endregion
        #region FilterColorizeCustomExpr
        /// 
        /// Gets or sets whether the Custom Expression
        /// dialog colorizes the output expression
        /// 
        [DefaultValue(true), Category("Filtering")]
        [Description("Indicates whether the Custom Expression dialog colorizes the output expression.")]
        public bool FilterColorizeCustomExpr
        {
            get { return (_FilterColorizeCustomExpr); }
            set
            {
                if (_FilterColorizeCustomExpr != value)
                {
                    _FilterColorizeCustomExpr = value;
                    OnPropertyChanged("FilterColorizeCustomExpr");
                }
            }
        }
        #endregion
        #region FilterExprColors
        /// 
        /// Gets or sets the expression colors used in the Custom Expression dialog
        /// 
        [Category("Filtering")]
        [Description("Indicates the expression colors used in the Custom Expression dialog.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public ExpressionColors FilterExprColors
        {
            get { return (_FilterExprColors); }
            set
            {
                if (_FilterExprColors != value)
                {
                    _FilterExprColors = value;
                    OnPropertyChanged("FilterExprColors");
                }
            }
        }
        #endregion
        #region FilterMaxDropDownHeight
        /// 
        /// Gets or sets the max height of
        /// the filter panel and filter popup drop-down
        /// 
        [DefaultValue(300), Category("Filtering")]
        [Description("Indicates the max height of the filter panel and filter popup dropdown.")]
        public int FilterMaxDropDownHeight
        {
            get { return (_FilterMaxDropDownHeight); }
            set
            {
                if (_FilterMaxDropDownHeight != value)
                {
                    _FilterMaxDropDownHeight = value;
                    OnPropertyChanged("FilterMaxDropDownHeight");
                }
            }
        }
        #endregion
        #region FilterUseExtendedCustomDialog
        /// 
        /// Gets or sets whether the Extended Custom Expression dialog
        /// is used (permits user filter definition persistence)
        /// 
        [DefaultValue(false), Category("Filtering")]
        [Description("Indicates whether the Extended Custom Expression dialog is used (permits user filter definition persistence).")]
        public bool FilterUseExtendedCustomDialog
        {
            get { return (_FilterUseExtendedCustomDialog); }
            set
            {
                if (_FilterUseExtendedCustomDialog != value)
                {
                    _FilterUseExtendedCustomDialog = value;
                    OnPropertyChanged("FilterUseExtendedCustomDialog");
                }
            }
        }
        #endregion
        #region GridCursor
        ///
        /// Gets or sets the logical grid cursor
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public Cursor GridCursor
        {
            get { return (_GridCursor); }
            set
            {
                if (value == null || value == Cursors.Default)
                    _GridCursor = _DefaultCursor;
                else
                    _GridCursor = value;
            }
        }
        #endregion
        #region HScrollBar
        ///
        /// Gets a reference to the grid’s horizontal scrollbar
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public HScrollBarAdv HScrollBar
        {
            get { return (_HScrollBar); }
        }
        #endregion
        #region HScrollMaximum
        ///
        /// Gets the horizontal scrollbar maximum value
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public int HScrollMaximum
        {
            get { return (_HScrollBar.Maximum); }
        }
        #endregion
        #region HScrollOffset
        ///
        /// Gets or sets the horizontal scrollbar offset
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public int HScrollOffset
        {
            get { return (_HScrollOffset); }
            set { SetHScrollValue(value); }
        }
        #endregion
        #region HScrollBarVisible
        /// 
        /// Gets or sets whether Horizontal Scroll-bar is shown if needed because content of the control exceeds available width. Default value is true.
        /// 
        [DefaultValue(true), Category("Appearance"), Description("Indicates whether Vertical Scroll-bar is shown if needed because content of the control exceeds available height.")]
        public bool HScrollBarVisible
        {
            get { return _HScrollBarVisible; }
            set
            {
                _HScrollBarVisible = value;
                if (_HScrollBar != null && _HScrollBar.Visible != _HScrollBarVisible)
                {
                    _HScrollBar.Visible = _HScrollBarVisible;
                    PrimaryGrid.InvalidateLayout();
                    Invalidate();
                }
            }
        }
        #endregion
        #region IsUpdateSuspended
        ///
        /// Gets whether grid updating / rendering is suspended
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public bool IsUpdateSuspended
        {
            get { return (_BeginUpdateCount > 0); }
        }
        #endregion
        #region NonModalEditorCell
        ///
        /// Gets the current NonModal cell being edited, or
        /// null if no NonModel cell edit is in progress
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public GridCell NonModalEditorCell
        {
            get { return (_NonModalEditorCell); }
            internal set { _NonModalEditorCell = value; }
        }
        #endregion
        #region PopupControl
        /// 
        /// Gets the current active PopupControl
        /// (Returns null if none is currently active).
        /// 
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public PopupControl PopupControl
        {
            get { return (_PopupControl); }
            internal set { _PopupControl = value; }
        }
        #endregion
        #region PrimaryGrid
        ///
        /// Gets the primary, root grid.
        ///
        [Browsable(true)]
        [Description("Indicates the primary, root grid")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public GridPanel PrimaryGrid
        {
            get { return (_PrimaryGrid); }
        }
        #endregion
        #region ShowCustomFilterHelp
        /// 
        /// Gets or sets whether the Custom
        /// Expression dialog shows user help
        /// 
        [DefaultValue(true), Category("Filtering")]
        [Description("Indicates whether the Custom Expression dialog shows user help.")]
        public bool ShowCustomFilterHelp
        {
            get { return (_ShowCustomFilterHelp); }
            set
            {
                if (_ShowCustomFilterHelp != value)
                {
                    _ShowCustomFilterHelp = value;
                    OnPropertyChanged("ShowCustomFilterHelp");
                }
            }
        }
        #endregion
        #region SizingStyle
        /// 
        /// Gets or sets which StyleType (Default, MouseOver, etc) to use for element sizing
        /// 
        [Browsable(true), DefaultValue(StyleType.NotSet), Category("Appearance")]
        [Description("Indicates which StyleType (Default, MouseOver, etc) to use for element sizing")]
        public StyleType SizingStyle
        {
            get { return (_SizingStyle); }
            set
            {
                if (_SizingStyle != value)
                {
                    _SizingStyle = value;
                    OnSizingStyleChanged();
                }
            }
        }
        private void OnSizingStyleChanged()
        {
            _PrimaryGrid.InvalidateLayout();
            OnPropertyChanged("SizingStyle");
        }
        #endregion
        #region TabSelection
        ///
        /// Gets or sets how the TAB key moves the focus when pressed. 
        ///
        [Browsable(true), DefaultValue(TabSelection.Cell), Category("Behavior")]
        [Description("Indicates how the TAB key moves the focus when pressed.")]
        public TabSelection TabSelection
        {
            get { return (_TabSelection); }
                        
            set
            {
                if (_TabSelection != value)
                {
                    _TabSelection = value;
                    OnPropertyChanged("TabSelection");
                }
            }
        }
        #endregion
        #region MaxToolTipLength
        ///
        /// Gets or sets the maximum tooltip length
        ///
        [Browsable(true), DefaultValue(2000), Category("Behavior")]
        [Description("Indicates the maximum tooltip length.")]
        public int MaxToolTipLength
        {
            get { return (_MaxToolTipLength); }
            set { _MaxToolTipLength = value; }
        }
        #endregion
        #region VScrollBar
        ///
        /// Gets a reference to the grid’s vertical scrollbar
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public VScrollBarAdv VScrollBar
        {
            get { return (_VScrollBar); }
        }
        #endregion
        #region VScrollMaximum
        ///
        /// Gets the vertical scrollbar maximum value
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public int VScrollMaximum
        {
            get { return (_VScrollBar.Maximum); }
        }
        #endregion
        #region VScrollOffset
        ///
        /// Gets the vertical scrollbar offset
        ///
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public int VScrollOffset
        {
            get { return (_VScrollOffset); }
            set { SetVScrollValue(value); }
        }
        #endregion
        #region VScrollBarVisible
        /// 
        /// Gets or sets whether Vertical Scroll-bar is shown if needed because content of the control exceeds available height. Default value is true.
        /// 
        [DefaultValue(true), Category("Appearance"), Description("Indicates whether Vertical Scroll-bar is shown if needed because content of the control exceeds available height.")]
        public bool VScrollBarVisible
        {
            get { return _VScrollBarVisible; }
            set
            {
                _VScrollBarVisible = value;
                if (_VScrollBar != null && _VScrollBar.Visible != _VScrollBarVisible)
                {
                    _VScrollBar.Visible = _VScrollBarVisible;
                    PrimaryGrid.InvalidateLayout();
                    Invalidate();
                }
            }
        }
        #endregion
        #endregion
        #region Internal properties
        #region ActiveNonModalEditor
        ///
        /// ActiveNonModalEditor
        ///
        internal IGridCellEditControl ActiveNonModalEditor
        {
            get { return (_ActiveNonModalEditor); }
            set { _ActiveNonModalEditor = value; }
        }
        #endregion
        #region ArrangeLayoutCount
        internal ushort ArrangeLayoutCount
        {
            get { return (_ArrangeLayoutCount); }
            set { _ArrangeLayoutCount = value; }
        }
        #endregion
        #region BoundsUpdateCount
        internal ushort BoundsUpdateCount
        {
            get {return (_BoundsUpdateCount); }
            set { _BoundsUpdateCount = value; }
        }
        #endregion
        #region CanScrollEx
        internal bool CanScrollEx
        {
            get { return (_CanScrollEx); }
            set { _CanScrollEx = value; }
        }
        #endregion
        #region CapturedItem
        internal GridElement CapturedItem
        {
            get
            {
                if (Capture == false)
                    _CapturedItem = null;
                return (_CapturedItem);
            }
            set { Capture = ((_CapturedItem = value) != null); }
        }
        #endregion
        #region CViewRect
        internal Rectangle CViewRect
        {
            get
            {
                if (_CViewRect.IsEmpty == true)
                {
                    _CViewRect = ClientRectangle;
                    int n =_PrimaryGrid.FixedHeaderHeight;
                    _CViewRect.Y += n;
                    _CViewRect.Height -= n;
                    if (_PrimaryGrid.Footer != null && _PrimaryGrid.Footer.Visible == true)
                        _CViewRect.Height -= _PrimaryGrid.Footer.Size.Height;
                    if (_VScrollBar != null && _VScrollBar.Visible == true)
                        _CViewRect.Width -= VScrollBarWidth;
                    if (_HScrollBar != null && _HScrollBar.Visible == true)
                        _CViewRect.Height -= HScrollBarHeight;
                }
                return (_CViewRect);
            }
        }
        #endregion
        #region DisplayedMergeLayoutCount
        internal ushort DisplayedMergeLayoutCount
        {
            get { return (_DisplayedMergeLayoutCount); }
            set { _DisplayedMergeLayoutCount = value; }
        }
        #endregion
        #region FilterApplyString
        internal string FilterApplyString
        {
            get { return (LocalizedString(ref _FilterApplyString)); }
        }
        #endregion
        #region FilterCancelString
        internal string FilterCancelString
        {
            get { return (LocalizedString(ref _FilterCancelString)); }
        }
        #endregion
        #region FilterCloseString
        internal string FilterCloseString
        {
            get { return (LocalizedString(ref _FilterCloseString)); }
        }
        #endregion
        #region FilterCustomString
        internal string FilterCustomString
        {
            get { return (LocalizedString(ref _FilterCustomString)); }
        }
        #endregion
        #region FilterOkString
        internal string FilterOkString
        {
            get { return (LocalizedString(ref _FilterOkString)); }
        }
        #endregion
        #region FilterShowAllString
        internal string FilterShowAllString
        {
            get { return (LocalizedString(ref _FilterShowAllString)); }
        }
        #endregion
        #region FilterShowNotNullString
        internal string FilterShowNotNullString
        {
            get { return (LocalizedString(ref _FilterShowNotNullString)); }
        }
        #endregion
        #region FilterShowNullString
        internal string FilterShowNullString
        {
            get { return (LocalizedString(ref _FilterShowNullString)); }
        }
        #endregion
        #region GroupByWaterMarkText
        internal string GroupByWaterMarkText
        {
            get { return (LocalizedString(ref _GroupByWaterMarkText)); }
        }
        #endregion
        #region HasDataErrorHandler
        internal bool HasDataErrorHandler
        {
            get { return (DataError != null); }
        }
        #endregion
        #region HasItemDragHandler
        internal bool HasItemDragHandler
        {
            get { return (ItemDrag != null); }
        }
        #endregion
        #region HScrollBarHeight
        internal int HScrollBarHeight
        {
            get
            {
                if (_HScrollBar != null)
                    return (_HScrollBar.Height);
                return (SystemInformation.HorizontalScrollBarHeight);
            }
        }
        #endregion
        #region SViewRect
        internal Rectangle SViewRect
        {
            get
            {
                Rectangle r = ViewRect;
                if (PrimaryGrid.ShowRowHeaders == true)
                {
                    r.X += _PrimaryGrid.RowHeaderWidthEx;
                    r.Width -= _PrimaryGrid.RowHeaderWidthEx;
                    if (r.Width < 0)
                        r.Width = 0;
                }
                return (r);
            }
        }
        #endregion
        #region IndiceesUpdateCount
        internal ushort IndiceesUpdateCount
        {
            get { return (_IndiceesUpdateCount); }
        }
        #endregion
        #region IsDesignerHosted
        internal bool IsDesignerHosted
        {
            get { return (DesignMode); }
        }
        #endregion
        #region IsHScrollBarVisible
        internal bool IsHScrollBarVisible
        {
            get { return (_HScrollBar != null && _HScrollBar.Visible); }
        }
        #endregion
        #region IsVScrollBarVisible
        internal bool IsVScrollBarVisible
        {
            get { return (_VScrollBar != null && _VScrollBar.Visible); }
        }
        #endregion
        #region LastActiveCell
        internal GridCell LastActiveCell
        {
            get { return (_LastActiveCell); }
            set { _LastActiveCell = value; }
        }
        #endregion
        #region NeedMergeLayout
        private bool _NeedMergeLayout;
        internal bool NeedMergeLayout
        {
            get { return (_NeedMergeLayout); }
            set { _NeedMergeLayout = value; }
        }
        #endregion
        #region NeedToUpdateIndicees
        internal bool NeedToUpdateIndicees
        {
            get { return (_NeedToUpdateIndicees); }
            set
            {
                _NeedToUpdateIndicees = value;
                if (value == true)
                    _IndiceesUpdateCount++;
            }
        }
        #endregion
        #region ScrollBarScrolling
        internal bool ScrollBarScrolling
        {
            get { return (_ScrollBarScrolling); }
            set { _ScrollBarScrolling = value; }
        }
        #endregion
        #region SetGridCursor
        internal bool SetGridCursor
        {
            get { return (_SetGridCursor); }
            set { _SetGridCursor = value; }
        }
        #endregion
        #region StyleMouseOverUpdateCount
        internal ushort StyleMouseOverUpdateCount
        {
            get { return (_StyleMouseOverUpdateCount); }
            set { _StyleMouseOverUpdateCount = value; }
        }
        #endregion
        #region StyleSelectedUpdateCount
        internal ushort StyleSelectedUpdateCount
        {
            get { return (_StyleSelectedUpdateCount); }
            set { _StyleSelectedUpdateCount = value; }
        }
        #endregion
        #region StyleSelectedMouseOverUpdateCount
        internal ushort StyleSelectedMouseOverUpdateCount
        {
            get { return (_StyleSelectedMouseOverUpdateCount); }
            set { _StyleSelectedMouseOverUpdateCount = value; }
        }
        #endregion
        #region StyleUpdateCount
        internal ushort StyleUpdateCount
        {
            get { return (_StyleUpdateCount); }
            set { _StyleUpdateCount = value; }
        }
        #endregion
        #region ToolTip
        /// 
        /// Gets the Tooltip object used for the grid.
        /// 
        public System.Windows.Forms.ToolTip ToolTip
        {
            get
            {
                if (_ToolTip == null)
                    _ToolTip = new System.Windows.Forms.ToolTip();
                return (_ToolTip);
            }
        }
        #endregion
        #region ToolTipText
        internal string ToolTipText
        {
            get { return (_ToolTipText); }
            set
            {
                if (_ToolTipText != value)
                {
                    _ToolTipText = value;
                    if (string.IsNullOrEmpty(value) == false && value.Length > _MaxToolTipLength)
                        ToolTip.SetToolTip(this, value.Substring(0, _MaxToolTipLength));
                    else
                        ToolTip.SetToolTip(this, value);
                    ToolTip.Active =
                        (string.IsNullOrEmpty(value) == false);
                }
            }
        }
        #endregion
        #region PrimaryGridSize
        internal Size PrimaryGridSize
        {
            get
            {
                Size size = _PrimaryGrid.SizeNeeded;
                int n = (_VScrollOffset > 0) ?
                    _PrimaryGrid.FixedRowHeight : _PrimaryGrid.FixedHeaderHeight;
                size.Height -= (n + 1);
                if (_PrimaryGrid.Footer != null && _PrimaryGrid.Footer.Visible == true)
                    size.Height -= _PrimaryGrid.Footer.Size.Height;
                if (PrimaryGrid.ShowRowHeaders == true)
                    size.Width -= _PrimaryGrid.RowHeaderWidthEx;
                if (size.Width < 0)
                    size.Width = 0;
                if (size.Height < 0)
                    size.Height = 0;
                return (size);
            }
        }
        #endregion
        #region ViewRect
        internal Rectangle ViewRect
        {
            get
            {
                if (_ViewRect.IsEmpty == true)
                    _ViewRect = GetAdjustedBounds(ClientRectangle);
                return (_ViewRect);
            }
            set
            {
                _BoundsUpdateCount++;
                _ViewRect = value;
                _CViewRect = value;
            }
        }
        #endregion
        #region GetAdjustedBounds
        private Rectangle GetAdjustedBounds(Rectangle r)
        {
            int n = (_VScrollOffset > 0) ?
                _PrimaryGrid.FixedRowHeight : _PrimaryGrid.FixedHeaderHeight;
            r.Y += n;
            r.Height -= (n + 1);
            if (_PrimaryGrid.Footer != null && _PrimaryGrid.Footer.Visible == true)
                r.Height -= _PrimaryGrid.Footer.Size.Height;
            if (_VScrollBar != null && _VScrollBar.Visible == true)
                r.Width -= (VScrollBarWidth + 1);
            if (_HScrollBar != null && _HScrollBar.Visible == true)
                r.Height -= (HScrollBarHeight + 1);
            if (r.Width < 0)
                r.Width = 0;
            if (r.Height < 0)
                r.Height = 0;
            return (r);
        }
        #endregion
        #region ViewRectEx
        internal Rectangle ViewRectEx
        {
            get
            {
                Rectangle r = ViewRect;
                int n = (_VScrollOffset > 0) ?
                   _PrimaryGrid.FixedRowHeight - _PrimaryGrid.FixedHeaderHeight : 0;
                r.Y -= n;
                r.Height += n;
                return (r);
            }
        }
        #endregion
        #region VScrollBarWidth
        internal int VScrollBarWidth
        {
            get
            {
                if (_VScrollBar != null)
                    return (_VScrollBar.Width);
                return (SystemInformation.VerticalScrollBarWidth);
            }
        }
        #endregion
        #region DefaultSize
        /// 
        /// DefaultSize
        /// 
        protected override Size DefaultSize
        {
            get { return new Size(200, 200); }
        }
        #endregion
        #endregion
        #region OnPaint
        #region OnPaint
        /// 
        /// Renders the control.
        /// 
        /// Paint arguments.
        protected override void OnPaint(PaintEventArgs e)
        {
            if (IsUpdateSuspended == false)
            {
                SmoothingMode sm = e.Graphics.SmoothingMode;
                TextRenderingHint th = e.Graphics.TextRenderingHint;
                base.OnPaintBackground(e);
                if (_PrimaryGrid.IsLayoutValid == false)
                    ArrangeGrid(e.Graphics);
                GridRenderInfo renderInfo = GetGridRenderInfo(e);
                PaintControl(renderInfo);
                e.Graphics.SmoothingMode = sm;
                e.Graphics.TextRenderingHint = th;
                base.OnPaint(e);
#if !TRIAL
                if (NativeFunctions.keyValidated2 != 266)
                {
                    TextDrawing.DrawString(e.Graphics, "Invalid License", Font,
                                           Color.FromArgb(180, Color.Red), ClientRectangle,
                                           eTextFormat.Bottom | eTextFormat.HorizontalCenter);
                }
#else
                RenderWaterMark(renderInfo);
#endif
            }
        }
        #endregion
        #region PaintControl
        private void PaintControl(GridRenderInfo renderInfo)
        {
            Rectangle r = ClientRectangle;
            r.Intersect(renderInfo.ClipRectangle);
            if (r.Width > 0 && r.Height > 0)
                _PrimaryGrid.Render(renderInfo);
            RenderScrollBoxArea(renderInfo);
            NeedMergeLayout = false;
        }
        #endregion
        #region RenderScrollBoxArea
        private void RenderScrollBoxArea(GridRenderInfo renderInfo)
        {
            if (_HScrollBar.Visible && _VScrollBar.Visible)
            {
                Rectangle r = _HScrollBar.Bounds;
                r.X = _VScrollBar.Bounds.X;
                r.Width = _VScrollBar.Bounds.Width;
                if (r.IntersectsWith(renderInfo.ClipRectangle))
                {
                    Graphics g = renderInfo.Graphics;
                    SmoothingMode sm = g.SmoothingMode;
                    g.SmoothingMode = SmoothingMode.None;
                    g.FillRectangle(SystemBrushes.Control, r);
                    g.SmoothingMode = sm;
                }
            }
        }
        #endregion
        #region RenderWaterMark
        private void RenderWaterMark(GridRenderInfo renderInfo)
        {
            Rectangle r = ViewRect;
            r.X = r.Right - 30;
            r.Width = 30;
            if (r.IntersectsWith(renderInfo.ClipRectangle) == true)
            {
                Graphics g = renderInfo.Graphics;
                using (StringFormat sf = new StringFormat())
                {
                    sf.Alignment = StringAlignment.Center;
                    sf.LineAlignment = StringAlignment.Center;
                    sf.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.DirectionVertical;
                    using (Font font = new Font("Times New Roman", 9))
                    {
                        Rectangle t = r;
                        t.X++;
                        t.Y++;
                        using (SolidBrush brush = new SolidBrush(Color.FromArgb(128, Color.Gray)))
                        {
                            g.DrawString("DevComponents SuperGrid Trial",
                                         font, brush, t, sf);
                        }
                        using (SolidBrush brush = new SolidBrush(Color.FromArgb(128, Color.Gainsboro)))
                        {
                            g.DrawString("DevComponents SuperGrid Trial",
                                         font, brush, r, sf);
                        }
                    }
                }
            }
        }
        #endregion
        #endregion
        #region ArrangeGrid
        /// 
        /// OnHandleCreated
        /// 
        /// 
        protected override void OnHandleCreated(EventArgs e)
        {
            ArrangeGrid();
            base.OnHandleCreated(e);
        }
        /// 
        /// Performs grid layout.
        /// 
        public void ArrangeGrid()
        {
            ArrangeGrid(false);
        }
        /// 
        /// Performs grid layout.
        /// 
        ///Whether to force operation even if layout is valid.
        public void ArrangeGrid(bool force)
        {
            if (force == true || _PrimaryGrid.IsLayoutValid == false)
            {
                if (_InArrangeGrid == false)
                {
                    _InArrangeGrid = true;
                    try
                    {
                        using (Graphics g = CreateGraphics())
                            ArrangeGrid(g);
                    }
                    finally
                    {
                        _InArrangeGrid = false;
                    }
                }
            }
        }
        private void ArrangeGrid(Graphics g)
        {
            ArrangeLayoutCount++;
            DisplayedMergeLayoutCount++;
            GridLayoutInfo layoutInfo = GetGridLayoutInfo(g);
            GridLayoutStateInfo stateInfo = new GridLayoutStateInfo(_PrimaryGrid, 0);
            Size constraintSize = Size.Empty;
            _PrimaryGrid.Measure(layoutInfo, stateInfo, constraintSize);
            stateInfo.PassCount++;
            CanScrollEx = true;
            NeedToUpdateIndicees = false;
            if (HorizontalIsOver(layoutInfo) == true && _HScrollBarVisible)
            {
                if(_HScrollBarVisible)
                    layoutInfo.ClientBounds.Height -= HScrollBarHeight;
                if (VerticalIsOver(layoutInfo) == true && _VScrollBarVisible)
                    layoutInfo.ClientBounds.Width -= VScrollBarWidth;
                _PrimaryGrid.Measure(layoutInfo, stateInfo, constraintSize);
            }
            else
            {
                if (VerticalIsOver(layoutInfo) == true && _VScrollBarVisible)
                {
                    layoutInfo.ClientBounds.Width -= VScrollBarWidth;
                    _PrimaryGrid.Measure(layoutInfo, stateInfo, constraintSize);
                    if (HorizontalIsOver(layoutInfo) == true && _HScrollBarVisible)
                        layoutInfo.ClientBounds.Height -= HScrollBarHeight;
                }
            }
            layoutInfo.ClientBounds.Width = Math.Max(0, layoutInfo.ClientBounds.Width);
            layoutInfo.ClientBounds.Height = Math.Max(0, layoutInfo.ClientBounds.Height);
            EnableVScrollBar(layoutInfo);
            EnableHScrollBar(layoutInfo);
            ViewRect = Rectangle.Empty;
            _PrimaryGrid.Arrange(layoutInfo, stateInfo, layoutInfo.ClientBounds);
            ViewRect = Rectangle.Empty;
            UpdateScrollBars(layoutInfo);
            if (_ActiveEditor != null)
                EditorCell.PositionEditPanel(_ActiveEditor);
            if (NonModalEditorCell != null)
                NonModalEditorCell.PositionEditPanel(_ActiveNonModalEditor);
            if (ActiveFilterPanel != null)
                _ActiveFilterPanel.PositionEditPanel();
        }
        #region GetGridLayoutInfo
        private GridLayoutInfo GetGridLayoutInfo(Graphics g)
        {
            GridLayoutInfo layoutInfo = new GridLayoutInfo(g, GetGridItemBounds());
            layoutInfo.RightToLeft = (RightToLeft == RightToLeft.No);
            layoutInfo.DefaultVisualStyles = _DefaultVisualStyles; 
            return (layoutInfo);
        }
        #endregion
        #region GetGridItemBounds
        private Rectangle GetGridItemBounds()
        {
            return (ClientRectangle);
        }
        #endregion
        #region GetGridRenderInfo
        private GridRenderInfo GetGridRenderInfo(PaintEventArgs e)
        {
            GridRenderInfo renderInfo =
                new GridRenderInfo(e.Graphics, Rectangle.Ceiling(e.ClipRectangle));
            renderInfo.RightToLeft = (RightToLeft == RightToLeft.Yes);
            return (renderInfo);
        }
        #endregion
        #endregion
        #region Scrollbar support
        #region UpdateScrollBars
        private void UpdateScrollBars(GridLayoutInfo layoutInfo)
        {
            if (_HScrollBarEnabled == true)
            {
                _HScrollBar.SmallChange = layoutInfo.ClientBounds.Width / 20;
                _HScrollBar.Maximum = Math.Max(0, PrimaryGridSize.Width);
                _HScrollBar.LargeChange = Math.Min(SViewRect.Width, _HScrollBar.Maximum);
                if (_HScrollBar.Value + _HScrollBar.LargeChange > _HScrollBar.Maximum)
                {
                    _HScrollBar.Value = _HScrollBar.Maximum - _HScrollBar.LargeChange;
                    _HScrollOffset = _HScrollBar.Value;
                }
                _HScrollBar.Refresh();
            }
            if (_VScrollBarEnabled == true)
            {
                _VScrollBar.SmallChange = layoutInfo.ClientBounds.Height / 20;
                _VScrollBar.Maximum = Math.Max(0, PrimaryGridSize.Height);
                _VScrollBar.LargeChange = Math.Min(SViewRect.Height, _VScrollBar.Maximum);
                if (_VScrollBar.Value + _VScrollBar.LargeChange > _VScrollBar.Maximum)
                {
                    _VScrollBar.Value = _VScrollBar.Maximum - _VScrollBar.LargeChange;
                    _VScrollOffset = _VScrollBar.Value;
                }
                _VScrollBar.Refresh();
            }
        }
        #endregion
        #region EnableHScrollBar
        private void EnableHScrollBar(GridLayoutInfo layoutInfo)
        {
            bool enable = _HScrollBarVisible && (_PrimaryGrid.Size.Width > layoutInfo.ClientBounds.Width);
            if (enable == true)
            {
                _HScrollBar.Location = new
                    Point(layoutInfo.ClientBounds.Left + 1,
                    layoutInfo.ClientBounds.Bottom - 1);
                int n = layoutInfo.ClientBounds.Width - 2;
                if (_VScrollBar.Visible == true)
                    n++;
                _HScrollBar.Width = n;
            }
            else
            {
                _HScrollBar.Value = 0;
                _HScrollOffset = 0;
            }
            _HScrollBarEnabled = enable;
            _HScrollBar.Enabled = enable;
            _HScrollBar.Visible = enable;
        }
        #endregion
        #region EnableVScrollBar
        private void EnableVScrollBar(GridLayoutInfo layoutInfo)
        {
            bool enable = _VScrollBarVisible && (_PrimaryGrid.Size.Height > layoutInfo.ClientBounds.Height);
            if (enable == true)
            {
                _VScrollBar.Location = new
                    Point(layoutInfo.ClientBounds.Right - 1,
                    layoutInfo.ClientBounds.Top + 1);
                int n = layoutInfo.ClientBounds.Height - 2;
                if (_HScrollBarVisible && (_PrimaryGrid.Size.Width > layoutInfo.ClientBounds.Width))
                    n++;
                _VScrollBar.Height = n;
            }
            else
            {
                _VScrollBar.Value = 0;
                _VScrollOffset = 0;
            }
            _VScrollBarEnabled = enable;
            _VScrollBar.Enabled = enable;
            _VScrollBar.Visible = enable;
        }
        #endregion
        #region HScrollBarScroll
        private void HScrollBarScroll(object sender, ScrollEventArgs e)
        {
            ScrollBarAdv sbar =
                sender as ScrollBarAdv;
            if (sbar != null)
            {
                if (_HScrollOffset != e.NewValue)
                {
                    int oldValue = _HScrollOffset;
                    _HScrollOffset = e.NewValue;
                    PostHScrollUpdateEx(oldValue, _HScrollOffset);
                    DoScrollEvent(_PrimaryGrid, e, sbar);
                }
            }
        }
        #endregion
        #region VScrollBarScroll
        private void VScrollBarScroll(object sender, ScrollEventArgs e)
        {
            ScrollBarAdv sbar =
                sender as ScrollBarAdv;
            if (sbar != null)
            {
                if (_VScrollOffset != e.NewValue)
                {
                    int oldValue = _VScrollOffset;
                    _VScrollOffset = e.NewValue;
                    PostVScrollUpdateEx(oldValue, _VScrollOffset);
                    DoScrollEvent(_PrimaryGrid, e, sbar);
                }
            }
        }
        #endregion
        #region HorizontalIsOver
        private bool HorizontalIsOver(GridLayoutInfo layoutInfo)
        {
            return (_PrimaryGrid.Size.Width > layoutInfo.ClientBounds.Width);
        }
        #endregion
        #region VerticalIsOver
        private bool VerticalIsOver(GridLayoutInfo layoutInfo)
        {
            return (_PrimaryGrid.Size.Height > layoutInfo.ClientBounds.Height);
        }
        #endregion
        #region SetupScrollBars
        private void SetupScrollBars()
        {
            if (_VScrollBar == null)
            {
                _VScrollBar = new VScrollBarAdv();
                _VScrollBar.Width = Dpi.DescaleWidth(SystemInformation.VerticalScrollBarWidth);
                _VScrollBar.Scroll += VScrollBarScroll;
                _VScrollBar.MouseEnter += ScrollBarMouseEnter;
                _VScrollBar.SizeChanged += ScrollBarSizeChanged;
                _VScrollBar.MouseDown += ScrollBar_MouseDown;
                _VScrollBar.MouseUp += ScrollBar_MouseUp;
                _VScrollBar.Visible = false;
                Controls.Add(_VScrollBar);
            }
            if (_HScrollBar == null)
            {
                _HScrollBar = new HScrollBarAdv();
                _HScrollBar.Height = Dpi.DescaleHeight(SystemInformation.HorizontalScrollBarHeight);
                _HScrollBar.Scroll += HScrollBarScroll;
                _HScrollBar.MouseEnter += ScrollBarMouseEnter;
                _HScrollBar.SizeChanged += ScrollBarSizeChanged;
                _HScrollBar.MouseDown += ScrollBar_MouseDown;
                _HScrollBar.MouseUp += ScrollBar_MouseUp;
                _HScrollBar.Visible = false;
                Controls.Add(_HScrollBar);
            }
        }
        void ScrollBar_MouseUp(object sender, MouseEventArgs e)
        {
            ScrollBarScrolling = false;
        }
        void ScrollBar_MouseDown(object sender, MouseEventArgs e)
        {
            ScrollBarScrolling = true;
        }
        private void ScrollBarSizeChanged(object sender, EventArgs e)
        {
            _PrimaryGrid.InvalidateLayout();
        }
        void ScrollBarMouseEnter(object sender, EventArgs e)
        {
            SetGridCursor = true;
            Cursor = Cursors.Default;
            SetGridCursor = false;
        }
        #endregion
        #region SetVScrollValue
        internal void SetVScrollValue(int value)
        {
            if (_VScrollBar.Visible == true)
            {
                int oldValue = _VScrollBar.Value;
                value = Math.Max(value, 0);
                value = Math.Min(value, _VScrollBar.Maximum);
                if (value + _VScrollBar.LargeChange - 1 > _VScrollBar.Maximum)
                    value = _VScrollBar.Maximum - _VScrollBar.LargeChange + 1;
                value = Math.Max(value, 0);
                if (_VScrollBar.Value != value)
                {
                    _VScrollBar.Value = value;
                    _VScrollOffset = value;
                    PostVScrollUpdateEx(oldValue, value);
                    if (Scroll != null || ScrollMin != null || ScrollMax != null)
                    {
                        ScrollEventArgs e = new ScrollEventArgs(ScrollEventType.EndScroll,
                            oldValue, value, ScrollOrientation.VerticalScroll);
                        DoScrollEvent(_PrimaryGrid, e, _VScrollBar);
                    }
                }
            }
        }
        #endregion
        #region SetHScrollValue
        internal void SetHScrollValue(int value)
        {
            if (_HScrollBar.Visible == true)
            {
                int oldValue = _HScrollBar.Value;
                value = Math.Max(value, 0);
                value = Math.Min(value, _HScrollBar.Maximum);
                if (value + _HScrollBar.LargeChange > _HScrollBar.Maximum)
                    value = _HScrollBar.Maximum - _HScrollBar.LargeChange;
                value = Math.Max(value, 0);
                if (_HScrollBar.Value != value)
                {
                    _HScrollBar.Value = value;
                    _HScrollOffset = value;
                    PostHScrollUpdateEx(oldValue, value);
                    if (Scroll != null || ScrollMin != null || ScrollMax != null)
                    {
                        ScrollEventArgs e = new ScrollEventArgs(ScrollEventType.EndScroll,
                            oldValue, value, ScrollOrientation.HorizontalScroll);
                        DoScrollEvent(_PrimaryGrid, e, _HScrollBar);
                    }
                }
            }
        }
        #endregion
        #region PostScrollUpdate
        private void PostScrollUpdate()
        {
            ViewRect = Rectangle.Empty;
            _PrimaryGrid.InvalidateRender();
            PostScrollRefresh();
        }
        #endregion
        #region PostVScrollUpdateEx
        private void PostVScrollUpdateEx(int oldValue, int newValue)
        {
            if (CanVScrollWindowEx())
            {
                int dv = oldValue - newValue;
                ViewRect = Rectangle.Empty;
                Rectangle vr = ViewRect;
                RECT scroll = new RECT(0, vr.Top, vr.Right, vr.Bottom);
                RECT update = new RECT();
                ScrollWindowEx(
                    Handle,
                    0,
                    dv,
                    ref scroll,
                    ref scroll,
                    IntPtr.Zero,
                    ref update,
                    0);
                Rectangle r = new Rectangle(update.X, update.Y, update.Width, update.Height);
                r.Inflate(0, 4);
                Invalidate(r);
                PostScrollRefresh();
            }
            else
            {
                PostScrollUpdate();
            }
        }
        #region CanVScrollWindowEx
        private bool CanVScrollWindowEx()
        {
            if (IsUpdateSuspended == true ||
                (EnableFastScrolling == false || CanScrollEx == false))
            {
                return (false);
            }
            return (_PrimaryGrid.FrozenRowCount == 0);
        }
        #endregion
        #endregion
        #region PostHScrollUpdateEx
        private void PostHScrollUpdateEx(int oldValue, int newValue)
        {
            if (CanHScrollWindowEx() == true)
            {
                int dh = oldValue - newValue;
                ViewRect = Rectangle.Empty;
                Rectangle vr = ViewRect;
                int n = vr.Y - _PrimaryGrid.ColumnHeader.Bounds.Y;
                vr.Y -= n;
                vr.Height += n;
                if (_PrimaryGrid.ShowRowHeaders == true)
                {
                    vr.X += _PrimaryGrid.RowHeaderWidthEx;
                    vr.Width -= _PrimaryGrid.RowHeaderWidthEx;
                }
                else
                {
                    vr.X++;
                    vr.Width--;
                }
                RECT scroll = new RECT(vr.Left, vr.Top, vr.Right - 1, vr.Bottom);
                RECT update = new RECT();
                ScrollWindowEx(
                    Handle,
                    dh,
                    0,
                    ref scroll,
                    ref scroll,
                    IntPtr.Zero,
                    ref update,
                    0);
                Rectangle r = new Rectangle(update.X, update.Y, update.Width, update.Height);
                r.Inflate(4, 0);
                Invalidate(r);
                PostScrollRefresh();
            }
            else
            {
                PostScrollUpdate();
            }
        }
        #region CanHScrollWindowEx
        private bool CanHScrollWindowEx()
        {
            if (IsUpdateSuspended == true || EnableFastScrolling == false)
                return (false);
            if (_PrimaryGrid.EnableCellMerging == true || _PrimaryGrid.IsGrouped == true)
                return (false);
            if (_PrimaryGrid.Header.Visible == true && _PrimaryGrid.Header.Size.Height > 0)
                return (false);
            if (_PrimaryGrid.IsGrouped == true)
                return (false);
            return (_PrimaryGrid.FrozenColumnCount == 0);
        }
        #endregion
        #endregion
        #region PostScrollRefresh
        private void PostScrollRefresh()
        {
            if (_EditorCell != null)
                _EditorCell.PositionEditPanel(_ActiveEditor);
            if (_ActiveFilterPanel != null)
                _ActiveFilterPanel.PositionEditPanel();
            if (_ActiveNonModalEditor != null)
                DeactivateNonModalEditor();
            PostInternalMouseMove();
            DisplayedMergeLayoutCount++;
        }
        #endregion
        #endregion
        #region InvalidateRender
        /// 
        /// Invalidates render of the grid element.
        /// 
        /// Element to invalidate rendering for.
        internal void InvalidateRender(GridElement gridElement)
        {
            Rectangle bounds = gridElement.BoundsRelative;
            if (gridElement.Parent != null)
            {
                if (gridElement is GridColumn == false || ((GridColumn)gridElement).IsHFrozen == false)  
                    bounds.X -= _HScrollOffset;
                if (bounds.Y > _PrimaryGrid.FixedRowHeight)
                    bounds.Y -= _VScrollOffset;
            }
            Invalidate(bounds, true);
        }
        internal void InvalidateRender(Rectangle bounds)
        {
            Invalidate(bounds, InvokeRequired == false);
        }
        #endregion
        #region Mouse Support
        #region OnMouseLeave
        /// 
        /// OnMouseLeave
        /// 
        /// 
        protected override void OnMouseLeave(EventArgs e)
        {
            _PrimaryGrid.InternalMouseLeave(e);
            base.OnMouseLeave(e);
        }
        #endregion
        #region OnMouseMove
        /// 
        /// OnMouseMove
        /// 
        /// 
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (CanProcessMouseMove())
            {
                if (CapturedItem != null)
                    CapturedItem.InternalMouseMove(e);
                else
                    _PrimaryGrid.InternalMouseMove(e);
                base.OnMouseMove(e);
                base.Cursor = _GridCursor;
                if (_PrimaryGrid.IsDesignerHosted == true)
                    Cursor = Cursors.Arrow;
            }
        }
        private bool CanProcessMouseMove()
        {
            return (Keyboard.IsKeyDown(Keys.Up) == false && Keyboard.IsKeyDown(Keys.Down) == false &&
                Keyboard.IsKeyDown(Keys.Left) == false && Keyboard.IsKeyDown(Keys.Right) == false);
        }
        #endregion
        #region OnMouseDown
        /// 
        /// OnMouseDown
        /// 
        /// 
        protected override void OnMouseDown(MouseEventArgs e)
        {
            Focus();
            base.OnMouseDown(e);
            _PrimaryGrid.InternalMouseDown(e);
        }
        #endregion
        #region OnMouseUp
        /// 
        /// OnMouseUp
        /// 
        /// 
        protected override void OnMouseUp(MouseEventArgs e)
        {
            DisableAutoScrolling();
            if (CapturedItem != null)
                CapturedItem.InternalMouseUp(e);
            else
                _PrimaryGrid.InternalMouseUp(e);
            
            base.OnMouseUp(e);
            if (_ActiveEditor != null)
                _ActiveEditor.EditorCell.FocusEditor(_ActiveEditor);
        }
        #endregion
        #region OnMouseClick
        /// 
        /// OnMouseClick
        /// 
        /// 
        protected override void OnMouseClick(MouseEventArgs e)
        {
            _PrimaryGrid.InternalMouseClick(e);
            base.OnMouseClick(e);
        }
        #endregion
        #region OnMouseDoubleClick
        /// 
        /// OnMouseDoubleClick
        /// 
        /// 
        protected override void OnMouseDoubleClick(MouseEventArgs e)
        {
            _PrimaryGrid.InternalMouseDoubleClick(e);
            base.OnMouseDoubleClick(e);
        }
        #endregion
        #region OnMousewheel
        protected override void OnMouseWheel(MouseEventArgs e)
        {
            if (CanProcessMouseWheel() == true)
                MouseWheelHandler(e.Delta / SystemInformation.MouseWheelScrollDelta);
            base.OnMouseWheel(e);
        }
        private void MouseWheelHandler(int delta)
        {
            int value = -(delta * SystemInformation.MouseWheelScrollLines);
            value *= _VScrollBar.SmallChange;
            value += _VScrollBar.Value;
            SetVScrollValue(value);
            Cursor.Position = Cursor.Position;
        }
        #endregion
        #endregion
        #region Keyboard support
        #region IsInputChar
        /// 
        /// IsInputChar
        /// 
        /// 
        /// 
        protected override bool IsInputChar(char charCode)
        {
            if (char.IsLetterOrDigit(charCode))
                return (true);
            return (base.IsInputChar(charCode));
        }
        #endregion
        #region OnKeyDown
        /// 
        /// Handles KeyDown events
        /// 
        /// 
        protected override void OnKeyDown(KeyEventArgs e)
        {
            base.OnKeyDown(e);
            if (e.Handled == false)
            {
                if (e.Handled == true ||
                    ProcessInCellKeyDown(e.KeyData) == true)
                {
                    e.SuppressKeyPress = true;
                }
            }
        }
        #endregion
        #region OnKeyPress
        /// 
        /// Handles KeyPress events
        /// 
        /// 
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            GridCell cell = GetCellToEdit();
            if (cell != null)
            {
                if (cell.CellEditMode == CellEditMode.Modal)
                {
                    switch (cell.GridPanel.KeyboardEditMode)
                    {
                        case KeyboardEditMode.EditOnKeystroke:
                        case KeyboardEditMode.EditOnKeystrokeOrF2:
                            if (cell.CanSetActiveCell(cell.GridPanel) == true)
                            {
                                if (cell.BeginEdit(true) != null)
                                {
                                    Keys modifiers = ModifierKeys;
                                    bool shift = ((modifiers & Keys.Shift) == Keys.Shift) ^
                                                 (Console.CapsLock == true);
                                    if (shift == true)
                                        modifiers |= Keys.Shift;
                                    else
                                        modifiers &= ~Keys.Shift;
                                    Keys keyData = _LastKeyDown | modifiers;
                                    if (_ActiveEditor.WantsInputKey(keyData, false) == true)
                                        PressKeyDown((ushort)(keyData));
                                }
                            }
                            break;
                    }
                }
                else
                {
                    cell.PostCellKeyDown(_LastKeyDown);
                }
            }
            base.OnKeyPress(e);
        }
        #endregion
        #region ProcessInCellKeyDown
        private bool ProcessInCellKeyDown(Keys keyData)
        {
            if (ProcessGridKeyDown(keyData) == false)
            {
                if (keyData == Keys.F2)
                {
                    GridCell cell = GetCellToEdit();
                    if (cell != null)
                    {
                        if (cell.CellEditMode == CellEditMode.Modal)
                        {
                            switch (cell.GridPanel.KeyboardEditMode)
                            {
                                case KeyboardEditMode.EditOnF2:
                                case KeyboardEditMode.EditOnKeystrokeOrF2:
                                    if (cell.IsEmptyCell == false)
                                    {
                                        if (cell.CanSetActiveCell(cell.GridPanel) == true)
                                        {
                                            cell.BeginEdit(false);
                                            return (true);
                                        }
                                    }
                                    break;
                            }
                        }
                    }
                }
                return (false);
            }
            return (true);
        }
        #endregion 
        #region PressKeyDown
        ///
        /// Sends the given input scanCode to the
        /// current active edit control
        ///
        ///
        public void PressKeyDown(ushort scanCode)
        {
            _KeyPressSent = true;
            if (Marshal.SizeOf(new IntPtr()) == 8)
                SendInput64(scanCode);
            else
                SendInput32(scanCode);
        }
        private void SendInput32(ushort scanCode)
        {
            Input32[] inputs = new Input32[1];
            inputs[0].type = InputKeyboard;
            inputs[0].ki = new KeyBoardInput(scanCode);
            SendInput(1, inputs, Marshal.SizeOf(inputs[0]));
        }
        private void SendInput64(ushort scanCode)
        {
            Input64[] inputs = new Input64[1];
            inputs[0].type = InputKeyboard;
            inputs[0].ki = new KeyboardInput64(scanCode);
            SendInput(1, inputs, Marshal.SizeOf(inputs[0]));
        }
        #endregion
        #region GetCellToEdit
        private GridCell GetCellToEdit()
        {
            GridPanel panel = _ActiveGrid;
            if (panel != null && panel.SuperGrid.Focused == true)
            {
                if (panel.ReadOnly == true)
                    return (null);
                if (panel.SelectionGranularity != SelectionGranularity.Cell)
                {
                    GridRow row = panel.ActiveRow as GridRow;
                    if (row != null)
                    {
                        if (panel.PrimaryColumn != null &&
                            panel.PrimaryColumn.Visible == true)
                        {
                            if (row.Cells.Count > panel.PrimaryColumnIndex)
                                return (row.Cells[panel.PrimaryColumnIndex]);
                        }
                        return (row.FirstVisibleCell);
                    }
                }
                else
                {
                    GridCell cell = ActiveElement as GridCell;
                    if (cell != null)
                    {
                        if (cell.AllowSelection == true)
                            return (cell);
                    }
                }
            }
            return (null);
        }
        #endregion
        #region SuperGridControlPreviewKeyDown
        void SuperGridControlPreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            DoPreviewKeyDown(e.KeyData);
            if (e.KeyData == Keys.Tab ||
                e.KeyData == (Keys.Tab | Keys.Shift))
            {
                if (_TabSelection != TabSelection.Control)
                    e.IsInputKey = true;
            }
            else
            {
                if (GridWantsKey(e.KeyData) == true)
                    e.IsInputKey = true;
            }
        }
        #endregion
        #endregion
        #region ProcessInFilterEditKeyDown
        private bool ProcessInFilterEditKeyDown(Keys keyData)
        {
            bool wantsKey = GridWantsKey(keyData);
            wantsKey = ActiveFilterPanel.WantsInputKey(keyData, wantsKey);
            if (wantsKey == false)
                return (ProcessFilterEditKeyDown(keyData));
            return (false);
        }
        #endregion
        #region ProcessInEditKeyDown
        private bool ProcessInEditKeyDown(Keys keyData)
        {
            bool wantsKey = GridWantsKey(keyData);
            wantsKey = _ActiveEditor.WantsInputKey(keyData, wantsKey);
            if (wantsKey == false)
                ProcessInEditGridKeyDown(keyData);
            return (wantsKey == false);
        }
        #endregion
        #region ProcessInEditGridKeyDown
        private void ProcessInEditGridKeyDown(Keys keyData)
        {
            switch (keyData)
            {
                case Keys.Escape:
                    _EditorCell.CancelEdit();
                    break;
                case Keys.Enter:
                    if (_EditorCell.EndEdit() == true)
                        ProcessGridKeyDown(keyData);
                    break;
                default:
                    if (GridWantsKey(keyData) == true)
                    {
                        if (_EditorCell.EndEdit() == true)
                            ProcessGridKeyDown(keyData);
                    }
                    break;
            }
        }
        #endregion
        #region ProcessGridKeyDown
        #region ProcessGridKeyDown
        private bool ProcessGridKeyDown(Keys keyData)
        {
            if (ActiveElement == null)
            {
                switch (_PrimaryGrid.SelectionGranularity)
                {
                    case SelectionGranularity.Cell:
                        SetFirstAvailableCell(_PrimaryGrid, false);
                        break;
                    default:
                        SetFirstAvailableRow(_PrimaryGrid, false);
                        break;
                }
                switch (keyData)
                {
                    case Keys.Tab | Keys.Control:
                        Parent.SelectNextControl(this, true, true, true, true);
                        return (true);
                    case Keys.Tab | Keys.Shift | Keys.Control:
                        Parent.SelectNextControl(this, false, true, true, true);
                        return (true);
                    case Keys.Insert:
                        if (_PrimaryGrid != null)
                        {
                            if (_PrimaryGrid.Rows.Count == 0)
                            {
                                if (_PrimaryGrid.DataBinder.CanInsertRow == true)
                                {
                                    _PrimaryGrid.InsertRow(0);
                                    return (true);
                                }
                            }
                        }
                        break;
                }
                return (false);
            }
            if (ActiveElement.GridPanel == null)
                return (false);
            bool processed = true;
            if (keyData == Keys.Escape)
                CancelCapture();
            bool ms = ActiveElement.GridPanel.MultiSelect;
            switch (keyData)
            {
                case Keys.NumLock:
                    break;
                case Keys.Down:
                    ProcessDownKey(true, false);
                    break;
                case Keys.Down | Keys.Control:
                    ProcessDownKey(false, false);
                    break;
                case Keys.Down | Keys.Shift:
                case Keys.Down | Keys.Shift | Keys.Control:
                    ProcessDownKey(true, ms);
                    break;
                case Keys.End:
                    ProcessEndKey(false);
                    break;
                case Keys.End | Keys.Shift:
                    ProcessEndKey(ms);
                    break;
                case Keys.End | Keys.Control:
                    ProcessCtrlEndKey(false);
                    break;
                case Keys.End | Keys.Control | Keys.Shift:
                    ProcessCtrlEndKey(ms);
                    break;
                case Keys.Enter:
                    ProcessEnterKey(true, false);
                    break;
                case Keys.Enter | Keys.Shift:
                case Keys.Enter | Keys.Control:
                case Keys.Enter | Keys.Shift | Keys.Control:
                    ProcessShiftEnterKey();
                    break;
                case Keys.Escape:
                    if (ProcessEscapeKey() == false)
                    {
                        Form form = FindForm();
                        if (form != null && form.CancelButton != null)
                            form.CancelButton.PerformClick();
                    }
                    break;
                case Keys.Home:
                    ProcessHomeKey(false);
                    break;
                case Keys.Home | Keys.Shift:
                    ProcessHomeKey(ms);
                    break;
                case Keys.Home | Keys.Control:
                    ProcessCtrlHomeKey(false);
                    break;
                case Keys.Home | Keys.Control | Keys.Shift:
                    ProcessCtrlHomeKey(ms);
                    break;
                case Keys.Left:
                    ProcessLeftKey(true, false);
                    break;
                case Keys.Left | Keys.Shift:
                case Keys.Left | Keys.Shift | Keys.Control:
                    ProcessLeftKey(true, ms);
                    break;
                case Keys.Left | Keys.Control:
                    ProcessLeftKey(false, false);
                    break;
                case Keys.PageUp:
                    ProcessPageUpKey(false);
                    break;
                case Keys.PageUp | Keys.Shift:
                case Keys.PageUp | Keys.Shift | Keys.Control:
                    ProcessPageUpKey(ms);
                    break;
                case Keys.PageDown:
                    ProcessPageDownKey(false);
                    break;
                case Keys.PageDown | Keys.Shift:
                case Keys.PageDown | Keys.Shift | Keys.Control:
                    ProcessPageDownKey(ms);
                    break;
                case Keys.Tab:
                    processed = ProcessTabKey();
                    break;
                case Keys.Tab | Keys.Shift:
                    processed = ProcessShiftTabKey();
                    break;
                case Keys.Tab | Keys.Control:
                    Parent.SelectNextControl(this, true, true, true, true);
                    break;
                case Keys.Tab | Keys.Shift | Keys.Control:
                    Parent.SelectNextControl(this, false, true, true, true);
                    break;
                case Keys.Right:
                    ProcessRightKey(true, false);
                    break;
                case Keys.Right | Keys.Shift:
                case Keys.Right | Keys.Shift | Keys.Control:
                    ProcessRightKey(true, ms);
                    break;
                case Keys.Right | Keys.Control:
                    ProcessRightKey(false, false);
                    break;
                case Keys.Space:
                    if (ActiveElement is GridContainer)
                    {
                        GridContainer item = (GridContainer)ActiveElement;
                        item.Expanded = !item.Expanded;
                    }
                    else
                    {
                        processed = false;
                        if (ActiveElement is GridCell)
                        {
                            GridCell cell = (GridCell)ActiveElement;
                            if (cell.Merged && cell.MergeSuspended == false)
                            {
                                cell.SuspendMerge(false);
                                processed = true;
                            }
                        }
                    }
                    break;
                case Keys.Space | Keys.Shift:
                    ProcessShiftSpaceKey(ms);
                    break;
                case Keys.Space | Keys.Control:
                    ProcessCtrlSpaceKey(ms);
                    break;
                case Keys.Up:
                    ProcessUpKey(true, false);
                    break;
                case Keys.Up | Keys.Shift:
                case Keys.Up | Keys.Shift | Keys.Control:
                    ProcessUpKey(true, ms);
                    break;
                case Keys.Up | Keys.Control:
                    ProcessUpKey(false, false);
                    break;
                case Keys.Delete:
                    ProcessDeleteKey();
                    break;
                case Keys.Delete | Keys.Shift:
                    ProcessShiftDeleteKey();
                    break;
                case Keys.Insert:
                    ProcessInsertKey();
                    break;
                case Keys.Insert | Keys.Shift:
                    ProcessShiftInsertKey();
                    break;
                default:
                    processed = false;
                    break;
            }
            return (processed);
        }
        #endregion
        #region ProcessEscapeKey
        private bool ProcessEscapeKey()
        {
            if (ActiveElement is GridCell)
            {
                GridCell cell = (GridCell)ActiveElement;
                if (cell.MergeSuspended == true)
                {
                    cell.ResumeMerge(null);
                    return (true);
                }
            }
            GridRow row = ActiveRow as GridRow;
            if (row != null)
            {
                GridPanel panel = row.GridPanel;
                if (row.IsInsertRow == false &&
                    row.IsTempInsertRow == true)
                {
                    row.RowNeedsStored = false;
                    if (panel.VirtualMode == true)
                    {
                        panel.VirtualRowCountEx--;
                        panel.VirtualRows.MaxRowIndex = row.RowIndex - 1;
                        panel.LatentActiveRowIndex = row.RowIndex;
                        panel.LatentActiveContainer = panel;
                        panel.VirtualTempInsertRow = null;
                        panel.InvalidateLayout();
                        row.Dispose();
                    }
                    else
                    {
                        panel.LatentActiveRowIndex = row.RowIndex;
                        panel.LatentActiveContainer = panel;
                        panel.Rows.Remove(row);
                        _LastProcessedItem = null;
                    }
                    ActiveRow = null;
                    panel.ActiveRow = null;
                    return (true);
                }
            }
            return (false);
        }
        #endregion
        #region ProcessPageUpKey
        private void ProcessPageUpKey(bool extend)
        {
            try
            {
                BeginUpdate();
                if (ActiveElement is GridCell)
                    ProcessCellPageUpKey(extend);
                else if (ActiveElement is GridContainer)
                    ProcessRowPageUpKey(extend);
            }
            finally
            {
                EndUpdate();
            }
        }
        #region ProcessCellPageUpKey
        private void ProcessCellPageUpKey(bool extend)
        {
            GridCell cell = (GridCell)ActiveElement;
            GridPanel panel = cell.GridPanel;
            GridContainer lrow = cell.GridRow;
            GridContainer container = panel.FirstOnScreenRow;
            if (lrow == container)
            {
                lrow.ScrollToBottom();
                container = panel.FirstOnScreenRow;
            }
            while (container != null)
            {
                GridRow row = container as GridRow;
                if (row != null)
                {
                    GridCell ecell = row.GetCell(cell.ColumnIndex,
                        panel.AllowEmptyCellSelection);
                    if (ecell != null)
                    {
                        if (ecell.AllowSelection == true)
                        {
                            KeySelectCell(panel, ecell, true, extend);
                            break;
                        }
                    }
                }
                container = container.PrevVisibleRow;
            }
        }
        #endregion
        #region ProcessRowPageUpKey
        private void ProcessRowPageUpKey(bool extend)
        {
            GridContainer lrow = (GridContainer)ActiveElement;
            GridPanel panel = lrow.GridPanel;
            GridContainer row = panel.FirstOnScreenRow;
            if (lrow != row)
            {
                KeySelectRow(panel, row, true, extend);
            }
            else
            {
                lrow.ScrollToBottom();
                KeySelectRow(panel, panel.FirstOnScreenRow, true, extend);
            }
        }
        #endregion
        #endregion
        #region ProcessPageDownKey
        private void ProcessPageDownKey(bool extend)
        {
            try
            {
                BeginUpdate();
                if (ActiveElement is GridCell)
                    ProcessCellPageDownKey(extend);
                else if (ActiveElement is GridContainer)
                    ProcessRowPageDownKey(extend);
            }
            finally
            {
                EndUpdate();
            }
        }
        #region ProcessCellPageDownKey
        private void ProcessCellPageDownKey(bool extend)
        {
            GridCell cell = (GridCell)ActiveElement;
            GridPanel panel = cell.GridPanel;
            GridContainer lrow = cell.GridRow;
            GridContainer container = panel.LastOnScreenRow;
            if (lrow.GridIndex == container.GridIndex)
            {
                lrow.ScrollToTop();
                container = panel.LastOnScreenRow;
            }
            while (container != null)
            {
                GridRow row = container as GridRow;
                if (row != null)
                {
                    GridCell ecell = row.GetCell(cell.ColumnIndex,
                        panel.AllowEmptyCellSelection);
                    if (ecell != null)
                    {
                        if (ecell.AllowSelection == true)
                        {
                            KeySelectCell(panel, ecell, true, extend);
                            break;
                        }
                    }
                }
                container = container.NextVisibleRow;
            }
        }
        #endregion
        #region ProcessRowPageDownKey
        private void ProcessRowPageDownKey(bool extend)
        {
            GridContainer lrow = (GridContainer)ActiveElement;
            GridPanel panel = lrow.GridPanel;
            GridContainer row = panel.LastOnScreenRow;
            if (lrow != row)
            {
                KeySelectRow(panel, row, true, extend);
            }
            else
            {
                lrow.ScrollToTop();
                row = panel.LastOnScreenRow;
                KeySelectRow(panel, row, true, extend);
            }
        }
        #endregion
        #endregion
        #region ProcessEnterKey
        private void ProcessEnterKey(bool select, bool extend)
        {
            if (ActiveElement is GridCell)
            {
                GridCell cell = (GridCell) ActiveElement;
                GridPanel panel = cell.GridPanel;
                if (cell.GridRow.IsInsertRow == true)
                {
                    cell.BeginEdit(false);
                    cell.EditorDirty = true;
                    cell.EndEdit();
                }
                else
                {
                    if (panel.EnterKeySelectsNextRow == true)
                        ProcessCellDownKey(select, extend);
                    else
                        cell.EndEdit();
                }
            }
            else if (ActiveElement is GridContainer)
            {
                GridContainer row = (GridContainer)ActiveElement;
                GridPanel panel = row.GridPanel;
                if (panel.EnterKeySelectsNextRow == true)
                    ProcessRowDownKey(select, extend);
            }
        }
        #endregion
        #region ProcessShiftEnterKey
        private void ProcessShiftEnterKey()
        {
            if (ActiveElement is GridCell)
                ProcessCellShiftEnterKey();
            else if (ActiveElement is GridContainer)
                ProcessRowShiftEnterKey();
        }
        #region ProcessCellShiftEnterKey
        private void ProcessCellShiftEnterKey()
        {
            GridCell cell = (GridCell)ActiveElement;
            KeySelectRow(cell.GridPanel, cell.GridRow, true, false);
        }
        #endregion
        #region ProcessRowShiftEnterKey
        private void ProcessRowShiftEnterKey()
        {
            if (ActiveElement is GridRow)
            {
                GridRow row = (GridRow)ActiveElement;
                GridPanel panel = row.GridPanel;
                GridColumn column = panel.Columns.FirstVisibleColumn;
                if (column != null)
                    KeySelectCell(panel, row[column.ColumnIndex], true, false);
            }
        }
        #endregion
        #endregion
        #region ProcessCtrlSpaceKey
        private void ProcessCtrlSpaceKey(bool extend)
        {
            if (ActiveElement is GridCell)
                ProcessCellCtrlSpaceKey(extend);
            else if (ActiveElement is GridContainer)
                ProcessRowCtrlSpaceKey(extend);
        }
        #region ProcessCellCtrlSpaceKey
        private void ProcessCellCtrlSpaceKey(bool extend)
        {
            GridCell cell = (GridCell) ActiveElement;
            if (extend == true)
                KeyCtrlSelectCell(cell);
            else
                KeySelectCell(cell.GridPanel, cell, true, false);
        }
        #endregion
        #region ProcessRowCtrlSpaceKey
        private void ProcessRowCtrlSpaceKey(bool extend)
        {
            GridContainer row = (GridContainer)ActiveElement;
            if (extend == true)
                KeyCtrlSelectRow(row);
            else
                KeySelectRow(row.GridPanel, row, true, false);
        }
        #endregion
        #endregion
        #region ProcessShiftSpaceKey
        private void ProcessShiftSpaceKey(bool extend)
        {
            if (ActiveElement is GridCell)
                ProcessCellShiftSpaceKey(extend);
            else if (ActiveElement is GridContainer)
                ProcessRowShiftSpaceKey(extend);
        }
        #region ProcessCellShiftSpaceKey
        private void ProcessCellShiftSpaceKey(bool extend)
        {
            GridCell cell = (GridCell)ActiveElement;
            GridPanel panel = cell.GridPanel;
            KeySelectCell(panel, cell, true, extend);
        }
        #endregion
        #region ProcessRowShiftSpaceKey
        private void ProcessRowShiftSpaceKey(bool extend)
        {
            GridContainer lrow = (GridContainer)ActiveElement;
            GridPanel panel = (lrow is GridPanel) ? lrow.GetParentPanel() : lrow.GridPanel;
            KeySelectRow(panel, lrow, true, extend);
        }
        #endregion
        #endregion
        #region ProcessUpKey
        private void ProcessUpKey(bool select, bool extend)
        {
            if (ActiveElement is GridCell)
                ProcessCellUpKey(select, extend);
            else if (ActiveElement is GridContainer)
                ProcessRowUpKey(select, extend);
        }
        #region ProcessCellUpKey
        private void ProcessCellUpKey(bool select, bool extend)
        {
            GridCell cell = (GridCell)ActiveElement;
            GridPanel panel = cell.GridPanel;
            _LastCellIndex = cell.ColumnIndex;
            GridContainer prow = GetPrevRow(cell.GridRow);
            if (panel.GroupHeaderKeyBehavior == GroupHeaderKeyBehavior.Select)
            {
                if (prow is GridGroup)
                {
                    KeySelectRow(panel, (GridGroup)cell.GridRow.Parent, select, extend);
                    return;
                }
            }
            GridCell pcell = GetPrevRowCell(prow, cell.ColumnIndex);
            if (KeySelectCell(panel, pcell, select, extend) == false)
            {
                if (VScrollOffset > 0)
                {
                    VScrollOffset -= _VScrollBar.SmallChange;
                }
                else
                {
                    if (select == false && panel.Filter.Visible == true &&
                        cell.GridColumn.IsFilteringEnabled == true)
                    {
                        panel.Filter.ActivateFilterEdit(cell.GridColumn);
                    }
                }
            }
        }
        #region GetPrevRowCell
        private GridCell GetPrevRowCell(GridContainer item, int index)
        {
            while (item != null)
            {
                GridRow row = item as GridRow;
                if (row != null)
                {
                    if (item.AllowSelection == true)
                    {
                        GridCell cell = row.GetCell(index,
                            row.GridPanel.AllowEmptyCellSelection);
                        if (cell != null)
                        {
                            if (cell.AllowSelection == true)
                                return (cell);
                        }
                    }
                }
                item = item.PrevVisibleRow;
            }
            return (null);
        }
        #endregion
        #endregion
        #region ProcessRowUpKey
        private void ProcessRowUpKey(bool select, bool extend)
        {
            GridContainer lrow = (GridContainer)ActiveElement;
            GridPanel panel = (lrow is GridPanel) ? lrow.GetParentPanel() : lrow.GridPanel;
            GridContainer row = GetPrevRow(lrow);
            if (lrow is GridGroup)
            {
                if (_LastCellIndex >= 0 && (row is GridGroup == false))
                {
                    GridCell cell = GetPrevRowCell(row, _LastCellIndex);
                    KeySelectCell(panel, cell, select, extend);
                    return;
                }
            }
            else
            {
                _LastCellIndex = -1;
            }
            if (KeySelectRow(panel, row, select, extend) == false)
            {
                if (VScrollOffset > 0)
                {
                    VScrollOffset -= _VScrollBar.SmallChange;
                }
                else
                {
                    if (select == false && panel.Filter.Visible == true)
                    {
                        GridColumn column = panel.Columns.FirstVisibleColumn;
                        while (column != null)
                        {
                            if (column.IsFilteringEnabled == true)
                            {
                                ActivateFilterPanel(column);
                                break;
                            }
                            column = column.NextVisibleColumn;
                        }
                    }
                }
            }
        }
        #endregion
        #region GetPrevRow
        private GridContainer GetPrevRow(GridContainer lrow)
        {
            GridContainer row = lrow.PrevVisibleRow;
            while (row != null)
            {
                if (row.AllowSelection == true)
                    return (row);
                row = row.PrevVisibleRow;
            }
            return (null);
        }
        #endregion
        #endregion
        #region ProcessDownKey
        private void ProcessDownKey(bool select, bool extend)
        {
            if (ActiveElement is GridCell)
                ProcessCellDownKey(select, extend);
            else if (ActiveElement is GridContainer)
                ProcessRowDownKey(select, extend);
        }
        #region ProcessCellDownKey
        private void ProcessCellDownKey(bool select, bool extend)
        {
            GridCell cell = (GridCell) ActiveElement;
            GridPanel panel = cell.GridPanel;
            _LastCellIndex = cell.ColumnIndex;
            GridContainer nrow = GetNextRow(cell.GridRow);
            if (panel.GroupHeaderKeyBehavior == GroupHeaderKeyBehavior.Select)
            {
                if (nrow is GridGroup)
                {
                    if (KeySelectRow(panel, nrow, select, extend) == false)
                        VScrollOffset += _VScrollBar.SmallChange;
                    return;
                }
            }
            GridCell ncell = GetNextRowCell(nrow, _LastCellIndex);
            if (KeySelectCell(panel, ncell, select, extend) == false)
            {
                if (nrow == null)
                    VScrollOffset += _VScrollBar.SmallChange;
            }
        }
        #region GetNextRowCell
        private GridCell GetNextRowCell(GridContainer item, int index)
        {
            while (item != null)
            {
                GridRow row = item as GridRow;
                if (row != null)
                {
                    if (row.AllowSelection == true)
                    {
                        GridCell cell = row.GetCell(index,
                            row.GridPanel.AllowEmptyCellSelection);
                        if (cell != null)
                        {
                            if (cell.AllowSelection == true)
                                return (cell);
                        }
                    }
                }
                item = item.NextVisibleRow;
            }
            return (null);
        }
        #endregion
        #endregion
        #region ProcessRowDownKey
        private void ProcessRowDownKey(bool select, bool extend)
        {
            GridContainer lrow = (GridContainer)ActiveElement;
            GridPanel panel = (lrow is GridPanel) ? lrow.GetParentPanel() : lrow.GridPanel;
            GridContainer row = GetNextRow(lrow);
            if (lrow is GridGroup)
            {
                if (_LastCellIndex >= 0 && (row is GridGroup == false))
                {
                    GridCell cell = GetNextRowCell(row, _LastCellIndex);
                    KeySelectCell(panel, cell, select, extend);
                    return;
                }
            }
            else
            {
                _LastCellIndex = -1;
            }
            if (KeySelectRow(panel, row, select, extend) == false)
                VScrollOffset += _VScrollBar.SmallChange;
        }
        #endregion
        #region GetNextRow
        private GridContainer GetNextRow(GridContainer lrow)
        {
            GridContainer row = lrow.NextVisibleRow;
            while (row != null)
            {
                if (row.AllowSelection == true)
                    return (row);
                row = row.NextVisibleRow;
            }
            return (null);
        }
        #endregion
        #endregion
        #region ProcessLeftKey
        private bool ProcessLeftKey(bool select, bool extend)
        {
            if (ActiveElement is GridCell)
                return (ProcessCellLeftKey(select, extend));
            if (ActiveElement is GridContainer)
                ProcessRowLeftKey();
            return (true);
        }
        #region ProcessCellLeftKey
        private bool ProcessCellLeftKey(bool select, bool extend)
        {
            GridCell lcell = (GridCell) ActiveElement;
            GridPanel panel = lcell.GridPanel;
            if ((ModifierKeys & (Keys.Shift | Keys.Control)) == (Keys.Shift | Keys.Control))
            {
                KeySelectRow(panel, lcell.GridRow, true, false);
                return (true);
            }
            
            GridCell cell = lcell.GetPreviousCell(true, !extend);
            bool selected = KeySelectCell(panel, cell, select, extend);
            if (selected == false)
                HScrollOffset -= _HScrollBar.SmallChange;
            return (selected);
        }
        #endregion
        #region ProcessRowLeftKey
        private void ProcessRowLeftKey()
        {
            GridContainer lrow = (GridContainer)ActiveElement;
            if (lrow.Expanded == true)
            {
                lrow.Expanded = false;
            }
            else
            {
                GridContainer crow = lrow.Parent as GridContainer;
                if (crow != null && crow.Parent != null)
                {
                    ActiveElement = crow;
                    crow.GridPanel.ClearAll(true);
                    crow.IsSelected = true;
                    crow.EnsureVisible();
                }
                else
                {
                    GridRow row = lrow as GridRow;
                    if (row != null)
                    {
                        if (lrow.GridPanel.SelectionGranularity == SelectionGranularity.Cell)
                        {
                            GridCell cell = row.LastSelectableCell;
                            if (cell != null)
                                KeySelectCell(row.GridPanel, cell, true, false);
                        }
                        else
                        {
                            HScrollOffset -= _HScrollBar.SmallChange;
                        }
                    }
                }
            }
        }
        #endregion
        #endregion
        #region ProcessRightKey
        private bool ProcessRightKey(bool select, bool extend)
        {
            if (ActiveElement is GridCell)
                return (ProcessCellRightKey(select, extend));
            if (ActiveElement is GridContainer)
                ProcessRowRightKey();
            return (true);
        }
        #region ProcessCellRightKey
        private bool ProcessCellRightKey(bool select, bool extend)
        {
            GridCell lcell = (GridCell) ActiveElement;
            GridPanel panel = lcell.GridPanel;
            GridCell cell = lcell.GetNextCell(true, !extend);
            bool selected = KeySelectCell(panel, cell, select, extend);
            
            if (selected == false)
                HScrollOffset += _HScrollBar.SmallChange;
            return (selected);
        }
        #endregion
        #region ProcessRowRightKey
        private void ProcessRowRightKey()
        {
            GridContainer lrow = (GridContainer)ActiveElement;
            if (lrow is GridPanel)
            {
                GridPanel panel = (GridPanel)lrow;
                GridRow row = panel.GetRowFromIndex(0) as GridRow;
                if (row != null)
                {
                    ActiveElement = row;
                    lrow.GetParentPanel().ClearAll(true);
                    lrow.GridPanel.ClearAll(true);
                    row.IsSelected = true;
                    row.EnsureVisible();
                }
            }
            else
            {
                if (lrow.Rows.Count > 0 || lrow.RowsUnresolved == true)
                {
                    if (lrow.Expanded == false)
                        lrow.Expanded = true;
                }
                else
                {
                    GridRow row = lrow as GridRow;
                    if (row != null)
                    {
                        if (lrow.GridPanel.SelectionGranularity == SelectionGranularity.Cell)
                        {
                            GridCell cell = row.FirstSelectableCell;
                            if (cell != null)
                                KeySelectCell(row.GridPanel, cell, true, false);
                        }
                        else
                        {
                            HScrollOffset += _HScrollBar.SmallChange;
                        }
                    }
                }
            }
        }
        #endregion
        #endregion
        #region ProcessTabKey
        private bool ProcessTabKey()
        {
            if (_TabSelection == TabSelection.Control)
                return (false);
            if (ActiveElement is GridCell)
            {
                GridCell lcell = (GridCell)ActiveElement;
                GridPanel panel = lcell.GridPanel;
                GridCell cell =
                    lcell.GetNextCell(true, _TabSelection == TabSelection.Cell);
                KeySelectCell(panel, cell, true, false);
                return (true);
            }
            GridRow row = ActiveElement as GridRow;
            if (row != null)
            {
                if (row.GridPanel.SelectionGranularity != SelectionGranularity.Cell)
                {
                    GridCell cell = row.FirstOnScreenCell;
                    if (cell != null)
                    {
                        GridCell cellNext = cell.GetNextCell(false, false);
                        if (cellNext != null)
                        {
                            int n = 0;
                            GridColumn col = row.GridPanel.Columns.FirstVisibleColumn;
                            while (col != null && col.ColumnIndex != cellNext.ColumnIndex)
                            {
                                n += col.Bounds.Width;
                                col = col.NextVisibleColumn;
                            }
                            HScrollOffset = n;
                        }
                    }
                    return (true);
                }
            }
            return (ProcessRightKey(true, false));
        }
        #endregion
        #region ProcessShiftTabKey
        private bool ProcessShiftTabKey()
        {
            if (_TabSelection == TabSelection.Control)
                return (false);
            if (ActiveElement is GridCell)
            {
                GridCell lcell = (GridCell)ActiveElement;
                GridPanel panel = lcell.GridPanel;
                GridCell cell =
                    lcell.GetPreviousCell(true, _TabSelection == TabSelection.Cell);
                return (KeySelectCell(panel, cell, true, false));
            }
            GridRow row = ActiveElement as GridRow;
            if (row != null)
            {
                if (row.GridPanel.SelectionGranularity != SelectionGranularity.Cell)
                {
                    if (_HScrollOffset > 0)
                    {
                        GridCell cell = row.FirstOnScreenCell;
                        if (cell != null)
                        {
                            Rectangle t = row.GridPanel.ViewRect;
                            Rectangle r = cell.Bounds;
                            GridCell fcell = row.LastFrozenCell;
                            if (fcell != null)
                                t.X = fcell.Bounds.Right;
                            if (r.Left >= t.Left)
                                cell = cell.GetPreviousCell(false, false);
                            if (cell != null)
                                cell.EnsureVisible();
                            return (true);
                        }
                    }
                }
            }
            return (ProcessLeftKey(true, false));
        }
        #endregion
        #region ProcessHomeKey
        private void ProcessHomeKey(bool extend)
        {
            if (ActiveElement is GridCell)
            {
                GridCell lcell = (GridCell)ActiveElement;
                GridPanel panel = lcell.GridPanel;
                GridCell cell = lcell.GridRow.FirstSelectableCell;
                if (cell != lcell)
                    KeySelectCell(panel, cell, true, extend);
            }
            else if (ActiveElement is GridContainer)
            {
                GridPanel panel = ActiveElement.GridPanel;
                KeySelectRow(panel, panel.FirstSelectableRow, true, extend);
            }
        }
        #endregion
        #region ProcessCtrlHomeKey
        private void ProcessCtrlHomeKey(bool extend)
        {
            if (ActiveElement is GridCell)
            {
                GridCell cell = (GridCell)ActiveElement;
                GridPanel panel = cell.GridPanel;
                SetFirstAvailableCell(panel, extend);
            }
            else if (ActiveElement is GridRow)
            {
                KeySelectRow(_PrimaryGrid, _PrimaryGrid.FirstSelectableRow, true, extend);
            }
        }
        #endregion
        #region ProcessEndKey
        private void ProcessEndKey(bool extend)
        {
            if (ActiveElement is GridCell)
            {
                GridCell lcell = (GridCell)ActiveElement;
                GridPanel panel = lcell.GridPanel;
                GridCell cell = lcell.GridRow.LastSelectableCell;
                if (cell != lcell)
                    KeySelectCell(panel, cell, true, extend);
            }
            else if (ActiveElement is GridContainer)
            {
                GridPanel panel = ActiveElement.GridPanel;
                GridContainer row = panel.LastSelectableRow;
                if (row != null)
                    KeySelectRow(panel, row, true, extend);
            }
        }
        #endregion
        #region ProcessCtrlEndKey
        private void ProcessCtrlEndKey(bool extend)
        {
            if (ActiveElement is GridCell)
            {
                GridCell cell = (GridCell)ActiveElement;
                GridPanel panel = cell.GridPanel;
                SetLastAvailableCell(panel, extend);
            }
            else if (ActiveElement is GridRow)
            {
                KeySelectRow(_PrimaryGrid, _PrimaryGrid.LastVisibleRow, true, extend);
            }
        }
        #endregion
        #region SetFirstAvailableRow
        private void SetFirstAvailableRow(GridPanel panel, bool extend)
        {
            GridContainer container = panel.FirstVisibleRow;
            
            while (container != null)
            {
                GridRow row = container as GridRow;
                if (row != null)
                {
                    if (row.AllowSelection == true)
                    {
                        KeySelectRow(panel, row, true, extend);
                        break;
                    }
                }
                container = container.NextVisibleRow;
            }
        }
        #endregion
        #region SetFirstAvailableCell
        private void SetFirstAvailableCell(GridPanel panel, bool extend)
        {
            GridColumn column = panel.Columns.FirstVisibleColumn;
            GridContainer container = panel.FirstVisibleRow;
            if (column != null)
            {
                while (container != null)
                {
                    GridRow row = container as GridRow;
                    if (row != null)
                    {
                        if (row.AllowSelection == true)
                        {
                            GridCell cell = row.GetCell(column.ColumnIndex,
                                panel.AllowEmptyCellSelection);
                            if (cell != null)
                            {
                                if (cell.AllowSelection == false)
                                    cell = cell.GetNextCell(true);
                                KeySelectCell(panel, cell, true, extend);
                            }
                            break;
                        }
                    }
                    container = container.NextVisibleRow;
                }
            }
        }
        #endregion
        #region SetLastAvailableCell
        private void SetLastAvailableCell(GridPanel panel, bool extend)
        {
            GridColumn column = panel.Columns.LastVisibleColumn;
            GridContainer container = panel.LastVisibleRow;
            while (container != null)
            {
                GridRow row = container as GridRow;
                if (row != null)
                {
                    if (row.AllowSelection == true)
                    {
                        GridCell cell = row.GetCell(column.ColumnIndex,
                            panel.AllowEmptyCellSelection);
                        if (cell != null)
                        {
                            if (cell.AllowSelection == false)
                                cell = cell.GetPreviousCell(true);
                            KeySelectCell(panel, cell, true, extend);
                        }
                        break;
                    }
                }
                container = container.PrevVisibleRow;
            }
        }
        #endregion
        #region KeySelectCell
        internal bool KeySelectCell(
            GridPanel panel, GridCell cell, bool select, bool extend)
        {
            if (cell != null)
            {
                int rowIndex = cell.GridRow.RowIndex;
                if (cell.CanSetActiveCell(panel) == true)
                {
                    if (select == true && extend == false)
                    {
                        panel.SelectionRowAnchor = cell.GridRow;
                        panel.SelectionColumnAnchor = cell.GridColumn;
                    }
                    if (select == true)
                    {
                        if (rowIndex != cell.GridRow.RowIndex)
                            ArrangeGrid();
                        cell.ExtendSelection(panel, cell, extend);
                        if (cell.CellEditMode == CellEditMode.Modal)
                        {
                            if (panel.KeyboardEditMode == KeyboardEditMode.EditOnEntry)
                                cell.BeginEdit(true);
                        }
                    }
                    else
                    {
                        if (ActiveElement != null)
                            ActiveElement.InvalidateRender();
                        cell.InvalidateRender();
                    }
                    panel.LastProcessedItem = cell;
                    cell.EnsureVisible();
                    return (true);
                }
            }
            return (false);
        }
        #endregion
        #region KeyCtrlSelectCell
        private void KeyCtrlSelectCell(GridCell cell)
        {
            if (cell != null)
            {
                ActiveElement = cell;
                cell.IsSelected = !cell.IsSelected;
                cell.EnsureVisible();
            }
        }
        #endregion
        #region KeySelectRow
        internal bool KeySelectRow(GridPanel panel,
            GridContainer row, bool select, bool extend)
        {
            if (row != null)
            {
                int rowIndex = row.RowIndex;
                if (row.CanSetActiveRow(false) == true)
                {
                    if (select == true && (extend == false || panel.SelectionRowAnchor == null))
                        panel.SelectionRowAnchor = row;
                    if (select == true)
                    {
                        if (rowIndex != row.RowIndex)
                            ArrangeGrid();
                        row.ExtendSelection(panel, row, extend);
                    }
                    else
                    {
                        if (ActiveElement != null)
                            ActiveElement.InvalidateRender();
                        row.InvalidateRender();
                    }
                    panel.SetActiveRow(row, true);
                    panel.LastProcessedItem = row;
                    row.EnsureVisible();
                }
                return (true);
            }
            return (false);
        }
        #endregion
        #region KeyCtrlSelectRow
        private void KeyCtrlSelectRow(GridContainer row)
        {
            if (row != null)
            {
                ActiveElement = row;
                row.IsSelected = !row.IsSelected;
                row.EnsureVisible();
            }
        }
        #endregion
        #region ProcessDeleteKey
        private void ProcessDeleteKey()
        {
            if (CanDeleteRows() == true)
            {
                SelectedElements selRows =
                    _ActiveGrid.InternalSelectedRows.Copy();
                if (selRows.Count > 0)
                {
                    if (_ActiveGrid.ShowInsertRow == true)
                    {
                        if (_ActiveGrid.VirtualMode == true)
                        {
                            selRows.RemoveItem(_ActiveGrid.VirtualRowCountEx - 1);
                        }
                        else
                        {
                            int n = _ActiveGrid.Rows.Count - 1;
                            GridRow row = _ActiveGrid.Rows[n] as GridRow;
                            if (row != null)
                            {
                                if (row.IsInsertRow == false)
                                    throw new Exception();
                                selRows.RemoveItem(row.GridIndex);
                            }
                        }
                    }
                }
                if (selRows.Count > 0)
                {
                    if (DoRowDeletingEvent(_ActiveGrid, selRows) == false)
                    {
                        if (selRows.Count > 0)
                            DeleteRows(_ActiveGrid, selRows);
                    }
                }
            }
            else
            {
                if (DoPlayingSoundEvent(null, null, PlaySoundContext.RowDeleteAttempt) == false)
                    SystemSounds.Beep.Play();
            }
        }
        #region CanDeleteRows
        private bool CanDeleteRows()
        {
            if (_ActiveGrid == null)
                return (false);
            return (_ActiveGrid.CanDeleteRow);
        }
        #endregion
        #region DeleteRows
        private void DeleteRows(GridPanel panel, SelectedElements selRows)
        {
            BeginUpdate();
            for (int i = selRows.Ranges.Count - 1; i >= 0; --i)
            {
                SelectedRange range = selRows.Ranges[i];
                if (panel.VirtualMode == true)
                {
                    panel.SetDeletedRows(range.StartIndex, range.Count, true);
                }
                else
                {
                    for (int j = range.EndIndex; j >= range.StartIndex; --j)
                    {
                        GridContainer row = panel.GetRowFromIndex(j);
                        if (row != null)
                            row.IsDeleted = true;
                    }
                }
            }
            EndUpdate();
            DoRowDeletedEvent(panel, selRows);
        }
        #endregion
        #endregion
        #region ProcessShiftDeleteKey
        private void ProcessShiftDeleteKey()
        {
            if (_ActiveGrid != null)
            {
                if (_ActiveGrid.AllowRowDelete == true)
                {
                    BeginUpdate();
                    SelectedElements selRows =
                        _ActiveGrid.InternalSelectedRows.Copy();
                    if (DoRowRestoringEvent(_ActiveGrid, selRows) == false)
                    {
                        if (selRows.Count > 0)
                            RestoreRows(_ActiveGrid, selRows);
                    }
                    EndUpdate();
                }
            }
            else
            {
                if (DoPlayingSoundEvent(null, null, PlaySoundContext.RowUnDeleteAttempt) == false)
                    SystemSounds.Beep.Play();
            }
        }
        #region RestoreRows
        private void RestoreRows(GridPanel panel, SelectedElements selRows)
        {
            for (int i = selRows.Ranges.Count - 1; i >= 0; --i)
            {
                SelectedRange range = selRows.Ranges[i];
                if (panel.VirtualMode == true)
                {
                    panel.SetDeletedRows(range.StartIndex, range.Count, false);
                }
                else
                {
                    for (int j = range.EndIndex; j >= range.StartIndex; --j)
                    {
                        GridContainer row = panel.GetRowFromIndex(j);
                        if (row != null)
                            row.IsDeleted = false;
                    }
                }
            }
            DoRowRestoredEvent(panel, selRows);
        }
        #endregion
        #endregion
        #region ProcessInsertKey
        private void ProcessInsertKey()
        {
            ProcessInsert(0);
        }
        #endregion
        #region ProcessShiftInsertKey
        private void ProcessShiftInsertKey()
        {
            ProcessInsert(1);
        }
        #endregion
        #region ProcessInsert
        private void ProcessInsert(int offset)
        {
            if (CanInsertRow() == true)
            {
                int index = ActiveRow.RowIndex + offset;
                if (index >= 0)
                    _ActiveGrid.InsertRow(index);
            }
            else
            {
                SystemSounds.Beep.Play();
            }
        }
        #region CanInsertRow
        private bool CanInsertRow()
        {
            if (_ActiveGrid == null ||
                _ActiveRow == null || _ActiveRow.IsDeleted == true)
            {
                return (false);
            }
            return (_ActiveGrid.CanInsertRow);
        }
        #endregion
        #endregion
        #endregion
        #region ProcessFilterEditKeyDown
        #region ProcessFilterEditKeyDown
        private bool ProcessFilterEditKeyDown(Keys keyData)
        {
            bool processed = true;
            switch (keyData)
            {
                case Keys.Enter:
                    ExitFilterEdit(false);
                    break;
                case Keys.Escape:
                    ExitFilterEdit(true);
                    break;
                case Keys.Right:
                    ProcessFilterKeyRight();
                    break;
                case Keys.Left:
                    ProcessFilterKeyLeft();
                    break;
                case Keys.Tab:
                    processed = ProcessFilterTabKey();
                    break;
                case Keys.Tab | Keys.Shift:
                    processed = ProcessFilterShiftTabKey();
                    break;
                case Keys.Down | Keys.Control:
                    ExitFilterEdit(false);
                    break;
                default:
                    processed = false;
                    break;
            }
            return (processed);
        }
        #region ProcessFilterKeyLeft
        private void ProcessFilterKeyLeft()
        {
            GridColumn column = ActiveFilterPanel.GridColumn.PrevVisibleColumn;
            while (column != null)
            {
                if (column.IsFilteringEnabled == true)
                {
                    ActivateFilterPanel(column);
                    break;
                }
                column = column.PrevVisibleColumn;
            }
        }
        #endregion
        #region ProcessFilterKeyRight
        private void ProcessFilterKeyRight()
        {
            GridColumn column = ActiveFilterPanel.GridColumn.NextVisibleColumn;
            while (column != null)
            {
                if (column.IsFilteringEnabled == true)
                {
                    ActivateFilterPanel(column);
                    break;
                }
                column = column.NextVisibleColumn;
            }
        }
        #endregion
        #region ActivateFilterPanel
        private void ActivateFilterPanel(GridColumn col)
        {
            if (col != null)
            {
                if (ActiveFilterPanel != null)
                    ActiveFilterPanel.EndEdit();
                FilterPanel fp = FilterPanel.GetFilterPanel(col);
                if (fp != null)
                    fp.BeginEdit();
            }
        }
        #endregion
        #region ExitFilterEdit
        private void ExitFilterEdit(bool cancel)
        {
            GridColumn column = ActiveFilterPanel.GridColumn;
            GridPanel panel = column.GridPanel;
            if (cancel == true)
                ActiveFilterPanel.CancelEdit();
            else
                ActiveFilterPanel.EndEdit();
            GridRow row = panel.FirstSelectableRow as GridRow;
            if (row != null)
            {
                if (_LastProcessedItem is GridContainer)
                {
                    row.SetActive();
                    row.IsSelected = true;
                }
                else if (_LastProcessedItem is GridCell)
                {
                    GridCell cell = GetNextRowCell(row, column.ColumnIndex);
                    if (cell != null)
                    {
                        cell.SetActive();
                        cell.IsSelected = true;
                    }
                }
            }
        }
        #endregion
        #endregion
        #region ProcessFilterTabKey
        private bool ProcessFilterTabKey()
        {
            if (_TabSelection == TabSelection.Control)
                return (false);
            ProcessFilterKeyRight();
            return (true);
        }
        #endregion
        #region ProcessFilterShiftTabKey
        private bool ProcessFilterShiftTabKey()
        {
            if (_TabSelection == TabSelection.Control)
                return (false);
            ProcessFilterKeyLeft();
            return (true);
        }
        #endregion
        #endregion
        #region GridWantsKey
        private bool GridWantsKey(Keys keyData)
        {
            switch (keyData)
            {
                case Keys.Escape:
                case Keys.Up | Keys.Shift:
                case Keys.Up:
                case Keys.Down:
                case Keys.Down | Keys.Shift:
                case Keys.Left:
                case Keys.Left | Keys.Shift:
                case Keys.Right:
                case Keys.Right | Keys.Shift:
                case Keys.Enter:
                case Keys.Tab:
                case Keys.Tab | Keys.Shift:
                    return (true);
            }
            return (false);
        }
        #endregion
        #region DoEvent support
        #region ActiveGridChangedEvent
        /// 
        /// Handles invocation of ActiveGridChanged events
        /// 
        internal void DoActiveGridChangedEvent(GridPanel oldPanel)
        {
            if (ActiveGridChanged != null)
            {
                GridActiveGridChangedEventArgs ev = new
                    GridActiveGridChangedEventArgs(oldPanel, _ActiveGrid);
                ActiveGridChanged(this, ev);
            }
        }
        #endregion
        #region CellActivatedEvent
        /// 
        /// Handles invocation of CellActivated events
        /// 
        internal void DoCellActivatedEvent(
            GridPanel gridPanel, GridCell oldCell, GridCell newCell)
        {
            if (CellActivated != null)
            {
                GridCellActivatedEventArgs ev = new
                    GridCellActivatedEventArgs(gridPanel, oldCell, newCell);
                CellActivated(this, ev);
            }
        }
        #endregion
        #region CellActivatingEvent
        /// 
        /// Handles invocation of CellActivating events
        /// 
        internal bool DoCellActivatingEvent(
            GridPanel gridPanel, GridCell oldCell, GridCell newCell)
        {
            if (CellActivating != null)
            {
                GridCellActivatingEventArgs ev = new
                    GridCellActivatingEventArgs(gridPanel, oldCell, newCell);
                CellActivating(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region CellClickEvent
        /// 
        /// Handles invocation of CellClick events
        /// 
        internal bool DoCellClickEvent(GridCell gridCell, MouseEventArgs e)
        {
            if (CellClick != null)
            {
                GridCellClickEventArgs ev = new
                    GridCellClickEventArgs(gridCell.GridPanel, gridCell, e);
                CellClick(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region CellDoubleClickEvent
        /// 
        /// Handles invocation of CellDoubleClick events
        /// 
        internal bool DoCellDoubleClickEvent(GridCell gridCell, MouseEventArgs e)
        {
            if (CellDoubleClick != null)
            {
                GridCellDoubleClickEventArgs ev = new
                    GridCellDoubleClickEventArgs(gridCell.GridPanel, gridCell, e);
                CellDoubleClick(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region CellInfoClickEvent
        /// 
        /// Handles invocation of CellInfoClick events
        /// 
        internal void DoCellInfoClickEvent(GridCell gridCell, MouseEventArgs e)
        {
            if (CellInfoClick != null)
            {
                GridCellClickEventArgs ev = new
                    GridCellClickEventArgs(gridCell.GridPanel, gridCell, e);
                CellInfoClick(this, ev);
            }
        }
        #endregion
        #region CellInfoDoubleClickEvent
        /// 
        /// Handles invocation of CellInfoDoubleClick events
        /// 
        internal void DoCellInfoDoubleClickEvent(GridCell gridCell, MouseEventArgs e)
        {
            if (CellInfoDoubleClick != null)
            {
                GridCellDoubleClickEventArgs ev = new
                    GridCellDoubleClickEventArgs(gridCell.GridPanel, gridCell, e);
                CellInfoDoubleClick(this, ev);
            }
        }
        #endregion
        #region CellInfoEnterEvent
        /// 
        /// Handles invocation of CellInfoEnter events
        /// 
        internal bool DoCellInfoEnterEvent(GridCell gridCell,
            Control control, System.Windows.Forms.ToolTip toolTip, Point pt)
        {
            if (CellInfoEnter != null)
            {
                GridCellInfoEnterEventArgs ev = new
                    GridCellInfoEnterEventArgs(gridCell.GridPanel, gridCell, control, toolTip, pt);
                CellInfoEnter(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region CellInfoLeaveEvent
        /// 
        /// Handles invocation of CellInfoLeave events
        /// 
        internal void DoCellInfoLeaveEvent(
            GridCell gridCell, Control control, System.Windows.Forms.ToolTip toolTip)
        {
            if (CellInfoLeave != null)
            {
                GridCellInfoLeaveEventArgs ev = new
                    GridCellInfoLeaveEventArgs(gridCell.GridPanel, gridCell, control, toolTip);
                CellInfoLeave(this, ev);
            }
        }
        #endregion
        #region CellMouseDownEvent
        /// 
        /// Handles invocation of CellMouseDown events
        /// 
        internal void DoCellMouseDownEvent(GridCell gridCell, MouseEventArgs args)
        {
            if (CellMouseDown != null)
            {
                GridCellMouseEventArgs ev = new
                    GridCellMouseEventArgs(gridCell.GridPanel, gridCell, args);
                CellMouseDown(this, ev);
            }
        }
        #endregion
        #region CellMouseEnterEvent
        /// 
        /// Handles invocation of CellMouseEnter events
        /// 
        internal void DoCellMouseEnterEvent(GridCell gridCell)
        {
            if (CellMouseEnter != null)
            {
                GridCellEventArgs ev = new
                    GridCellEventArgs(gridCell.GridPanel, gridCell);
                CellMouseEnter(this, ev);
            }
        }
        #endregion
        #region CellMouseLeaveEvent
        /// 
        /// Handles invocation of CellMouseLeave events
        /// 
        internal void DoCellMouseLeaveEvent(GridCell gridCell)
        {
            if (CellMouseLeave != null)
            {
                GridCellEventArgs ev = new
                    GridCellEventArgs(gridCell.GridPanel, gridCell);
                CellMouseLeave(this, ev);
            }
        }
        #endregion
        #region CellMouseMoveEvent
        /// 
        /// Handles invocation of CellMouseMove events
        /// 
        internal void DoCellMouseMoveEvent(GridCell gridCell, MouseEventArgs args)
        {
            if (CellMouseMove != null)
            {
                GridCellMouseEventArgs ev = new 
                    GridCellMouseEventArgs(gridCell.GridPanel, gridCell, args);
                CellMouseMove(this, ev);
            }
        }
        #endregion
        #region CellMouseUpEvent
        /// 
        /// Handles invocation of CellMouseUp events
        /// 
        internal void DoCellMouseUpEvent(GridCell gridCell, MouseEventArgs args)
        {
            if (CellMouseUp != null)
            {
                GridCellMouseEventArgs ev = new
                    GridCellMouseEventArgs(gridCell.GridPanel, gridCell, args);
                CellMouseUp(this, ev);
            }
        }
        #endregion
        #region CellUserFunctionEvent
        /// 
        /// Handles invocation of CellUserFunction events
        /// 
        internal void DoCellUserFunctionEvent(
            GridCell gridCell, object[] args, ref object result)
        {
            if (CellUserFunction != null)
            {
                GridCellUserFunctionEventArgs ev = new
                    GridCellUserFunctionEventArgs(gridCell.GridPanel, gridCell, args, result);
                CellUserFunction(this, ev);
                result = ev.Result;
            }
        }
        #endregion
        #region CellValidatingEvent
        /// 
        /// Handles invocation of CellValidating events
        /// 
        internal bool DoCellValidatingEvent(
            GridCell gridCell, ref object value, object formattedValue)
        {
            if (CellValidating != null)
            {
                GridCellValidatingEventArgs ev = new GridCellValidatingEventArgs(
                    gridCell.GridPanel, gridCell, value, formattedValue);
                CellValidating(this, ev);
                value = ev.Value;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region CellValidatedEvent
        /// 
        /// Handles invocation of CellValidated events
        /// 
        internal void DoCellValidatedEvent(GridCell gridCell)
        {
            if (CellValidated != null)
            {
                GridCellValidatedEventArgs ev = new
                    GridCellValidatedEventArgs(gridCell.GridPanel, gridCell);
                CellValidated(this, ev);
            }
        }
        #endregion
        #region CellValueChangedEvent
        /// 
        /// Handles invocation of CellValueChanged events
        /// 
        internal void DoCellValueChangedEvent(
            GridCell gridCell, object oldValue, object newValue, DataContext context)
        {
            if (CellValueChanged != null)
            {
                GridCellValueChangedEventArgs ev = new
                    GridCellValueChangedEventArgs(gridCell.GridPanel, gridCell, oldValue, newValue, context);
                CellValueChanged(this, ev);
            }
        }
        #endregion
        #region Check events
        #region AfterCheckEvent
        /// 
        /// Handles invocation of AfterCheckEvent events
        /// 
        internal void DoAfterCheckEvent(GridPanel gridPanel, GridElement item)
        {
            if (AfterCheck != null)
            {
                GridAfterCheckEventArgs ev = new
                    GridAfterCheckEventArgs(gridPanel, item);
                AfterCheck(this, ev);
            }
        }
        #endregion
        #region BeforeCheckEvent
        /// 
        /// Handles invocation of BeforeCheck events
        /// 
        internal bool DoBeforeCheckEvent(GridPanel gridPanel, GridElement gridRow)
        {
            if (BeforeCheck != null)
            {
                GridBeforeCheckEventArgs ev = new
                    GridBeforeCheckEventArgs(gridPanel, gridRow);
                BeforeCheck(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #endregion
        #region Collapse events
        #region AfterCollapseEvent
        /// 
        /// Handles invocation of AfterCollapse events
        /// 
        internal void DoAfterCollapseEvent(GridPanel gridPanel, GridContainer gridContainer, ExpandSource expandSource)
        {
            if (AfterCollapse != null)
            {
                GridAfterCollapseEventArgs ev = new
                    GridAfterCollapseEventArgs(gridPanel, gridContainer, expandSource);
                AfterCollapse(this, ev);
            }
        }
        #endregion
        #region BeforeCollapseEvent
        /// 
        /// Handles invocation of BeforeCollapse events
        /// 
        internal bool DoBeforeCollapseEvent(GridPanel gridPanel, GridContainer gridContainer, ExpandSource expandSource)
        {
            if (BeforeCollapse != null)
            {
                GridBeforeCollapseEventArgs ev = new
                    GridBeforeCollapseEventArgs(gridPanel, gridContainer, expandSource);
                BeforeCollapse(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #endregion
        #region Column events
        #region ColumnGroupedEvent
        /// 
        /// Handles invocation of ColumnGrouped events
        /// 
        internal void DoColumnGroupedEvent(
            GridPanel gridPanel, GridColumn gridColumn, GridGroup gridGroup)
        {
            if (ColumnGrouped != null)
            {
                GridColumnGroupedEventArgs ev = new
                    GridColumnGroupedEventArgs(gridPanel, gridColumn, gridGroup);
                ColumnGrouped(this, ev);
            }
        }
        #endregion
        #region ColumnHeaderClickEvent
        /// 
        /// Handles invocation of ColumnHeaderClick events
        /// 
        internal bool DoColumnHeaderClickEvent(
            GridPanel gridPanel, GridColumn gridColumn, MouseEventArgs e)
        {
            if (ColumnHeaderClick != null)
            {
                GridColumnHeaderClickEventArgs ev = new
                    GridColumnHeaderClickEventArgs(gridPanel, gridColumn, e);
                ColumnHeaderClick(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region ColumnHeaderDoubleClickEvent
        /// 
        /// Handles invocation of ColumnHeaderDoubleClick events
        /// 
        internal bool DoColumnHeaderDoubleClickEvent(GridColumn gridColumn, MouseEventArgs e)
        {
            if (ColumnHeaderDoubleClick != null)
            {
                GridColumnHeaderDoubleClickEventArgs ev = new
                    GridColumnHeaderDoubleClickEventArgs(gridColumn.GridPanel, gridColumn, e);
                ColumnHeaderDoubleClick(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region ColumnHeaderMarkupLinkClick Event
        /// 
        /// Handles invocation of ColumnHeaderMarkupLinkClick events
        /// 
        internal void DoColumnHeaderMarkupLinkClickEvent(
            GridColumn gridColumn, HyperLink hyperLink)
        {
            if (ColumnHeaderMarkupLinkClick != null)
            {
                GridColumnHeaderMarkupLinkClickEventArgs ev = new GridColumnHeaderMarkupLinkClickEventArgs(
                    gridColumn.GridPanel, gridColumn, hyperLink.Name, hyperLink.HRef);
                ColumnHeaderMarkupLinkClick(this, ev);
            }
        }
        #endregion
        #region ColumnHeaderMouseDownEvent
        /// 
        /// Handles invocation of ColumnHeaderMouseDown events
        /// 
        internal void DoColumnHeaderMouseDownEvent(GridColumnHeader gridColumnHeader, MouseEventArgs args)
        {
            if (ColumnHeaderMouseDown != null)
            {
                GridColumnHeaderMouseEventArgs ev = new
                    GridColumnHeaderMouseEventArgs(gridColumnHeader, args);
                ColumnHeaderMouseDown(this, ev);
            }
        }
        #endregion
        #region ColumnHeaderMouseEnterEvent
        /// 
        /// Handles invocation of ColumnHeaderMouseEnter events
        /// 
        internal void DoColumnHeaderMouseEnterEvent(GridColumnHeader gridColumnHeader)
        {
            if (ColumnHeaderMouseEnter != null)
            {
                GridColumnHeaderEventArgs ev = new
                    GridColumnHeaderEventArgs(gridColumnHeader);
                ColumnHeaderMouseEnter(this, ev);
            }
        }
        #endregion
        #region ColumnHeaderMouseLeaveEvent
        /// 
        /// Handles invocation of ColumnHeaderMouseLeave events
        /// 
        internal void DoColumnHeaderMouseLeaveEvent(GridColumnHeader gridColumnHeader)
        {
            if (ColumnHeaderMouseLeave != null)
            {
                GridColumnHeaderEventArgs ev = new
                    GridColumnHeaderEventArgs(gridColumnHeader);
                ColumnHeaderMouseLeave(this, ev);
            }
        }
        #endregion
        #region ColumnHeaderMouseMoveEvent
        /// 
        /// Handles invocation of ColumnHeaderMouseMove events
        /// 
        internal void DoColumnHeaderMouseMoveEvent(GridColumnHeader gridColumnHeader, MouseEventArgs args)
        {
            if (ColumnHeaderMouseMove != null)
            {
                GridColumnHeaderMouseEventArgs ev = new
                    GridColumnHeaderMouseEventArgs(gridColumnHeader, args);
                ColumnHeaderMouseMove(this, ev);
            }
        }
        #endregion
        #region ColumnHeaderMouseUpEvent
        /// 
        /// Handles invocation of CellMouseUp events
        /// 
        internal void DoColumnHeaderMouseUpEvent(GridColumnHeader gridColumnHeader, MouseEventArgs args)
        {
            if (ColumnHeaderMouseUp != null)
            {
                GridColumnHeaderMouseEventArgs ev = new
                    GridColumnHeaderMouseEventArgs(gridColumnHeader, args);
                ColumnHeaderMouseUp(this, ev);
            }
        }
        #endregion
        #region ColumnGroupHeaderClickEvent
        /// 
        /// Handles invocation of ColumnGroupHeaderClick events
        /// 
        internal bool DoColumnGroupHeaderClickEvent(GridPanel gridPanel,
            GridColumnHeader header, ColumnGroupHeader groupHeader, MouseEventArgs e)
        {
            if (ColumnGroupHeaderClick != null)
            {
                GridColumnGroupHeaderClickEventArgs ev = new
                    GridColumnGroupHeaderClickEventArgs(gridPanel, header, groupHeader, e);
                ColumnGroupHeaderClick(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region ColumnGroupHeaderDoubleClickEvent
        /// 
        /// Handles invocation of ColumnGroupHeaderDoubleClick events
        /// 
        internal bool DoColumnGroupHeaderDoubleClickEvent(GridPanel gridPanel,
            GridColumnHeader header, ColumnGroupHeader groupHeader, MouseEventArgs e)
        {
            if (ColumnGroupHeaderDoubleClick != null)
            {
                GridColumnGroupHeaderDoubleClickEventArgs ev = new
                    GridColumnGroupHeaderDoubleClickEventArgs(gridPanel, header, groupHeader, e);
                ColumnGroupHeaderDoubleClick(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region ColumnGroupHeaderMarkupLinkClick Event
        /// 
        /// Handles invocation of ColumnGroupHeaderMarkupLinkClick events
        /// 
        internal void DoColumnGroupHeaderMarkupLinkClickEvent(GridPanel gridPanel,
            GridColumnHeader header, ColumnGroupHeader groupHeader, HyperLink hyperLink)
        {
            if (ColumnGroupHeaderMarkupLinkClick != null)
            {
                GridColumnGroupHeaderMarkupLinkClickEventArgs ev = new GridColumnGroupHeaderMarkupLinkClickEventArgs(
                    gridPanel, header, groupHeader, hyperLink.Name, hyperLink.HRef);
                ColumnGroupHeaderMarkupLinkClick(this, ev);
            }
        }
        #endregion
        #region ColumnGroupHeaderResizedEvent
        /// 
        /// Handles invocation of ColumnGroupHeaderResized events
        /// 
        internal void DoColumnGroupHeaderResizedEvent(
            GridPanel gridPanel, ColumnGroupHeader groupHeader, Size oldSize)
        {
            if (ColumnGroupHeaderResized != null)
            {
                GridColumnGroupHeaderResizedEventArgs ev = new
                    GridColumnGroupHeaderResizedEventArgs(gridPanel, groupHeader, oldSize);
                ColumnGroupHeaderResized(this, ev);
            }
        }
        #endregion
        #region ColumnRowHeaderClickEvent
        /// 
        /// Handles invocation of ColumnRowHeaderClick events
        /// 
        internal void DoColumnRowHeaderClickEvent(GridPanel gridPanel)
        {
            if (ColumnRowHeaderClick != null)
            {
                GridEventArgs ev = new GridEventArgs(gridPanel);
                ColumnRowHeaderClick(this, ev);
            }
        }
        #endregion
        #region ColumnRowHeaderDoubleClickEvent
        /// 
        /// Handles invocation of ColumnRowHeaderDoubleClick events
        /// 
        internal void DoColumnRowHeaderDoubleClickEvent(GridPanel gridPanel)
        {
            if (ColumnRowHeaderDoubleClick != null)
            {
                GridEventArgs ev = new GridEventArgs(gridPanel);
                ColumnRowHeaderDoubleClick(this, ev);
            }
        }
        #endregion
        #region ColumnMovedEvent
        /// 
        /// Handles invocation of ColumnMoved events
        /// 
        internal void DoColumnMovedEvent(GridPanel gridPanel, GridColumn gridColumn)
        {
            if (ColumnMoved != null)
            {
                GridColumnEventArgs ev = new
                    GridColumnEventArgs(gridPanel, gridColumn);
                ColumnMoved(this, ev);
            }
        }
        #endregion
        #region ColumnResizedEvent
        /// 
        /// Handles invocation of ColumnResized events
        /// 
        internal void DoColumnResizedEvent(GridPanel gridPanel, GridColumn gridColumn)
        {
            if (ColumnResized != null)
            {
                GridColumnEventArgs ev = new
                    GridColumnEventArgs(gridPanel, gridColumn);
                ColumnResized(this, ev);
            }
        }
        #endregion
        #endregion
        #region CompareElementsEvent
        /// 
        /// Handles invocation of CompareElementsEvent events
        /// 
        internal bool DoCompareElementsEvent(GridPanel panel,
            GridElement a, GridElement b, ref int result)
        {
            if (CompareElements != null)
            {
                GridCompareElementsEventArgs ev = new
                    GridCompareElementsEventArgs(panel, a, b);
                CompareElements(this, ev);
                result = ev.Result;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region DataBindingStartEvent
        /// 
        /// Handles invocation of DataBindingStart events
        /// 
        internal bool DoDataBindingStartEvent(GridPanel gridPanel,
            GridRow row, string tableName, ref bool autogen, ref ProcessChildRelations crProcess)
        {
            if (DataBindingStart != null)
            {
                GridDataBindingStartEventArgs ev = new
                    GridDataBindingStartEventArgs(gridPanel, row, tableName, autogen, crProcess);
                DataBindingStart(this, ev);
                autogen = ev.AutoGenerateColumns;
                crProcess = ev.ProcessChildRelations;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region DataBindingCompleteEvent
        /// 
        /// Handles invocation of DataBindingComplete events
        /// 
        internal void DoDataBindingCompleteEvent(GridPanel gridPanel)
        {
            if (DataBindingComplete != null)
            {
                GridDataBindingCompleteEventArgs ev = new
                    GridDataBindingCompleteEventArgs(gridPanel);
                DataBindingComplete(this, ev);
            }
        }
        #endregion
        #region DataErrorEvent
        /// 
        /// Handles invocation of DataError events
        /// 
        internal bool DoDataErrorEvent(GridPanel gridPanel, GridCell gridCell, Exception exception,
            DataContext errorContext, ref object value, ref bool throwException, ref bool retry)
        {
            if (DataError != null)
            {
                GridDataErrorEventArgs ev = new
                    GridDataErrorEventArgs(gridPanel, gridCell, exception, errorContext, value);
                DataError(this, ev);
                value = ev.Value;
                throwException = ev.ThrowException;
                retry = ev.Retry;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region DataFilteringStartEvent
        /// 
        /// Handles invocation of DataFilteringStart events
        /// 
        internal bool DoDataFilteringStartEvent(GridPanel gridPanel)
        {
            if (DataFilteringStart != null)
            {
                GridDataFilteringStartEventArgs ev = new
                    GridDataFilteringStartEventArgs(gridPanel);
                DataFilteringStart(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region DataFilteringCompleteEvent
        /// 
        /// Handles invocation of DataFilteringCompleteEvent events
        /// 
        internal void DoDataFilteringCompleteEvent(GridPanel gridPanel)
        {
            if (DataFilteringComplete != null)
            {
                GridDataFilteringCompleteEventArgs ev = new
                    GridDataFilteringCompleteEventArgs(gridPanel);
                DataFilteringComplete(this, ev);
            }
        }
        #endregion
        #region ItemDragEvent
        /// 
        /// Handles ItemDrag events
        /// 
        internal bool DoItemDragEvent(GridElement element, MouseEventArgs e)
        {
            if (ItemDrag != null)
            {
                GridItemDragEventArgs ev = new
                    GridItemDragEventArgs(element.GridPanel, element, e);
                ItemDrag(this, ev);
                return (ev.Cancel);
            }
            return (true);
        }
        #endregion
        #region Editor events
        #region BeginEditEvent
        /// 
        /// Handles invocation of BeginEdit events
        /// 
        internal bool DoBeginEditEvent(
            GridPanel gridPanel, GridCell cell, IGridCellEditControl editor)
        {
            if (BeginEdit != null)
            {
                GridEditEventArgs ev = new
                    GridEditEventArgs(gridPanel, cell, editor);
                BeginEdit(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region CancelEditEvent
        /// 
        /// Handles invocation of CancelEdit events
        /// 
        internal bool DoCancelEditEvent(
            GridPanel gridPanel, GridCell cell, IGridCellEditControl editor)
        {
            if (CancelEdit != null)
            {
                GridEditEventArgs ev = new
                    GridEditEventArgs(gridPanel, cell, editor);
                CancelEdit(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region CloseEdit
        /// 
        /// Handles invocation of CloseEdit events
        /// 
        internal void DoCloseEditEvent(GridPanel gridPanel, GridCell cell)
        {
            if (CloseEdit != null)
            {
                GridCloseEditEventArgs ev = new
                    GridCloseEditEventArgs(gridPanel, cell);
                CloseEdit(this, ev);
            }
        }
        #endregion
        #region EditorValueChangedEvent
        /// 
        /// Handles invocation of EditorValueChanged events
        /// 
        internal void DoEditorValueChangedEvent(
            GridCell gridCell, IGridCellEditControl editor)
        {
            if (EditorValueChanged != null)
            {
                GridEditEventArgs ev = new
                    GridEditEventArgs(gridCell.GridPanel, gridCell, editor);
                EditorValueChanged(this, ev);
            }
        }
        #endregion
        #region EndEditEvent
        /// 
        /// Handles invocation of EndEdit events
        /// 
        internal bool DoEndEditEvent(
            GridPanel gridPanel, GridCell cell, IGridCellEditControl editor)
        {
            if (EndEdit != null)
            {
                GridEditEventArgs ev = new
                    GridEditEventArgs(gridPanel, cell, editor);
                EndEdit(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region GetEditorEvent
        /// 
        /// Handles invocation of GetEditor events
        /// 
        internal void DoGetEditorEvent(
            GridPanel gridPanel, GridCell cell, ref Type type, ref object[] editorParams)
        {
            if (GetEditor != null)
            {
                GridGetEditorEventArgs ev = new
                    GridGetEditorEventArgs(gridPanel, cell, type, editorParams);
                GetEditor(this, ev);
                if (ev.EditorType != null)
                    type = ev.EditorType;
                editorParams = ev.EditorParams;
            }
        }
        #endregion
        #region GetRendererEvent
        /// 
        /// Handles invocation of GetRenderer events
        /// 
        internal void DoGetRendererEvent(
            GridPanel gridPanel, GridCell cell, ref Type type, ref object[] renderParams)
        {
            if (GetRenderer != null)
            {
                GridGetRendererEventArgs ev = new
                    GridGetRendererEventArgs(gridPanel, cell, type, renderParams);
                GetRenderer(this, ev);
                type = ev.RenderType;
                renderParams = ev.RenderParams;
            }
        }
        #endregion
        #endregion
        #region Expand events
        #region AfterExpandEvent
        /// 
        /// Handles invocation of AfterExpand events
        /// 
        internal void DoAfterExpandEvent(
            GridPanel gridPanel, GridContainer container, ExpandSource expandSource)
        {
            if (AfterExpand != null)
            {
                GridAfterExpandEventArgs ev = new
                    GridAfterExpandEventArgs(gridPanel, container, expandSource);
                AfterExpand(this, ev);
            }
        }
        #endregion
        #region BeforeExpandEvent
        /// 
        /// Handles invocation of BeforeExpand events
        /// 
        internal bool DoBeforeExpandEvent(
            GridPanel gridPanel, GridContainer container, ExpandSource expandSource)
        {
            if (BeforeExpand != null)
            {
                GridBeforeExpandEventArgs ev = new
                    GridBeforeExpandEventArgs(gridPanel, container, expandSource);
                BeforeExpand(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #endregion
        #region Filter events
        #region FilterBeginEditEvent
        /// 
        /// Handles invocation of FilterBeginEdit events
        /// 
        internal bool DoFilterBeginEditEvent(
            GridPanel panel, GridColumn column, FilterPanel filterPanel)
        {
            if (FilterBeginEdit != null)
            {
                GridFilterBeginEditEventArgs ev = new
                    GridFilterBeginEditEventArgs(panel, column, filterPanel);
                FilterBeginEdit(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region FilterCancelEditEvent
        /// 
        /// Handles invocation of FilterCancelEdit events
        /// 
        internal void DoFilterCancelEditEvent(GridColumn column, FilterPanel filterPanel)
        {
            if (FilterCancelEdit != null)
            {
                GridFilterCancelEditEventArgs ev = new
                    GridFilterCancelEditEventArgs(column.GridPanel, column, filterPanel);
                FilterCancelEdit(this, ev);
            }
        }
        #endregion
        #region FilterColumnErrorEvent
        /// 
        /// Handles invocation of FilterColumnError events
        /// 
        internal bool DoFilterColumnErrorEvent(GridPanel panel, GridRow row,
            GridColumn col, Exception exp, ref bool filteredOut, ref bool throwException, ref bool postError)
        {
            if (FilterColumnError != null)
            {
                GridFilterColumnErrorEventArgs ev = new GridFilterColumnErrorEventArgs(
                    panel, row, col, exp, filteredOut, throwException, postError);
                FilterColumnError(this, ev);
                filteredOut = ev.FilteredOut;
                throwException = ev.ThrowException;
                postError = ev.PostError;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region FilterEditValueChangedEvent
        /// 
        /// Handles invocation of FilterEditValueChanged events
        /// 
        internal bool DoFilterEditValueChangedEvent(GridPanel panel, GridColumn column, FilterPanel fp,
            object oldValue, ref object newValue, ref object newDisplayValue, ref string newExpr)
        {
            if (FilterEditValueChanged != null)
            {
                GridFilterEditValueChangedEventArgs ev = new
                    GridFilterEditValueChangedEventArgs(panel,
                    column, fp, oldValue, newValue, newDisplayValue, newExpr);
                FilterEditValueChanged(this, ev);
                newValue = ev.NewValue;
                newDisplayValue = ev.NewDisplayValue;
                newExpr = ev.NewExpr;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region FilterEndEditEvent
        /// 
        /// Handles invocation of FilterEndEdit events
        /// 
        internal void DoFilterEndEditEvent(GridColumn column, FilterPanel filterPanel)
        {
            if (FilterEndEdit != null)
            {
                GridFilterEndEditEventArgs ev = new
                    GridFilterEndEditEventArgs(column.GridPanel, column, filterPanel);
                FilterEndEdit(this, ev);
            }
        }
        #endregion
        #region FilterHeaderClickEvent
        /// 
        /// Handles invocation of FilterHeaderClick events
        /// 
        internal bool DoFilterHeaderClickEvent(
            GridPanel gridPanel, GridColumn gridColumn, MouseEventArgs e)
        {
            if (FilterHeaderClick != null)
            {
                GridFilterHeaderClickEventArgs ev = new
                    GridFilterHeaderClickEventArgs(gridPanel, gridColumn, e);
                FilterHeaderClick(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region FilterHelpClosingEvent
        /// 
        /// Handles invocation of FilterHelpClosing events
        /// 
        internal void DoFilterHelpClosingEvent(GridPanel panel, GridColumn column, SampleExpr sampleExpr)
        {
            if (FilterHelpClosing != null)
            {
                GridFilterHelpClosingEventArgs ev = new
                    GridFilterHelpClosingEventArgs(panel, column, sampleExpr);
                FilterHelpClosing(this, ev);
            }
        }
        #endregion
        #region FilterHelpOpeningEvent
        /// 
        /// Handles invocation of FilterHelpOpening events
        /// 
        internal bool DoFilterHelpOpeningEvent(GridPanel panel, GridColumn column, SampleExpr sampleExpr)
        {
            if (FilterHelpOpening != null)
            {
                GridFilterHelpOpeningEventArgs ev = new
                    GridFilterHelpOpeningEventArgs(panel, column, sampleExpr);
                FilterHelpOpening(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region FilterItemsLoadedEvent
        /// 
        /// Handles invocation of FilterItemsLoaded events
        /// 
        internal void DoFilterItemsLoadedEvent(GridColumn column, ComboBoxEx comboBox)
        {
            if (FilterItemsLoaded != null)
            {
                GridFilterItemsLoadedEventArgs ev = new
                    GridFilterItemsLoadedEventArgs(column.GridPanel, column, comboBox);
                FilterItemsLoaded(this, ev);
            }
        }
        #endregion
        #region FilterLoadItemsEvent
        /// 
        /// Handles invocation of FilterLoadItems events
        /// 
        internal bool DoFilterLoadItemsEvent(GridColumn column, ComboBoxEx comboBox)
        {
            if (FilterLoadItems != null)
            {
                GridFilterLoadItemsEventArgs ev = new
                    GridFilterLoadItemsEventArgs(column.GridPanel, column, comboBox);
                FilterLoadItems(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region FilterLoadUserDataEvent
        /// 
        /// Handles invocation of FilterLoadUserData events
        /// 
        internal bool DoFilterLoadUserDataEvent(
            GridPanel gridPanel, ref string filterPath, ref List filterData)
        {
            if (FilterLoadUserData != null)
            {
                GridFilterLoadUserDataEventArgs ev = new
                    GridFilterLoadUserDataEventArgs(gridPanel, filterPath, filterData);
                FilterLoadUserData(this, ev);
                filterPath = ev.FilterPath;
                filterData = ev.FilterData;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region FilterPopupClosingEvent
        /// 
        /// Handles invocation of FilterPopupClosing events
        /// 
        internal void DoFilterPopupClosingEvent(GridColumn column, FilterPopup filterPopup)
        {
            if (FilterPopupClosing != null)
            {
                GridFilterPopupClosingEventArgs ev = new
                    GridFilterPopupClosingEventArgs(column.GridPanel, column, filterPopup);
                FilterPopupClosing(this, ev);
            }
        }
        #endregion
        #region FilterPopupLoadEvent
        /// 
        /// Handles invocation of FilterPopupLoad events
        /// 
        internal bool DoFilterPopupLoadEvent(GridColumn column, FilterPopup filterPopup)
        {
            if (FilterPopupLoad != null)
            {
                GridFilterPopupLoadEventArgs ev = new
                    GridFilterPopupLoadEventArgs(column.GridPanel, column, filterPopup);
                FilterPopupLoad(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region FilterPopupLoadedEvent
        /// 
        /// Handles invocation of FilterPopupLoaded events
        /// 
        internal void DoFilterPopupLoadedEvent(GridColumn column, FilterPopup filterPopup)
        {
            if (FilterPopupLoaded != null)
            {
                GridFilterPopupLoadedEventArgs ev = new
                    GridFilterPopupLoadedEventArgs(column.GridPanel, column, filterPopup);
                FilterPopupLoaded(this, ev);
            }
        }
        #endregion
        #region FilterPopupOpeningEvent
        /// 
        /// Handles invocation of FilterPopupOpening events
        /// 
        internal bool DoFilterPopupOpeningEvent(GridColumn column, FilterPopup filterPopup)
        {
            if (FilterPopupOpening != null)
            {
                GridFilterPopupOpeningEventArgs ev = new
                    GridFilterPopupOpeningEventArgs(column.GridPanel, column, filterPopup);
                FilterPopupOpening(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region FilterPopupValueChangedEvent
        /// 
        /// Handles invocation of FilterPopupValueChanged events
        /// 
        internal bool DoFilterPopupValueChangedEvent(GridColumn column, FilterItemType filterItemType,
            ref object filterValue, ref object filterDisplayValue, ref string filterExpr)
        {
            if (FilterPopupValueChanged != null)
            {
                GridFilterPopupValueChangedEventArgs ev = 
                    new GridFilterPopupValueChangedEventArgs(column.GridPanel,
                    column, filterItemType, filterValue, filterDisplayValue, filterExpr);
                FilterPopupValueChanged(this, ev);
                filterValue = ev.FilterValue;
                filterDisplayValue = ev.FilterDisplayValue;
                filterExpr = ev.FilterExpr;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region FilterRowErrorEvent
        /// 
        /// Handles invocation of FilterRowError events
        /// 
        internal bool DoFilterRowErrorEvent(GridPanel panel, GridRow row,
            Exception exp, ref bool filteredOut, ref bool throwException, ref bool postError)
        {
            if (FilterRowError != null)
            {
                GridFilterRowErrorEventArgs ev = new GridFilterRowErrorEventArgs(
                    panel, row, exp, filteredOut, throwException, postError);
                FilterRowError(this, ev);
                filteredOut = ev.FilteredOut;
                throwException = ev.ThrowException;
                postError = ev.PostError;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region FilterRowHeaderClickEvent
        /// 
        /// Handles invocation of FilterRowHeaderClick events
        /// 
        internal bool DoFilterRowHeaderClickEvent(GridPanel gridPanel)
        {
            if (FilterRowHeaderClick != null)
            {
                GridCancelEventArgs ev = new GridCancelEventArgs(gridPanel);
                FilterRowHeaderClick(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region FilterStoreUserDataEvent
        /// 
        /// Handles invocation of FilterStoreUserData events
        /// 
        internal bool DoFilterStoreUserDataEvent(
            GridPanel gridPanel, ref string filterPath, ref List filterData)
        {
            if (FilterStoreUserData != null)
            {
                GridFilterStoreUserDataEventArgs ev = new
                    GridFilterStoreUserDataEventArgs(gridPanel, filterPath, filterData);
                FilterStoreUserData(this, ev);
                filterPath = ev.FilterPath;
                filterData = ev.FilterData;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region FilterUserFunctionEvent
        /// 
        /// Handles invocation of FilterUserFunction events
        /// 
        internal bool DoFilterUserFunctionEvent(
            GridRow gridRow, object[] args, ref object result)
        {
            if (FilterUserFunction != null)
            {
                GridFilterUserFunctionEventArgs ev = new
                    GridFilterUserFunctionEventArgs(gridRow.GridPanel, gridRow, args, result);
                FilterUserFunction(this, ev);
                if (ev.Handled == true)
                {
                    result = ev.Result;
                    return (true);
                }
            }
            return (false);
        }
        #endregion
        #region GetFilterColumnHeaderStyleEvent
        /// 
        /// Handles invocation of GetFilterColumnHeaderStyle events
        /// 
        internal void DoGetFilterColumnHeaderStyleEvent(
            GridColumn gridColumn, StyleType eStyle, ref FilterColumnHeaderVisualStyle style)
        {
            if (GetFilterColumnHeaderStyle != null)
            {
                GridGetFilterColumnHeaderStyleEventArgs ev = new
                    GridGetFilterColumnHeaderStyleEventArgs(gridColumn.GridPanel, gridColumn, eStyle, style);
                GetFilterColumnHeaderStyle(this, ev);
                style = ev.Style;
            }
        }
        #endregion
        #region GetFilterEditTypeEvent
        /// 
        /// Handles invocation of GetFilterEditType events
        /// 
        internal void DoGetFilterEditTypeEvent(
            GridColumn gridColumn, ref FilterEditType filterType)
        {
            if (GetFilterEditType != null)
            {
                GridGetFilterEditTypeEventArgs ev = new
                    GridGetFilterEditTypeEventArgs(gridColumn.GridPanel, gridColumn, filterType);
                GetFilterEditType(this, ev);
                filterType = ev.FilterEditType;
            }
        }
        #endregion
        #region GetFilterRowStyleEvent
        /// 
        /// Handles invocation of GetFilterRowStyle events
        /// 
        internal void DoGetFilterRowStyleEvent(
            GridFilter gridFilter, StyleType eStyle, ref FilterRowVisualStyle style)
        {
            if (GetFilterRowStyle != null)
            {
                GridGetFilterRowStyleEventArgs ev = new
                    GridGetFilterRowStyleEventArgs(gridFilter.GridPanel, gridFilter, eStyle, style);
                GetFilterRowStyle(this, ev);
                style = ev.Style;
            }
        }
        #endregion
        #endregion
        #region GetCellRangesEvent
        /// 
        /// Handles invocation of GetCellRanges events
        /// 
        internal bool DoGetCellRangesEvent(
            GridContainer gridContainer, DisplayRange displayRange, ref List cellRanges)
        {
            if (GetCellRanges != null)
            {
                GridGetCellRangesEventArgs ev = new
                    GridGetCellRangesEventArgs(gridContainer.GridPanel, gridContainer, displayRange, cellRanges);
                GetCellRanges(this, ev);
                cellRanges = ev.CellRanges;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region GetCellFormattedValueEvent
        /// 
        /// Handles invocation of GetCellFormattedValue events
        /// 
        internal void DoGetCellFormattedValueEvent(
            GridCell gridCell, ref string formattedValue, ref CellSizingSource sizingSource)
        {
            if (GetCellFormattedValue != null)
            {
                GridGetCellFormattedValueEventArgs ev = new
                    GridGetCellFormattedValueEventArgs(gridCell.GridPanel, gridCell, formattedValue, sizingSource);
                GetCellFormattedValue(this, ev);
                formattedValue = ev.FormattedValue;
                sizingSource = ev.SizingSource;
            }
        }
        #endregion
        #region GetCellRangeFormattedValueEvent
        /// 
        /// Handles invocation of GetCellRangeFormattedValue events
        /// 
        internal void DoGetCellRangeFormattedValueEvent(
            GridContainer gridContainer, CellRange cellRange, ref string formattedValue)
        {
            if (GetCellRangeFormattedValue != null)
            {
                GridGetCellRangeFormattedValueEventArgs ev = new
                    GridGetCellRangeFormattedValueEventArgs(gridContainer.GridPanel, gridContainer, cellRange, formattedValue);
                GetCellRangeFormattedValue(this, ev);
                formattedValue = ev.FormattedValue;
            }
        }
        #endregion
        #region GetCellStyleEvent
        /// 
        /// Handles invocation of GetCellStyle events
        /// 
        internal void DoGetCellStyleEvent(
            GridCell gridCell, StyleType eStyle, ref CellVisualStyle style)
        {
            if (GetCellStyle != null)
            {
                GridGetCellStyleEventArgs ev = new
                    GridGetCellStyleEventArgs(gridCell.GridPanel, gridCell, eStyle, style);
                GetCellStyle(this, ev);
                style = ev.Style;
            }
        }
        #endregion
        #region GetCellToolTipEvent
        /// 
        /// Handles invocation of GetCellToolTipEvent events
        /// 
        internal bool DoGetCellToolTipEvent(
            GridPanel panel, GridCell gridCell, ref string toolTip)
        {
            if (GetCellToolTip != null)
            {
                GridGetCellToolTipEventArgs ev = new
                    GridGetCellToolTipEventArgs(panel, gridCell, toolTip);
                GetCellToolTip(this, ev);
                toolTip = ev.ToolTip;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region GetCellValueEvent
        /// 
        /// Handles invocation of GetCellValue events
        /// 
        internal void DoGetCellValueEvent(GridCell gridCell, ref object value)
        {
            if (GetCellValue != null)
            {
                GridGetCellValueEventArgs ev = new
                    GridGetCellValueEventArgs(gridCell.GridPanel, gridCell, value);
                GetCellValue(this, ev);
                value = ev.Value;
            }
        }
        #endregion
        #region GetColumnGroupHeaderToolTipEvent
        /// 
        /// Handles invocation of GetColumnGroupHeaderToolTip events
        /// 
        internal bool DoGetColumnGroupHeaderToolTipEvent(GridPanel panel,
            ColumnGroupHeader groupHeader, HeaderArea hitArea, ref string toolTip)
        {
            if (GetColumnGroupHeaderToolTip != null)
            {
                GridGetColumnGroupHeaderToolTipEventArgs ev = new
                    GridGetColumnGroupHeaderToolTipEventArgs(panel, groupHeader, hitArea, toolTip);
                GetColumnGroupHeaderToolTip(this, ev);
                toolTip = ev.ToolTip;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region GetColumnGroupHeaderStyleEvent
        /// 
        /// Handles invocation of GetColumnGroupHeader events
        /// 
        internal void DoGetColumnGroupHeaderStyleEvent(GridPanel panel,
            ColumnGroupHeader cgh, StyleType eStyle, ref ColumnHeaderVisualStyle style)
        {
            if (GetColumnGroupHeaderStyle != null)
            {
                GridGetColumnGroupHeaderStyleEventArgs ev = new
                    GridGetColumnGroupHeaderStyleEventArgs(panel, cgh, eStyle, style);
                GetColumnGroupHeaderStyle(this, ev);
                style = ev.Style;
            }
        }
        #endregion
        #region GetColumnHeaderRowHeaderStyleEvent
        /// 
        /// Handles invocation of GetColumnHeader RowHeader events
        /// 
        internal void DoGetColumnHeaderRowHeaderStyleEvent(
            GridColumnHeader columnHeader, StyleType eStyle, ref ColumnHeaderRowVisualStyle style)
        {
            if (GetColumnHeaderRowHeaderStyle != null)
            {
                GridGetColumnHeaderRowHeaderStyleEventArgs ev = new
                    GridGetColumnHeaderRowHeaderStyleEventArgs(columnHeader.GridPanel, columnHeader, eStyle, style);
                GetColumnHeaderRowHeaderStyle(this, ev);
                style = ev.Style;
            }
        }
        #endregion
        #region GetColumnHeaderStyleEvent
        /// 
        /// Handles invocation of GetColumnHeader events
        /// 
        internal void DoGetColumnHeaderStyleEvent(
            GridColumn gridColumn, StyleType eStyle, ref ColumnHeaderVisualStyle style)
        {
            if (GetColumnHeaderStyle != null)
            {
                GridGetColumnHeaderStyleEventArgs ev = new
                    GridGetColumnHeaderStyleEventArgs(gridColumn.GridPanel, gridColumn, eStyle, style);
                GetColumnHeaderStyle(this, ev);
                style = ev.Style;
            }
        }
        #endregion
        #region GetColumnHeaderToolTipEvent
        /// 
        /// Handles invocation of GetColumnHeaderToolTip events
        /// 
        internal bool DoGetColumnHeaderToolTipEvent(GridPanel panel,
            GridColumn gridColumn, HeaderArea hitArea, ref string toolTip)
        {
            if (GetColumnHeaderToolTip != null)
            {
                GridGetColumnHeaderToolTipEventArgs ev = new
                    GridGetColumnHeaderToolTipEventArgs(panel, gridColumn, hitArea, toolTip);
                GetColumnHeaderToolTip(this, ev);
                toolTip = ev.ToolTip;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region GetDisplayRangesEvent
        /// 
        /// Handles invocation of GetDisplayRanges events
        /// 
        internal void DoGetDisplayRangesEvent(
            GridContainer gridContainer, ref List displayRanges)
        {
            if (GetDisplayRanges != null)
            {
                GridGetDisplayRangesEventArgs ev = new
                    GridGetDisplayRangesEventArgs(gridContainer.GridPanel, gridContainer, displayRanges);
                GetDisplayRanges(this, ev);
                displayRanges = ev.DisplayRanges;
            }
        }
        #endregion
        #region ConfigureGroupBox
        /// 
        /// Handles invocation of ConfigureGroupBox events
        /// 
        internal void DoConfigureGroupBoxEvent(
            GridGroupByRow groupByRow, GridGroupBox gridGroupBox)
        {
            if (ConfigureGroupBox != null)
            {
                GridConfigureGroupBoxEventArgs ev = new
                    GridConfigureGroupBoxEventArgs(groupByRow.GridPanel, groupByRow, gridGroupBox);
                ConfigureGroupBox(this, ev);
            }
        }
        #endregion
        #region GetGroupedDetailRowsEvent
        /// 
        /// Handles invocation of GetGroupedDetailRows events
        /// 
        internal bool DoGetGroupedDetailRowsEvent(GridPanel gridPanel, GridColumn gridColumn,
            GridGroup gridGroup, out List preRows, out List postRows)
        {
            if (GetGroupDetailRows != null)
            {
                GridGetGroupDetailRowsEventArgs ev = new
                    GridGetGroupDetailRowsEventArgs(gridPanel, gridColumn, gridGroup);
                GetGroupDetailRows(this, ev);
                preRows = ev.PreDetailRows;
                postRows = ev.PostDetailRows;
                return (true);
            }
            preRows = null;
            postRows = null;
            return (false);
        }
        #endregion
        #region GetGroupHeaderStyleEvent
        /// 
        /// Handles invocation of GetGroupHeaderStyle events
        /// 
        internal void DoGetGroupHeaderStyleEvent(
            GridGroup gridRow, StyleType eStyle, ref GroupHeaderVisualStyle style)
        {
            if (GetGroupHeaderStyle != null)
            {
                GridGetGroupHeaderStyleEventArgs ev = new
                    GridGetGroupHeaderStyleEventArgs(gridRow.GridPanel, gridRow, eStyle, style);
                GetGroupHeaderStyle(this, ev);
                style = ev.Style;
            }
        }
        #endregion
        #region GetGroupIdEvent
        /// 
        /// Handles invocation of GetGroupId events
        /// 
        internal void DoGetGroupIdEvent(
            GridElement row, GridColumn column, ref object groupId)
        {
            if (GetGroupId != null)
            {
                GridGetGroupIdEventArgs ev = new
                    GridGetGroupIdEventArgs(row.GridPanel, row, column, groupId);
                GetGroupId(this, ev);
                groupId = ev.GroupId ?? "";
            }
        }
        #endregion
        #region GetMergedCellStyleEvent
        /// 
        /// Handles invocation of GetMergedCellStyle events
        /// 
        internal void DoGetMergedCellStyleEvent(GridPanel panel,
            CellRange cellRange, StyleType eStyle, ref CellVisualStyle style)
        {
            if (GetMergedCellStyle != null)
            {
                GridGetMergedCellStyleEventArgs ev = new
                    GridGetMergedCellStyleEventArgs(panel, cellRange, eStyle, style);
                GetMergedCellStyle(this, ev);
                style = ev.Style;
            }
        }
        #endregion
        #region GetPanelStyleEvent
        /// 
        /// Handles invocation of GetPanelStyle events
        /// 
        internal void DoGetPanelStyleEvent(
            GridPanel gridPanel, ref GridPanelVisualStyle style)
        {
            if (GetPanelStyle != null)
            {
                GridGetPanelStyleEventArgs ev = new
                    GridGetPanelStyleEventArgs(gridPanel, style);
                GetPanelStyle(this, ev);
                style = ev.Style;
            }
        }
        #endregion
        #region GetRowCellStyleEvent
        /// 
        /// Handles invocation of GetRowCellStyle events
        /// 
        internal void DoGetRowCellStyleEvent(
            GridContainer gridRow, StyleType eStyle, ref CellVisualStyle style)
        {
            if (GetRowCellStyle != null)
            {
                GridGetRowCellStyleEventArgs ev = new
                    GridGetRowCellStyleEventArgs(gridRow.GridPanel, gridRow, eStyle, style);
                GetRowCellStyle(this, ev);
                style = ev.Style;
            }
        }
        #endregion
        #region GetRowHeaderStyleEvent
        /// 
        /// Handles invocation of GetRowHeader events
        /// 
        internal void DoGetRowHeaderStyleEvent(
            GridContainer gridRow, StyleType eStyle, ref RowHeaderVisualStyle style)
        {
            if (GetRowHeaderStyle != null)
            {
                GridGetRowHeaderStyleEventArgs ev = new
                    GridGetRowHeaderStyleEventArgs(gridRow.GridPanel, gridRow, eStyle, style);
                GetRowHeaderStyle(this, ev);
                style = ev.Style;
            }
        }
        #endregion
        #region GetRowStyleEvent
        /// 
        /// Handles invocation of GetRowStyle events
        /// 
        internal void DoGetRowStyleEvent(
            GridContainer gridRow, StyleType eStyle, ref RowVisualStyle style)
        {
            if (GetRowStyle != null)
            {
                GridGetRowStyleEventArgs ev = new
                    GridGetRowStyleEventArgs(gridRow.GridPanel, gridRow, eStyle, style);
                GetRowStyle(this, ev);
                style = ev.Style;
            }
        }
        #endregion
        #region GetRowHeaderTextEvent
        /// 
        /// Handles invocation of GetRowHeaderText events
        /// 
        internal void DoGetRowHeaderTextEvent(GridContainer row, ref string text)
        {
            if (GetRowHeaderText != null)
            {
                GridGetRowHeaderTextEventArgs ev = new
                    GridGetRowHeaderTextEventArgs(row.GridPanel, row, text);
                GetRowHeaderText(this, ev);
                text = ev.Text;
            }
        }
        #endregion
        #region GetTextRowStyleEvent
        /// 
        /// Handles invocation of GetTextRowStyle events
        /// 
        internal void DoGetTextRowStyleEvent(
            GridTextRow gridTextRow, StyleType eStyle, ref TextRowVisualStyle style)
        {
            if (GetTextRowStyle != null)
            {
                GridGetTextRowStyleEventArgs ev = new
                    GridGetTextRowStyleEventArgs(gridTextRow.GridPanel, gridTextRow, eStyle, style);
                GetTextRowStyle(this, ev);
                style = ev.Style;
            }
        }
        #endregion
        #region GridPreviewKeyDown
        private bool DoGridPreviewKeyDown(Keys keyData)
        {
            if (GridPreviewKeyDown != null)
            {
                GridPreviewKeyDownEventArgs args =
                    new GridPreviewKeyDownEventArgs(keyData | ModifierKeys);
                args.IsInputKey = _IsInputKey;
                GridPreviewKeyDown(this, args);
                _IsInputKey = args.IsInputKey;
                return (args.Handled);
            }
            return (false);
        }
        #endregion
        #region GroupChangedEvent
        /// 
        /// Handles invocation of GroupChanged events
        /// 
        internal void DoGroupChangedEvent(
            GridPanel gridPanel, GroupChangedAction action, GridColumn gridColumn)
        {
            if (GroupChanged != null)
            {
                GridGroupChangedEventArgs ev = new
                    GridGroupChangedEventArgs(gridPanel, action, gridColumn);
                GroupChanged(this, ev);
            }
        }
        #endregion
        #region GroupHeaderClickEvent
        /// 
        /// Handles invocation of GroupHeaderClick events
        /// 
        internal bool DoGroupHeaderClickEvent(GridGroup group, GroupArea area, MouseEventArgs e)
        {
            if (GroupHeaderClick != null)
            {
                GridGroupHeaderClickEventArgs ev =
                    new GridGroupHeaderClickEventArgs(group.GridPanel, group, area, e);
                GroupHeaderClick(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region GroupHeaderDoubleClickEvent
        /// 
        /// Handles invocation of GroupHeaderDoubleClick events
        /// 
        internal bool DoGroupHeaderDoubleClickEvent(GridGroup group, GroupArea area, MouseEventArgs e)
        {
            if (GroupHeaderDoubleClick != null)
            {
                GridGroupHeaderDoubleClickEventArgs ev =
                    new GridGroupHeaderDoubleClickEventArgs(group.GridPanel, group, area, e);
                GroupHeaderDoubleClick(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region GroupSortingEvent
        /// 
        /// Handles invocation of GroupSorting events
        /// 
        internal bool DoGroupSortingEvent(GridPanel panel)
        {
            if (GroupSorting != null)
            {
                GridCancelEventArgs ev = new GridCancelEventArgs(panel);
                GroupSorting(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region GroupSortedEvent
        /// 
        /// Handles invocation of GroupSorted events
        /// 
        internal void DoGroupSortedEvent(GridPanel panel)
        {
            if (GroupSorted != null)
            {
                GridEventArgs ev = new GridEventArgs(panel);
                GroupSorted(this, ev);
            }
        }
        #endregion
        #region InitEditContext
        /// 
        /// Handles invocation of InitEditContext events
        /// 
        internal void DoInitEditContextEvent(
            GridCell gridCell, IGridCellEditControl editControl)
        {
            if (InitEditContext != null)
            {
                GridInitEditContextEventArgs ev = new
                    GridInitEditContextEventArgs(gridCell.GridPanel, gridCell, editControl);
                InitEditContext(this, ev);
            }
        }
        #endregion
        #region LayoutOrderUpdatingEvent
        /// 
        /// Handles invocation of LayoutOrderUpdating events
        /// 
        internal bool DoLayoutOrderUpdatingEvent(GridPanel panel)
        {
            if (LayoutOrderUpdating != null)
            {
                GridCancelEventArgs ev = new GridCancelEventArgs(panel);
                LayoutOrderUpdating(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region LayoutOrderUpdatedEvent
        /// 
        /// Handles invocation of LayoutOrderUpdated events
        /// 
        internal void DoLayoutOrderUpdatedEvent(GridPanel panel)
        {
            if (LayoutOrderUpdated != null)
            {
                GridEventArgs ev = new GridEventArgs(panel);
                LayoutOrderUpdated(this, ev);
            }
        }
        #endregion
        #region NoRowsMarkupLinkClick Event
        /// 
        /// Handles invocation of NoRowsTextMarkupLinkClick events
        /// 
        internal void DoNoRowsMarkupLinkClickEvent(
            GridPanel gridPanel, HyperLink hyperLink)
        {
            if (NoRowsMarkupLinkClick != null)
            {
                GridNoRowsMarkupLinkClickEventArgs ev = new GridNoRowsMarkupLinkClickEventArgs(
                    gridPanel, hyperLink.Name, hyperLink.HRef);
                NoRowsMarkupLinkClick(this, ev);
            }
        }
        #endregion
        #region PlayingSoundEvent
        /// 
        /// Handles invocation of PlayingSound Events
        /// 
        internal bool DoPlayingSoundEvent(
            GridPanel panel, object item, PlaySoundContext context)
        {
            if (PlayingSound != null)
            {
                GridPlayingSoundEventArgs ev =
                    new GridPlayingSoundEventArgs(panel, item, context);
                PlayingSound(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region PreviewKeyDown
        private void DoPreviewKeyDown(Keys keyData)
        {
            if (PreviewKeyDown != null)
            {
                PreviewKeyDownEventArgs args =
                    new PreviewKeyDownEventArgs(keyData);
                args.IsInputKey = _IsInputKey;
                PreviewKeyDown(this, args);
                _IsInputKey = args.IsInputKey;
            }
        }
        #endregion
        #region RefreshFilter
        internal bool DoRefreshFilter(GridPanel panel)
        {
            if (RefreshFilter != null)
            {
                GridRefreshFilterEventArgs args =
                    new GridRefreshFilterEventArgs(panel);
                RefreshFilter(this, args);
                return (args.Cancel);
            }
            return (false);
        }
        #endregion
        #region Render events
        #region PostRenderCellEvent
        /// 
        /// Handles invocation of PostRenderCell events
        /// 
        internal void DoPostRenderCellEvent(Graphics g,
            GridCell gridCell, RenderParts parts, Rectangle bounds)
        {
            if (PostRenderCell != null)
            {
                GridPostRenderCellEventArgs ev = new
                    GridPostRenderCellEventArgs(g, gridCell.GridPanel, gridCell, parts, bounds);
                PostRenderCell(this, ev);
            }
        }
        #endregion
        #region PreRenderCellEvent
        /// 
        /// Handles invocation of PreRenderCell events
        /// 
        internal bool DoPreRenderCellEvent(Graphics g,
            GridCell gridCell, RenderParts parts, Rectangle bounds)
        {
            if (PreRenderCell != null)
            {
                GridPreRenderCellEventArgs ev = new
                    GridPreRenderCellEventArgs(g, gridCell.GridPanel, gridCell, parts, bounds);
                PreRenderCell(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region PostRenderColumnHeaderEvent
        /// 
        /// Handles invocation of PostRenderColumnHeader events
        /// 
        internal void DoPostRenderColumnHeaderEvent(Graphics g,
            GridColumnHeader header, GridColumn column, RenderParts parts, Rectangle bounds)
        {
            if (PostRenderColumnHeader != null)
            {
                GridPanel panel = header.GridPanel;
                GridPostRenderColumnHeaderEventArgs ev = new
                    GridPostRenderColumnHeaderEventArgs(g, panel, header, column, parts, bounds);
                PostRenderColumnHeader(this, ev);
            }
        }
        #endregion
        #region PreRenderColumnHeaderEvent
        /// 
        /// Handles invocation of PreRenderColumnHeaderEvent events
        /// 
        internal bool DoPreRenderColumnHeaderEvent(Graphics g,
            GridColumnHeader header, GridColumn column, RenderParts parts, Rectangle bounds)
        {
            if (PreRenderColumnHeader != null)
            {
                GridPanel panel = header.GridPanel;
                GridPreRenderColumnHeaderEventArgs ev = new
                    GridPreRenderColumnHeaderEventArgs(g, panel, header, column, parts, bounds);
                PreRenderColumnHeader(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region PostRenderColumnGroupHeaderEvent
        /// 
        /// Handles invocation of PostRenderColumnGroupHeader events
        /// 
        internal void DoPostRenderColumnGroupHeaderEvent(Graphics g,
            GridColumnHeader header, ColumnGroupHeader groupHeader, RenderParts parts, Rectangle bounds)
        {
            if (PostRenderColumnGroupHeader != null)
            {
                GridPanel panel = header.GridPanel;
                GridPostRenderColumnGroupHeaderEventArgs ev = new
                    GridPostRenderColumnGroupHeaderEventArgs(g, panel, header, groupHeader, parts, bounds);
                PostRenderColumnGroupHeader(this, ev);
            }
        }
        #endregion
        #region PreRenderColumnGroupHeaderEvent
        /// 
        /// Handles invocation of PreRenderColumnGroupHeader events
        /// 
        internal bool DoPreRenderColumnGroupHeaderEvent(Graphics g,
            GridColumnHeader header, ColumnGroupHeader groupHeader, RenderParts parts, Rectangle bounds)
        {
            if (PreRenderColumnGroupHeader != null)
            {
                GridPanel panel = header.GridPanel;
                GridPreRenderColumnGroupHeaderEventArgs ev = new
                    GridPreRenderColumnGroupHeaderEventArgs(g, panel, header, groupHeader, parts, bounds);
                PreRenderColumnGroupHeader(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region PostRenderFilterPopupGripBarEvent
        /// 
        /// Handles invocation of PostRenderFilterPopupGripBar events
        /// 
        internal void DoPostRenderFilterPopupGripBarEvent(
            Graphics g, FilterPopup filterPopup, GridColumn gridColumn, Rectangle bounds)
        {
            if (PostRenderFilterPopupGripBar != null)
            {
                GridPostRenderFilterPopupGripBarEventArgs ev = new
                    GridPostRenderFilterPopupGripBarEventArgs(g, filterPopup, gridColumn, bounds);
                PostRenderFilterPopupGripBar(this, ev);
            }
        }
        #endregion
        #region PreRenderFilterPopupGripBarEvent
        /// 
        /// Handles invocation of PreRenderFilterPopupGripBar events
        /// 
        internal bool DoPreRenderFilterPopupGripBarEvent(
            Graphics g, FilterPopup filterPopup, GridColumn gridColumn, Rectangle bounds)
        {
            if (PreRenderFilterPopupGripBar != null)
            {
                GridPreRenderFilterPopupGripBarEventArgs ev = new
                    GridPreRenderFilterPopupGripBarEventArgs(g, filterPopup, gridColumn, bounds);
                PreRenderFilterPopupGripBar(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region PostRenderFilterRowEvent
        /// 
        /// Handles invocation of PostRenderFilterRow events
        /// 
        internal void DoPostRenderFilterRowEvent(Graphics g,
            GridFilter filter, GridColumn column, RenderParts parts, Rectangle bounds)
        {
            if (PostRenderFilterRow != null)
            {
                GridPanel panel = filter.GridPanel;
                GridPostRenderFilterRowEventArgs ev = new
                    GridPostRenderFilterRowEventArgs(g, panel, filter, column, parts, bounds);
                PostRenderFilterRow(this, ev);
            }
        }
        #endregion
        #region PreRenderFilterRowEvent
        /// 
        /// Handles invocation of PreRenderFilterRowEvent events
        /// 
        internal bool DoPreRenderFilterRowEvent(Graphics g,
            GridFilter filter, GridColumn column, RenderParts parts, Rectangle bounds)
        {
            if (PreRenderFilterRow != null)
            {
                GridPanel panel = filter.GridPanel;
                GridPreRenderFilterRowEventArgs ev = new
                    GridPreRenderFilterRowEventArgs(g, panel, filter, column, parts, bounds);
                PreRenderFilterRow(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region PostRenderGroupBoxConnectorEvent
        /// 
        /// Handles invocation of PostRenderGroupBoxConnector events
        /// 
        internal void DoPostRenderGroupBoxConnectorEvent(Graphics g,
            GridGroupByRow groupByRow, GridGroupBox box1, GridGroupBox box2)
        {
            if (PostRenderGroupBoxConnector != null)
            {
                GridPostRenderGroupBoxConnectorEventArgs ev = new
                    GridPostRenderGroupBoxConnectorEventArgs(g, groupByRow.GridPanel, groupByRow, box1, box2);
                PostRenderGroupBoxConnector(this, ev);
            }
        }
        #endregion
        #region PreRenderGroupBoxConnectorEvent
        /// 
        /// Handles invocation of PreRenderGroupBoxConnector events
        /// 
        internal bool DoPreRenderGroupBoxConnectorEvent(Graphics g,
            GridGroupByRow groupByRow, GridGroupBox box1, GridGroupBox box2)
        {
            if (PreRenderGroupBoxConnector != null)
            {
                GridPreRenderGroupBoxConnectorEventArgs ev = new
                    GridPreRenderGroupBoxConnectorEventArgs(g, groupByRow.GridPanel, groupByRow, box1, box2);
                PreRenderGroupBoxConnector(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region PostRenderGroupBoxEvent
        /// 
        /// Handles invocation of PostRenderGroupBox events
        /// 
        internal void DoPostRenderGroupBoxEvent(Graphics g,
            GridGroupByRow groupByRow, GridGroupBox box, RenderParts parts, Rectangle bounds)
        {
            if (PostRenderGroupBox != null)
            {
                GridPostRenderGroupBoxEventArgs ev = new
                    GridPostRenderGroupBoxEventArgs(g, groupByRow.GridPanel, groupByRow, box, parts, bounds);
                PostRenderGroupBox(this, ev);
            }
        }
        #endregion
        #region PreRenderGroupBoxEvent
        /// 
        /// Handles invocation of PreRenderGroupBox events
        /// 
        internal bool DoPreRenderGroupBoxEvent(Graphics g,
            GridGroupByRow groupByRow, GridGroupBox box, RenderParts parts, Rectangle bounds)
        {
            if (PreRenderGroupBox != null)
            {
                GridPreRenderGroupBoxEventArgs ev = new
                    GridPreRenderGroupBoxEventArgs(g, groupByRow.GridPanel, groupByRow, box, parts, bounds);
                PreRenderGroupBox(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region PostRenderGroupHeaderEvent
        /// 
        /// Handles invocation of PostRenderGroupHeader events
        /// 
        internal void DoPostRenderGroupHeaderEvent(
            Graphics g, GridGroup gridGroup, RenderParts parts, Rectangle bounds)
        {
            if (PostRenderGroupHeader != null)
            {
                GridPanel panel = gridGroup.GridPanel;
                GridPostRenderRowEventArgs ev = new
                    GridPostRenderRowEventArgs(g, panel, gridGroup, parts, bounds);
                PostRenderGroupHeader(this, ev);
            }
        }
        #endregion
        #region PreRenderGroupHeaderEvent
        /// 
        /// Handles invocation of PreRenderGroupHeader events
        /// 
        internal bool DoPreRenderGroupHeaderEvent(
            Graphics g, GridGroup gridGroup, RenderParts parts, Rectangle bounds)
        {
            if (PreRenderGroupHeader != null)
            {
                GridPanel panel = gridGroup.GridPanel;
                GridPreRenderRowEventArgs ev = new
                    GridPreRenderRowEventArgs(g, panel, gridGroup, parts, bounds);
                PreRenderGroupHeader(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region PostRenderPanelRowEvent
        /// 
        /// Handles invocation of PostRenderPanelRow events
        /// 
        internal void DoPostRenderPanelRowEvent(
            Graphics g, GridContainer gridRow, RenderParts parts, Rectangle bounds)
        {
            if (PostRenderPanelRow != null)
            {
                GridPostRenderRowEventArgs ev = new
                    GridPostRenderRowEventArgs(g, gridRow.GridPanel, gridRow, parts, bounds);
                PostRenderPanelRow(this, ev);
            }
        }
        #endregion
        #region PreRenderPanelRowEvent
        /// 
        /// Handles invocation of PreRenderPanelRow events
        /// 
        internal bool DoPreRenderPanelRowEvent(
            Graphics g, GridContainer gridRow, RenderParts parts, Rectangle bounds)
        {
            if (PreRenderPanelRow != null)
            {
                GridPreRenderRowEventArgs ev = new
                    GridPreRenderRowEventArgs(g, gridRow.GridPanel, gridRow, parts, bounds);
                PreRenderPanelRow(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region PostRenderRowEvent
        /// 
        /// Handles invocation of PostRenderRow events
        /// 
        internal void DoPostRenderRowEvent(
            Graphics g, GridRow gridRow, RenderParts parts, Rectangle bounds)
        {
            if (PostRenderRow != null)
            {
                GridPostRenderRowEventArgs ev = new
                    GridPostRenderRowEventArgs(g, gridRow.GridPanel, gridRow, parts, bounds);
                PostRenderRow(this, ev);
            }
        }
        #endregion
        #region PreRenderRowEvent
        /// 
        /// Handles invocation of PreRenderRow events
        /// 
        internal bool DoPreRenderRowEvent(Graphics g, 
            GridRow gridRow, RenderParts parts, Rectangle bounds)
        {
            if (PreRenderRow != null)
            {
                GridPreRenderRowEventArgs ev = new
                    GridPreRenderRowEventArgs(g, gridRow.GridPanel, gridRow, parts, bounds);
                PreRenderRow(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region PostRenderTextRowEvent
        /// 
        /// Handles invocation of PostRenderTextRow events
        /// 
        internal void DoPostRenderTextRowEvent(
            Graphics g, GridTextRow gridTextRow, RenderParts parts, Rectangle bounds)
        {
            if (PostRenderTextRow != null)
            {
                GridPostRenderTextRowEventArgs ev = new
                    GridPostRenderTextRowEventArgs(g, gridTextRow.GridPanel, gridTextRow, parts, bounds);
                PostRenderTextRow(this, ev);
            }
        }
        #endregion
        #region PreRenderTextRowEvent
        /// 
        /// Handles invocation of PreRenderTextRow events
        /// 
        internal bool DoPreRenderTextRowEvent(Graphics g,
            GridTextRow gridTextRow, RenderParts parts, Rectangle bounds)
        {
            if (PreRenderTextRow != null)
            {
                GridPreRenderTextRowEventArgs ev = new
                    GridPreRenderTextRowEventArgs(g, gridTextRow.GridPanel, gridTextRow, parts, bounds);
                PreRenderTextRow(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #endregion
        #region Row events
        #region RowLoadedEvent
        /// 
        /// Handles invocation of RowLoaded events
        /// 
        internal void DoRowLoadedEvent(GridPanel panel, GridRow row)
        {
            if (RowLoaded != null)
            {
                GridRowLoadedEventArgs ev = new
                    GridRowLoadedEventArgs(panel, row);
                RowLoaded(this, ev);
            }
        }
        #endregion
        #region RowActivatedEvent
        /// 
        /// Handles invocation of RowActivated events
        /// 
        internal void DoRowActivatedEvent(
            GridPanel gridPanel, GridContainer oldRow, GridContainer newRow)
        {
            if (RowActivated != null)
            {
                GridRowActivatedEventArgs ev = new
                    GridRowActivatedEventArgs(gridPanel, oldRow, newRow);
                RowActivated(this, ev);
            }
        }
        #endregion
        #region RowActivatingEvent
        /// 
        /// Handles invocation of RowActivating events
        /// 
        internal bool DoRowActivatingEvent(
            GridPanel panel, GridContainer orow, GridContainer nrow)
        {
            if (RowActivating != null)
            {
                GridRowActivatingEventArgs ev = new
                    GridRowActivatingEventArgs(panel, orow, nrow);
                RowActivating(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region RowAddedEvent
        /// 
        /// Handles invocation of RowAdded events
        /// 
        internal void DoRowAddedEvent(GridPanel panel, int index)
        {
            if (RowAdded != null)
            {
                GridRowAddedEventArgs ev = new
                    GridRowAddedEventArgs(panel, index);
                RowAdded(this, ev);
            }
        }
        #endregion
        #region RowAddingEvent
        /// 
        /// Handles invocation of DoRowAdding events
        /// 
        internal bool DoRowAddingEvent(GridPanel panel, ref int index)
        {
            if (RowAdding != null)
            {
                GridRowAddingEventArgs ev = new
                    GridRowAddingEventArgs(panel, index);
                RowAdding(this, ev);
                index = ev.Index;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region RowClickEvent
        /// 
        /// Handles invocation of RowClick events
        /// 
        internal bool DoRowClickEvent(GridRow row, RowArea rowArea, MouseEventArgs e)
        {
            if (RowClick != null)
            {
                GridRowClickEventArgs ev =
                    new GridRowClickEventArgs(row.GridPanel, row, rowArea, e);
                RowClick(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region RowDeletedEvent
        /// 
        /// Handles invocation of RowDeleted events
        /// 
        internal void DoRowDeletedEvent(GridPanel panel, SelectedElements selRows)
        {
            if (RowDeleted != null)
            {
                GridRowDeletedEventArgs ev = new
                    GridRowDeletedEventArgs(panel, selRows);
                RowDeleted(this, ev);
            }
        }
        #endregion
        #region RowDeletingEvent
        /// 
        /// Handles invocation of RowDeleting events
        /// 
        internal bool DoRowDeletingEvent(GridPanel panel, SelectedElements selRows)
        {
            if (RowDeleting != null)
            {
                GridRowDeletingEventArgs ev = new
                    GridRowDeletingEventArgs(panel, selRows);
                RowDeleting(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region RowDoubleClickEvent
        /// 
        /// Handles invocation of RowDoubleClick events
        /// 
        internal bool DoRowDoubleClickEvent(GridRow row, RowArea rowArea, MouseEventArgs e)
        {
            if (RowDoubleClick != null)
            {
                GridRowDoubleClickEventArgs ev = new
                    GridRowDoubleClickEventArgs(row.GridPanel, row, rowArea, e);
                RowDoubleClick(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region RowGetDetailHeightEvent
        /// 
        /// Handles invocation of RowGetDetailHeight events
        /// 
        internal void DoRowGetDetailHeightEvent(GridRow row, 
            GridLayoutInfo layoutInfo, Size sizeNeeded, ref int preHeight, ref int postHeight)
        {
            if (GetDetailRowHeight != null)
            {
                GridGetDetailRowHeightEventArgs ev = new
                    GridGetDetailRowHeightEventArgs(row.GridPanel, row, layoutInfo, sizeNeeded, preHeight, postHeight);
                GetDetailRowHeight(this, ev);
                preHeight = ev.PreDetailHeight;
                postHeight = ev.PostDetailHeight;
            }
        }
        #endregion
        #region RowHeaderClickEvent
        /// 
        /// Handles invocation of RowHeaderClick events
        /// 
        internal void DoRowHeaderClickEvent(
            GridPanel gridPanel, GridContainer row, MouseEventArgs e)
        {
            if (RowHeaderClick != null)
            {
                GridRowHeaderClickEventArgs ev =
                    new GridRowHeaderClickEventArgs(gridPanel, row, e);
                RowHeaderClick(this, ev);
            }
        }
        #endregion
        #region RowHeaderDoubleClickEvent
        /// 
        /// Handles invocation of RowHeaderDoubleClick events
        /// 
        internal bool DoRowHeaderDoubleClickEvent(GridContainer row, MouseEventArgs e)
        {
            if (RowHeaderDoubleClick != null)
            {
                GridRowHeaderDoubleClickEventArgs ev = new
                    GridRowHeaderDoubleClickEventArgs(row.GridPanel, row, e);
                RowHeaderDoubleClick(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region RowHeaderResizedEvent
        /// 
        /// Handles invocation of RowHeaderResized events
        /// 
        internal void DoRowHeaderResizedEvent(GridPanel gridPanel)
        {
            if (RowHeaderResized != null)
            {
                GridEventArgs ev = new GridEventArgs(gridPanel);
                RowHeaderResized(this, ev);
            }
        }
        #endregion
        #region RowInfoClickEvent
        /// 
        /// Handles invocation of RowInfoClick events
        /// 
        internal void DoRowInfoClickEvent(GridRow gridRow, MouseEventArgs e)
        {
            if (RowInfoClick != null)
            {
                GridRowClickEventArgs ev = new
                    GridRowClickEventArgs(gridRow.GridPanel, gridRow, RowArea.InRowInfo, e);
                RowInfoClick(this, ev);
            }
        }
        #endregion
        #region RowInfoEnterEvent
        /// 
        /// Handles invocation of RowInfoEnter events
        /// 
        internal bool DoRowInfoEnterEvent(GridRow gridRow, Point pt)
        {
            if (RowInfoEnter != null)
            {
                GridRowInfoEnterEventArgs ev = new
                    GridRowInfoEnterEventArgs(gridRow.GridPanel, gridRow, pt);
                RowInfoEnter(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region RowInfoLeaveEvent
        /// 
        /// Handles invocation of RowInfoLeave events
        /// 
        internal void DoRowInfoLeaveEvent(GridRow gridRow)
        {
            if (RowInfoLeave != null)
            {
                GridRowInfoLeaveEventArgs ev = new
                    GridRowInfoLeaveEventArgs(gridRow.GridPanel, gridRow);
                RowInfoLeave(this, ev);
            }
        }
        #endregion
        #region RowInfoDoubleClickEvent
        /// 
        /// Handles invocation of RowInfoDoubleClick events
        /// 
        internal void DoRowInfoDoubleClickEvent(GridRow gridRow, MouseEventArgs e)
        {
            if (RowInfoDoubleClick != null)
            {
                GridRowDoubleClickEventArgs ev = new
                    GridRowDoubleClickEventArgs(gridRow.GridPanel, gridRow, RowArea.InRowInfo, e);
                RowInfoDoubleClick(this, ev);
            }
        }
        #endregion
        #region RowMarkedDirtyEvent
        /// 
        /// Handles invocation of RowMarkedDirty events
        /// 
        internal bool DoRowMarkedDirtyEvent(
            GridCell gridCell, IGridCellEditControl editor)
        {
            if (RowMarkedDirty != null)
            {
                GridEditEventArgs ev = new
                    GridEditEventArgs(gridCell.GridPanel, gridCell, editor);
                RowMarkedDirty(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region RowMouseDownEvent
        /// 
        /// Handles invocation of RowMouseDown events
        /// 
        internal void DoRowMouseDownEvent(
            GridRow gridRow, MouseEventArgs args, RowArea area)
        {
            if (RowMouseDown != null)
            {
                GridRowMouseEventArgs ev = new
                    GridRowMouseEventArgs(gridRow.GridPanel, gridRow, args, area);
                RowMouseDown(this, ev);
            }
        }
        #endregion
        #region RowMouseEnterEvent
        /// 
        /// Handles invocation of RowMouseEnter events
        /// 
        internal void DoRowMouseEnterEvent(GridRow gridRow)
        {
            if (RowMouseEnter != null)
            {
                GridRowEventArgs ev = new
                    GridRowEventArgs(gridRow.GridPanel, gridRow);
                RowMouseEnter(this, ev);
            }
        }
        #endregion
        #region RowMouseLeaveEvent
        /// 
        /// Handles invocation of RowMouseLeave events
        /// 
        internal void DoRowMouseLeaveEvent(GridRow gridRow)
        {
            if (RowMouseLeave != null)
            {
                GridRowEventArgs ev = new
                    GridRowEventArgs(gridRow.GridPanel, gridRow);
                RowMouseLeave(this, ev);
            }
        }
        #endregion
        #region RowMouseMoveEvent
        /// 
        /// Handles invocation of RowMouseMove events
        /// 
        internal void DoRowMouseMoveEvent(GridRow gridRow, MouseEventArgs args, RowArea area)
        {
            if (RowMouseMove != null)
            {
                GridRowMouseEventArgs ev = new
                    GridRowMouseEventArgs(gridRow.GridPanel, gridRow, args, area);
                RowMouseMove(this, ev);
            }
        }
        #endregion
        #region RowMouseUpEvent
        /// 
        /// Handles invocation of RowMouseUp events
        /// 
        internal void DoRowMouseUpEvent(GridRow gridRow, MouseEventArgs args, RowArea area)
        {
            if (RowMouseUp != null)
            {
                GridRowMouseEventArgs ev = new
                    GridRowMouseEventArgs(gridRow.GridPanel, gridRow, args, area);
                RowMouseUp(this, ev);
            }
        }
        #endregion
        #region RowMovedEvent
        /// 
        /// Handles invocation of RowMoved events
        /// 
        internal void DoRowMovedEvent(
            GridPanel gridPanel, GridContainer gridContainer, GridContainer gridRow)
        {
            if (RowMoved != null)
            {
                GridRowMovedEventArgs ev = new
                    GridRowMovedEventArgs(gridPanel, gridContainer, gridRow);
                RowMoved(this, ev);
            }
        }
        #endregion
        #region RowMovingEvent
        /// 
        /// Handles invocation of RowMoving events
        /// 
        internal bool DoRowMovingEvent(GridRow gridRow,
            GridContainer srcCont, int srcIndex, ref GridContainer destCont, ref int destIndex)
        {
            if (RowMoving != null)
            {
                GridRowMovingEventArgs ev = new GridRowMovingEventArgs(
                    gridRow.GridPanel, gridRow, srcCont, srcIndex, destCont, destIndex);
                RowMoving(this, ev);
                destIndex = ev.DestIndex;
                destCont = ev.DestContainer;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region RowResizedEvent
        /// 
        /// Handles invocation of RowResized events
        /// 
        internal void DoRowResizedEvent(GridPanel gridPanel, GridContainer gridRow)
        {
            if (RowResized != null)
            {
                GridRowEventArgs ev = new
                    GridRowEventArgs(gridPanel, gridRow);
                RowResized(this, ev);
            }
        }
        #endregion
        #region RowRestoredEvent
        /// 
        /// Handles invocation of RowRestored events
        /// 
        internal void DoRowRestoredEvent(GridPanel panel, SelectedElements selRows)
        {
            if (RowRestored != null)
            {
                GridRowRestoredEventArgs ev = new
                    GridRowRestoredEventArgs(panel, selRows);
                RowRestored(this, ev);
            }
        }
        #endregion
        #region RowRestoringEvent
        /// 
        /// Handles invocation of RowRestoring events
        /// 
        internal bool DoRowRestoringEvent(GridPanel panel, SelectedElements selRows)
        {
            if (RowRestoring != null)
            {
                GridRowRestoringEventArgs ev = new
                    GridRowRestoringEventArgs(panel, selRows);
                RowRestoring(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region RowSetDefaultValuesEvent
        /// 
        /// Handles invocation of RowSetDefaultValues events
        /// 
        internal void DoRowSetDefaultValuesEvent(
            GridPanel panel, GridRow row, NewRowContext context)
        {
            if (RowSetDefaultValues != null)
            {
                GridRowSetDefaultValuesEventArgs ev = new
                    GridRowSetDefaultValuesEventArgs(panel, row, context);
                bool loading = row.Loading;
                row.Loading = true;
                try
                {
                    RowSetDefaultValues(this, ev);
                }
                finally
                {
                    row.Loading = loading;
                }
            }
        }
        #endregion
        #region RowsGroupedEvent
        /// 
        /// Handles invocation of RowsGroupedEvent events
        /// 
        internal void DoRowsGroupedEvent(GridPanel panel)
        {
            if (RowsGrouped != null)
            {
                GridEventArgs ev = new GridEventArgs(panel);
                RowsGrouped(this, ev);
            }
        }
        #endregion
        #region RowsGroupingEvent
        /// 
        /// Handles invocation of RowsGrouping events
        /// 
        internal bool DoRowsGroupingEvent(GridPanel panel)
        {
            if (RowsGrouping != null)
            {
                GridCancelEventArgs ev = new GridCancelEventArgs(panel);
                RowsGrouping(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region RowsPurgingEvent
        /// 
        /// Handles invocation of RowsPurging events
        /// 
        internal bool DoRowsPurgingEvent(GridContainer row, ref bool includeNestedRows)
        {
            if (RowsPurging != null)
            {
                GridRowsPurgingEventArgs ev = new
                    GridRowsPurgingEventArgs(row.GridPanel, row, includeNestedRows);
                RowsPurging(this, ev);
                includeNestedRows = ev.IncludeNestedRows;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region RowsPurgedEvent
        /// 
        /// Handles invocation of RowsPurged events
        /// 
        internal void DoRowsPurgedEvent(GridContainer row)
        {
            if (RowsPurged != null)
            {
                GridRowEventArgs ev = new GridRowEventArgs(row.GridPanel, row);
                RowsPurged(this, ev);
            }
        }
        #endregion
        
        #region RowsSortingEvent
        /// 
        /// Handles invocation of RowsSorting events
        /// 
        internal bool DoRowsSortingEvent(GridPanel panel)
        {
            if (RowsSorting != null)
            {
                GridCancelEventArgs ev = new GridCancelEventArgs(panel);
                RowsSorting(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region RowsSortedEvent
        /// 
        /// Handles invocation of RowsSortedEvent events
        /// 
        internal void DoRowsSortedEvent(GridPanel panel)
        {
            if (RowsSorted != null)
            {
                GridEventArgs ev = new GridEventArgs(panel);
                RowsSorted(this, ev);
            }
        }
        #endregion
        
        #region RowValidatingEvent
        /// 
        /// Handles invocation of RowValidating events
        /// 
        internal bool DoRowValidatingEvent(GridRow gridRow)
        {
            if (RowValidating != null)
            {
                GridRowValidatingEventArgs ev = new
                    GridRowValidatingEventArgs(gridRow.GridPanel, gridRow);
                RowValidating(this, ev);
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region RowValidatedEvent
        /// 
        /// Handles invocation of RowValidated events
        /// 
        internal void DoRowValidatedEvent(GridRow gridRow)
        {
            if (RowValidated != null)
            {
                GridRowValidatedEventArgs ev = new
                    GridRowValidatedEventArgs(gridRow.GridPanel, gridRow);
                RowValidated(this, ev);
            }
        }
        #endregion
        #endregion
        #region ScrollEvent
        /// 
        /// Handles invocation of Scroll events
        /// 
        internal void DoScrollEvent(GridPanel gridPanel,
            ScrollEventArgs args, ScrollBarAdv sbar)
        {
            if (Scroll != null)
            {
                GridScrollEventArgs ev = new
                    GridScrollEventArgs(gridPanel, args);
                Scroll(this, ev);
            }
            if (args.Type == ScrollEventType.EndScroll)
            {
                if (args.NewValue == 0)
                    DoScrollMinEvent(gridPanel, args);
                else if (args.NewValue + sbar.LargeChange >= sbar.Maximum)
                    DoScrollMaxEvent(gridPanel, args);
            }
        }
        #endregion
        #region ScrollMinEvent
        /// 
        /// Handles invocation of ScrollMin events
        /// 
        internal void DoScrollMinEvent(GridPanel gridPanel, ScrollEventArgs args)
        {
            if (ScrollMin != null)
            {
                GridScrollEventArgs ev = new
                    GridScrollEventArgs(gridPanel, args);
                ScrollMin(this, ev);
            }
        }
        #endregion
        #region ScrollMaxEvent
        /// 
        /// Handles invocation of ScrollMax events
        /// 
        internal void DoScrollMaxEvent(GridPanel gridPanel, ScrollEventArgs args)
        {
            if (ScrollMax != null)
            {
                GridScrollEventArgs ev = new
                    GridScrollEventArgs(gridPanel, args);
                ScrollMax(this, ev);
            }
        }
        #endregion
        #region SelectionChanged Event
        /// 
        /// Handles invocation of SelectionChanged events
        /// 
        internal void DoSelectionChangedEvent(GridPanel gridPanel)
        {
            if (SelectionChanged != null)
            {
                GridEventArgs ev = new
                    GridEventArgs(gridPanel);
                SelectionChanged(this, ev);
            }
        }
        #endregion
        #region SelectionChanging Event
        /// 
        /// Handles invocation of SelectionChanging events
        /// 
        internal bool DoSelectionChangingEvent(GridPanel gridPanel, 
            ref SelectedElements selectedElements, int index, int count, bool selected)
        {
            if (SelectionChanging != null)
            {
                GridSelectionChangingEventArgs ev = new
                    GridSelectionChangingEventArgs(gridPanel, selectedElements, index, count, selected);
                SelectionChanging(this, ev);
                selectedElements = ev.SelectedElements;
                return (ev.Cancel);
            }
            return (false);
        }
        #endregion
        #region SortChanged Event
        /// 
        /// Handles invocation of SortChanged events
        /// 
        internal void DoSortChangedEvent(GridPanel gridPanel)
        {
            if (SortChanged != null)
            {
                GridEventArgs ev = new
                    GridEventArgs(gridPanel);
                SortChanged(this, ev);
            }
        }
        #endregion
        #region TextRowClickEvent
        /// 
        /// Handles invocation of TextRowClick events
        /// 
        internal void DoTextRowClickEvent(GridTextRow textRow, MouseEventArgs e)
        {
            if (TextRowClick != null)
            {
                GridTextRowEventArgs ev = new
                    GridTextRowEventArgs(textRow.GridPanel, textRow, e);
                TextRowClick(this, ev);
            }
        }
        #endregion
        #region TextRowHeaderClickEvent
        /// 
        /// Handles invocation of TextRowHeaderClick events
        /// 
        internal void DoTextRowHeaderClickEvent(GridTextRow textRow, MouseEventArgs e)
        {
            if (TextRowHeaderClick != null)
            {
                GridTextRowEventArgs ev = new
                    GridTextRowEventArgs(textRow.GridPanel, textRow, e);
                TextRowHeaderClick(this, ev);
            }
        }
        #endregion
        #region TextRowMarkupLinkClickEvent
        /// 
        /// Handles invocation of TextRowMarkupLinkClick events
        /// 
        internal void DoTextRowMarkupLinkClickEvent(
            GridTextRow textRow, HyperLink hyperLink)
        {
            if (TextRowMarkupLinkClick != null)
            {
                GridTextRowMarkupLinkClickEventArgs ev = new GridTextRowMarkupLinkClickEventArgs(
                    textRow.GridPanel, textRow, hyperLink.Name, hyperLink.HRef);
                TextRowMarkupLinkClick(this, ev);
            }
        }
        #endregion
        #region UpdateCellDisplayRangesEvent
        /// 
        /// Handles invocation of UpdateCellDisplayRanges events
        /// 
        internal void DoUpdateCellDisplayRangesEvent(
            GridContainer gridContainer, DisplayRange displayRange, ref List cellRanges)
        {
            if (UpdateCellDisplayRanges != null)
            {
                GridUpdateCellDisplayRangesEventArgs ev = new
                    GridUpdateCellDisplayRangesEventArgs(gridContainer.GridPanel, gridContainer, displayRange, cellRanges);
                UpdateCellDisplayRanges(this, ev);
                cellRanges = ev.CellRanges;
            }
        }
        #endregion
        #region Virtual Row events
        #region DoLoadVirtualRowEvent
        /// 
        /// Handles invocation of LoadVirtualRow events
        /// 
        internal void DoLoadVirtualRowEvent(GridPanel panel, GridRow row)
        {
            if (LoadVirtualRow != null)
            {
                GridVirtualRowEventArgs ev = new
                    GridVirtualRowEventArgs(panel, row, row.Index);
                LoadVirtualRow(this, ev);
            }
        }
        #endregion
        #region DoVirtualRowLoadedEvent
        /// 
        /// Handles invocation of VirtualRowed events
        /// 
        internal void DoVirtualRowLoadedEvent(GridPanel panel, GridRow row)
        {
            if (VirtualRowLoaded != null)
            {
                GridVirtualRowEventArgs ev = new
                    GridVirtualRowEventArgs(panel, row, row.Index);
                VirtualRowLoaded(this, ev);
            }
        }
        #endregion
        #region DoStoreVirtualRowEvent
        /// 
        /// Handles invocation of StoreVirtualRow events
        /// 
        internal void DoStoreVirtualRowEvent(GridPanel gridPanel, GridRow gridRow)
        {
            if (StoreVirtualRow != null)
            {
                GridVirtualRowEventArgs ev = new
                    GridVirtualRowEventArgs(gridPanel, gridRow, gridRow.Index);
                StoreVirtualRow(this, ev);
            }
        }
        #endregion
        #endregion
        #endregion
        #region GetElementAt
        ///
        /// Gets the GridElement at the given coordinates
        ///
        ///
        ///
        public GridElement GetElementAt(Point pt)
        {
            return (GetElementAt(pt.X, pt.Y));
        }
        ///
        /// Gets the GridElement at the given coordinates
        ///
        ///
        ///
        ///
        public GridElement GetElementAt(int x, int y)
        {
            GridElement item = _PrimaryGrid.GetElementAt(x, y);
            if (item == null)
                return (_PrimaryGrid);
            while (item is GridContainer)
            {
                GridElement subItem = ((GridContainer) item).GetElementAt(x, y);
                if (subItem == null)
                    break;
                item = subItem;
            }
            return (item);
        }
        #endregion
        #region FindGridPanel
        ///
        /// Finds the defined GridPanel with the given Name.
        /// Nested GridPanels will not be searched.
        ///
        ///GridPanel or null
        public GridPanel FindGridPanel(string name)
        {
            return (FindGridPanel(name, false));
        }
        ///
        /// Finds the defined GridPanel with the given Name.
        /// If 'includeNested' is true, then nested GridPanels
        /// will also be searched.
        ///
        ///
        public GridPanel FindGridPanel(string name, bool includeNested)
        {
            if (_PrimaryGrid != null)
            {
                if (_PrimaryGrid.Name != null && _PrimaryGrid.Name.Equals(name) == true)
                    return (_PrimaryGrid);
                return (_PrimaryGrid.FindGridPanel(name, includeNested));
            }
            return (null);
        }
        #endregion
        #region GetSelectedElements
        ///
        /// This routine returns a SelectedElementCollection,
        /// containing a list of the currently selected elements.
        ///
        ///SelectedElementCollection
        public SelectedElementCollection GetSelectedElements()
        {
            SelectedElementCollection items =
                _PrimaryGrid.GetSelectedElements();
            GetSelectedElements(_PrimaryGrid, items);
            return (items);
        }
        private void GetSelectedElements(
            GridContainer container, SelectedElementCollection items)
        {
            foreach (GridElement item in container.Rows)
            {
                if (item.Visible == true)
                {
                    GridContainer citem = item as GridContainer;
                    if (citem != null)
                    {
                        GridPanel panel = citem as GridPanel;
                        if (panel != null)
                        {
                            if (panel.VirtualMode == false)
                                panel.GetSelectedElements(items);
                        }
                        if (citem.Rows.Count > 0)
                            GetSelectedElements(citem, items);
                    }
                }
            }
        }
        #endregion
        #region GetSelectedRows
        ///
        /// This routine returns a SelectedElementCollection,
        /// containing a list of the currently selected rows.
        ///
        ///SelectedElementCollection
        public SelectedElementCollection GetSelectedRows()
        {
            SelectedElementCollection items =
                _PrimaryGrid.GetSelectedRows();             
            
            GetSelectedRows(_PrimaryGrid, items);
            return (items);
        }
        private void GetSelectedRows(
            GridContainer container, ICollection items)
        {
            foreach (GridElement item in container.Rows)
            {
                if (item.Visible == true)
                {
                    GridContainer citem = item as GridContainer;
                    if (citem != null)
                    {
                        GridPanel panel = citem as GridPanel;
                        if (panel != null)
                        {
                            if (panel.VirtualMode == false)
                                panel.GetSelectedRows(items);
                        }
                        if (citem.Rows.Count > 0)
                            GetSelectedRows(citem, items);
                    }
                }
            }
        }
        #endregion
        #region GetSelectedColumns
        ///
        /// This routine returns a SelectedElementCollection,
        /// containing a list of the currently selected columns.
        ///
        ///SelectedElementCollection
        public SelectedElementCollection GetSelectedColumns()
        {
            SelectedElementCollection items = 
                _PrimaryGrid.GetSelectedColumns();
            GetSelectedColumns(_PrimaryGrid, items);
            return (items);
        }
        private void GetSelectedColumns(GridContainer container, ICollection items)
        {
            foreach (GridElement item in container.Rows)
            {
                if (item.Visible == true)
                {
                    GridContainer citem = item as GridContainer;
                    if (citem != null)
                    {
                        GridPanel panel = citem as GridPanel;
                        if (panel != null)
                        {
                            if (panel.VirtualMode == false)
                                panel.GetSelectedColumns(items);
                        }
                        if (citem.Rows.Count > 0)
                            GetSelectedColumns(citem, items);
                    }
                }
            }
        }
        #endregion
        #region GetSelectedCells
        ///
        /// This routine returns a SelectedElementCollection,
        /// containing a list of the currently selected cells.
        ///
        ///SelectedElementCollection
        public SelectedElementCollection GetSelectedCells()
        {
            SelectedElementCollection items =
                _PrimaryGrid.GetSelectedCells();
            GetSelectedCells(_PrimaryGrid, items);
            return (items);
        }
        private void GetSelectedCells(GridContainer container, SelectedElementCollection items)
        {
            foreach (GridElement item in container.Rows)
            {
                if (item.Visible == true)
                {
                    GridContainer citem = item as GridContainer;
                    if (citem != null)
                    {
                        GridPanel panel = citem as GridPanel;
                        if (panel != null)
                        {
                            if (panel.VirtualMode == false)
                                panel.GetSelectedCells(items);
                        }
                        if (citem.Rows.Count > 0)
                            GetSelectedCells(citem, items);
                    }
                }
            }
        }
        #endregion
        #region GetCell
        ///
        /// Gets the GridCell for the given
        /// row and column index of the PrimaryGrid
        ///
        ///
        ///
        ///GridCell, or null if not a valid cell
        public GridCell GetCell(int rowIndex, int columnIndex)
        {
            return (PrimaryGrid.GetCell(rowIndex, columnIndex));
        }
        ///
        /// Gets the GridCell for the given
        /// row and column index of the given GridPanel
        ///
        ///
        ///
        ///
        ///GridCell, or null if not a valid cell
        public GridCell GetCell(GridPanel panel, int rowIndex, int columnIndex)
        {
            return (panel.GetCell(rowIndex, columnIndex));
        }
        #endregion
        #region AutoScrolling support
        #region EnableAutoScrolling
        internal void EnableAutoScrolling(
            AutoScrollEnable enable, Rectangle scrollRect)
        {
            if (Focused == true)
            {
                _AutoScrollEnable = enable;
                if ((_HScrollBar != null && _HScrollBar.Visible == true) ||
                    (_VScrollBar != null && _VScrollBar.Visible == true))
                {
                    _ScrollRect = scrollRect;
                    if (_AutoScrollTimer == null)
                    {
                        _AutoScrollTimer = new Timer();
                        _AutoScrollTimer.Interval = 10;
                        _AutoScrollTimer.Tick += AutoScrollTimerTick;
                        _AutoScrollTimer.Start();
                    }
                }
            }
        }
        #endregion
        #region DisableAutoScrolling
        internal void DisableAutoScrolling()
        {
            if (_AutoScrollTimer != null)
            {
                _AutoScrollTimer.Stop();
                _AutoScrollTimer.Tick -= AutoScrollTimerTick;
                _AutoScrollTimer = null;
            }
        }
        #endregion
        #region AutoScrollTimerTick
        private void AutoScrollTimerTick(object sender, EventArgs e)
        {
            Point pt = PointToClient(Cursor.Position);
            Rectangle t = _ScrollRect;
            if ((_AutoScrollEnable & AutoScrollEnable.Horizontal) == AutoScrollEnable.Horizontal &&
                (_HScrollBar != null && _HScrollBar.Visible == true))
            {
                int dx = (pt.X < t.X)
                    ? ScrollAmount(pt.X - t.X)
                    : (pt.X >= t.Right) ? ScrollAmount(pt.X - t.Right) : 0;
                SetHScrollValue(_HScrollOffset + dx);
            }
            if ((_AutoScrollEnable & AutoScrollEnable.Vertical) == AutoScrollEnable.Vertical &&
                (_VScrollBar != null && _VScrollBar.Visible == true))
            {
                int dy = (pt.Y < t.Top)
                    ? ScrollAmount(pt.Y - t.Top)
                    : (pt.Y >= t.Bottom) ? ScrollAmount(pt.Y - t.Bottom) : 0;
                SetVScrollValue(_VScrollOffset + dy);
            }
        }
        #endregion
        #region ScrollAmount
        private int ScrollAmount(int delta)
        {
            int n = Math.Abs(delta);
            int amt = 1 << ((n / 16) + 1);
            return (delta < 0 ? -amt : amt);
        }
        #endregion
        #endregion
        #region PostInternalMouseMove
        internal void PostInternalMouseMove()
        {
            _PostMouseMove = true;
        }
        #endregion
        #region UpdateInternalMouseMove
        internal void UpdateInternalMouseMove()
        {
            if (_PostMouseMove == true)
            {
                _PostMouseMove = false;
                Cursor.Position = Cursor.Position;
            }
        }
        #endregion
        #region Cursor
        /// 
        /// Cursor
        /// 
        public override Cursor Cursor
        {
            get { return base.Cursor; }
            set
            {
                base.Cursor = value;
                if (SetGridCursor == true)
                    GridCursor = value;
                else
                    _DefaultCursor = value;
            }
        }
        #endregion
        #region OnGotFocus
        /// 
        /// OnGotFocus
        /// 
        /// 
        protected override void OnGotFocus(EventArgs e)
        {
            base.OnGotFocus(e);
            if (_ActiveRow != null)
                _ActiveRow.InvalidateRender();
        }
        #endregion
        #region OnLostFocus
        /// 
        /// OnLostFocus
        /// 
        /// 
        protected override void OnLostFocus(EventArgs e)
        {
            CancelCapture();
            if (_ActiveRow != null)
                _ActiveRow.InvalidateRender();
            base.OnLostFocus(e);
        }
        #endregion
        #region OnResize
        /// 
        /// OnResize
        /// 
        /// 
        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);
            if (_PrimaryGrid != null)
            {
                _PrimaryGrid.InvalidateLayout();
                _PrimaryGrid.ContainerBounds = ClientRectangle;
            }
        }
        #endregion
        #region OnValidating
        /// 
        /// OnValidating
        /// 
        /// 
        protected override void OnValidating(CancelEventArgs e)
        {
            if (_ActiveRow != null && _ActiveRow.GridPanel != null)
            {
                if (_ActiveRow.GridPanel.SetActiveRow(null, false) == false)
                {
                    e.Cancel = true;
                    return;
                }
            }
            base.OnValidating(e);
        }
        #endregion
        #region Update support
        ///
        /// Calling the BeginUpdate routine informs the grid
        /// that an extended update phase has begun. The SuperGrid
        /// will suspend all layout calculations and display updates
        /// until the corresponding EndUpdate routine is called.
        /// 
        /// BeginUpdate / EndUpdate can be nested and must be
        /// called in pairs – every BeginUpdate must have a
        /// matching EndUpdate call.
        ///
        public void BeginUpdate()
        {
            _BeginUpdateCount++;
        }
        ///
        /// Calling the EndUpdate routine informs the grid
        /// that an extended update phase has ended.
        /// 
        /// BeginUpdate / EndUpdate can be nested and must be
        /// called in pairs – every EndUpdate must have a
        /// matching BeginUpdate call.
        ///
        public void EndUpdate()
        {
            if (_BeginUpdateCount > 0)
            {
                if (--_BeginUpdateCount == 0)
                    _PrimaryGrid.InvalidateMerge();
            }
        }
        #endregion
        #region INotifyPropertyChanged Members
        /// 
        /// Occurs when property value has changed.
        /// 
        public event PropertyChangedEventHandler PropertyChanged;
        /// 
        /// Raises the PropertyChanged event.
        /// 
        /// Event arguments
        protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
                handler(this, e);
        }
        /// 
        /// Default PropertyChanged processing
        /// 
        /// 
        protected void OnPropertyChanged(string s)
        {
            if (PropertyChanged != null)
                OnPropertyChanged(new PropertyChangedEventArgs(s));
        }
        #endregion
        #region IMessageFilter Members
        /// 
        /// PreFilterMessage
        /// 
        /// 
        /// 
        public bool PreFilterMessage(ref Message m)
        {
            if (DesignMode == true || Enabled == false)
                return (false);
            if (ContainsFocus == true || m.Msg == WmMouseDown || m.Msg == WmMouseWheel)
            {
                switch (m.Msg)
                {
                    case WmKeyDown:
                        TrackModifiers();
                        if (_KeyPressSent == true)
                        {
                            _KeyPressSent = false;
                        }
                        else
                        {
                            _IsInputKey = false;
                            Keys keyData = (Keys) (int) m.WParam & Keys.KeyCode;
                            if (DoGridPreviewKeyDown(keyData) == true)
                                return (true);
                            keyData |= ModifierKeys;
                            _LastKeyDown = keyData;
                            if (_ActiveEditor != null && _EditorCell != null)
                                return (ProcessInEditKeyDown(keyData));
                            if (_ActiveFilterPanel != null)
                                return (ProcessInFilterEditKeyDown(keyData));
                        }
                        return (false);
                    case WmKeyUp:
                        TrackModifiers();
                        UpdateInternalMouseMove();
                        break;
                    case WmMouseDown:
                        if (IsOverNonModalEditorWindow() == true)
                        {
                            Focus();
                            ExtendNonModalSelection();
                        }
                        break;
                    case WmMouseWheel:
                        if (CanProcessMouseWheel() == true)
                        {
                            if ((LoWord(m.WParam) & 0x8) == 0)
                            {
                                if (_VScrollBar.Visible == true)
                                {
                                    Rectangle r = DisplayRectangle;
                                    r.Location = PointToScreen(r.Location);
                                    Point mousePos = new Point(LoWord(m.LParam), HiWord(m.LParam));
                                    if (r.Contains(mousePos))
                                    {
                                        short detents = (short)HiWord(m.WParam);
                                        int delta = (detents / SystemInformation.MouseWheelScrollDelta);
                                        MouseWheelHandler(delta);
                                        return (true);
                                    }
                                }
                            }
                        }
                        break;
                }
            }
            if (_ActiveNonModalEditor != null)
            {
                switch (m.Msg)
                {
                    case WmMouseMove:
                        if (IsOverNonModalEditorWindow() == false)
                        {
                            if (_ActiveNonModalEditor.CanInterrupt == true)
                                DeactivateNonModalEditor();
                        }
                        break;
                }
            }
            return (false);
        }
        #region CanProcessMouseWheel
        [System.Runtime.InteropServices.DllImport("user32.dll")]
        private static extern IntPtr WindowFromPoint(Point pnt);
        private bool CanProcessMouseWheel()
        {
            IntPtr hWnd = WindowFromPoint(Control.MousePosition);
            if (hWnd != IntPtr.Zero)
            {
                Control ctl = Control.FromHandle(hWnd);
                if (ctl == null || ctl.FindForm() != FindForm())
                    return (false);
            }
            if (_ActiveEditor == null && _ActiveFilterPanel == null)
            {
                if (_ActiveNonModalEditor != null)
                {
                    if (_ActiveNonModalEditor.CanInterrupt == false)
                        return (false);
                }
                return (true);
            }
            return (false);
        }
        #endregion
        #region HiWord / LoWord
        private int LoWord(int n)
        {
            return (short)(n & 0xffff);
        }
        private int HiWord(int n)
        {
            return (n >> 0x10);
        }
        private int LoWord(IntPtr n)
        {
            return LoWord((int)((long)n));
        }
        private int HiWord(IntPtr n)
        {
            return HiWord((int)((long)n));
        }
        #endregion
        #region TrackModifiers
        private void TrackModifiers()
        {
            if ((_LastModifierKeys & Keys.Control) != (ModifierKeys & Keys.Control))
            {
                _LastModifierKeys = ModifierKeys;
                Cursor.Position = Cursor.Position;
            }
        }
        #endregion
        #region IsOverNonModalEditorWindow
        private bool IsOverNonModalEditorWindow()
        {
            if (_ActiveNonModalEditor != null)
            {
                Point pt = MousePosition;
                if (NonModalEditorCell.GridColumn != null)
                {
                    Rectangle r = NonModalEditorCell.CellBounds;
                    r.Location = PointToScreen(r.Location);
                    bool hit = r.Contains(pt);
                    return (hit);
                }
            }
            return (false);
        }
        #endregion
        #endregion
        #region WndProc
        /// 
        /// WndProc
        /// 
        /// 
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case WmSetFocus:
                    if (_PopupControl != null)
                        _PopupControl.Hide();
                    break;
            }
            base.WndProc(ref m);
        }
        #endregion
        #region ActivateNonModalEditor
        internal void ActivateNonModalEditor(
            IGridCellEditControl editor, GridCell cell)
        {
            ActiveNonModalEditor = editor;
            NonModalEditorCell = cell;
        }
        #endregion
        #region DeactivateNonModalEditor
        ///
        /// Deactivates any active NonModal editor.
        ///
        public void DeactivateNonModalEditor()
        {
            if (_ActiveNonModalEditor != null)
            {
                _ActiveNonModalEditor.EditorPanel.Hide();
                _ActiveNonModalEditor.OnCellMouseLeave(EventArgs.Empty);
                if (_NonModalEditorCell.GridPanel != null)
                {
                    _NonModalEditorCell.GridPanel.InternalMouseMove(new MouseEventArgs(MouseButtons.None, 0, -1, -1, 0));
                    if (_NonModalEditorCell.GridPanel.SelectionGranularity != SelectionGranularity.Cell)
                        _NonModalEditorCell.GridRow.InvalidateRender();
                    else
                        _NonModalEditorCell.InvalidateRender();
                }
                if (_NonModalEditorCell.SuperGrid.ContainsFocus == true)
                    Focus();
                _ActiveNonModalEditor = null;
                _NonModalEditorCell = null;
            }
        }
        #region ExtendNonModalSelection
        ///
        /// ExtendNonModalSelection
        ///
        internal void ExtendNonModalSelection()
        {
            GridPanel panel = _NonModalEditorCell.GridPanel;
            if (panel != null)
            {
                GridCell cell = _NonModalEditorCell;
                GridRow row = cell.GridRow;
                panel.SetActiveRow(row, true);
                switch (panel.SelectionGranularity)
                {
                    case SelectionGranularity.Row:
                    case SelectionGranularity.RowWithCellHighlight:
                        row.ExtendSelection(panel);
                        break;
                    case SelectionGranularity.Cell:
                        cell.ExtendSelection(panel);
                        if (_ActiveNonModalEditor != null)
                            cell.PositionEditPanel(_ActiveNonModalEditor);
                        break;
                }
            }
        }
        #endregion
        #endregion
        #region UpdateStyleCount
        internal int UpdateStyleCount()
        {
            StyleUpdateCount++;
            return (StyleUpdateCount);
        }
        #endregion
        #region CancelCapture
        ///
        /// Cancels any in-progress operations that
        /// may have the mouse captured (and releases the capture).
        ///
        public void CancelCapture()
        {
            if (_CapturedItem != null)
                _CapturedItem.CancelCapture();
        }
        #endregion
        #region Dispose
        /// 
        /// Dispose
        /// 
        /// 
        protected override void Dispose(bool disposing)
        {
            EndWorkers();
            Application.RemoveMessageFilter(this);
            StyleManager.Unregister(this);
            PrimaryGrid.Dispose();
            if (_VScrollBar != null)
            {
                _VScrollBar.Scroll -= VScrollBarScroll;
                _VScrollBar.MouseEnter -= ScrollBarMouseEnter;
                _VScrollBar.SizeChanged -= ScrollBarSizeChanged;
            }
            if (_HScrollBar != null)
            {
                _HScrollBar.Scroll -= HScrollBarScroll;
                _HScrollBar.MouseEnter -= ScrollBarMouseEnter;
                _HScrollBar.SizeChanged -= ScrollBarSizeChanged;
            }
            base.Dispose(disposing);
        }
        private int _WorkerCount;
        internal bool DisposeRequested;
        private List _Threads = new List();
        internal void BeginWorker(Thread thread)
        {
            Interlocked.Increment(ref _WorkerCount);
            _Threads.Add(thread);
        }
        internal void EndWorker(Thread thread)
        {
            Interlocked.Decrement(ref _WorkerCount);
            _Threads.Remove(thread);
        }
        private void EndWorkers()
        {
            DisposeRequested = true;
            foreach (Thread th in _Threads)
                th.Abort();
            for (int i = 0; _WorkerCount > 0 && i < 500; i++)
            {
                Thread.Sleep(10);
                Application.DoEvents();
            }
        }
        #endregion
        #region Licensing
#if !TRIAL
        private string _LicenseKey = "";
        ///
        /// LicenseKey
        ///
        [Browsable(false), DefaultValue("")]
        public string LicenseKey
        {
            get { return _LicenseKey; }
            set
            {
                if (NativeFunctions.ValidateLicenseKey(value))
                    return;
                _LicenseKey = (!NativeFunctions.CheckLicenseKey(value) ? "9dsjkhds7" : value);
            }
        }
#endif
        #endregion
        #region Touch Handling
        private Touch.TouchHandler _TouchHandler;
        private bool _TouchEnabled = true;
        /// 
        /// Indicates whether touch support for scrolling is enabled.
        /// 
        [DefaultValue(true), Category("Behavior")]
        [Description("Indicates whether touch support for scrolling is enabled.")]
        public bool TouchEnabled
        {
            get { return _TouchEnabled; }
            set
            {
                if (value != _TouchEnabled)
                {
                    bool oldValue = _TouchEnabled;
                    _TouchEnabled = value;
                    OnTouchEnabledChanged(oldValue, value);
                }
            }
        }
        /// 
        /// Called when TouchEnabled property has changed.
        /// 
        /// Old property value
        /// New property value
        protected virtual void OnTouchEnabledChanged(bool oldValue, bool newValue)
        {
            //OnPropertyChanged(new PropertyChangedEventArgs("TouchEnabled"));
        }
        //private int TriggerPageChangeOffset
        //{
        //    get { return 32; }
        //}
        private int MaximumReversePageOffset
        {
            get { return 0; } //Math.Min(32, this.Width / 6);
        }
        private bool _TouchDrag;
        private Point _TouchStartLocation = Point.Empty;
        private Point _TouchStartScrollPosition = Point.Empty;
        private Rectangle _TouchInnerBounds = Rectangle.Empty;
        private void TouchHandlerPanBegin(object sender, Touch.GestureEventArgs e)
        {
            if (_TouchEnabled)
            {
                _TouchInnerBounds = SViewRect;
                _TouchStartLocation = e.Location;
                _TouchStartScrollPosition = AutoScrollPosition;
                _TouchDrag = true;
                e.Handled = true;
            }
        }
        private void TouchHandlerPanEnd(object sender, Touch.GestureEventArgs e)
        {
            if (_TouchDrag)
            {
                EndTouchPan();
                e.Handled = true;
            }
        }
        private Point AutoScrollPosition
        {
            get { return new Point(-_HScrollOffset, -_VScrollOffset); }
            set
            {
                if (value.X != _HScrollOffset)
                    SetHScrollValue(-value.X);
                if (value.Y != _VScrollOffset)
                    SetVScrollValue(-value.Y);
            }
        }
        private void EndTouchPan()
        {
            _TouchDrag = false;
            Point autoScrollPosition = AutoScrollPosition;
            Size autoScrollMinSize = new Size(_HScrollBar.Maximum, _VScrollBar.Maximum);
            if (autoScrollMinSize.Width > _TouchInnerBounds.Width)
            {
                if (autoScrollMinSize.Width - _TouchInnerBounds.Width < -autoScrollPosition.X)
                    autoScrollPosition = new Point(autoScrollMinSize.Width - _TouchInnerBounds.Width, autoScrollPosition.Y);
                else if (-autoScrollPosition.X < 0)
                    autoScrollPosition = new Point(0, autoScrollPosition.Y);
            }
            if (autoScrollMinSize.Height > _TouchInnerBounds.Height)
            {
                if (autoScrollMinSize.Height - _TouchInnerBounds.Height < -autoScrollPosition.Y)
                    autoScrollPosition = new Point(autoScrollPosition.X, autoScrollMinSize.Height - _TouchInnerBounds.Height);
                else if (-autoScrollPosition.Y < 0)
                    autoScrollPosition = new Point(autoScrollPosition.X, 0);
            }
            if (AutoScrollPosition != autoScrollPosition)
                AutoScrollPosition = autoScrollPosition;
            //ApplyScrollChange();
        }
        private void TouchHandlerPan(object sender, Touch.GestureEventArgs e)
        {
            if (_TouchDrag)
            {
                Point autoScrollPosition = AutoScrollPosition;
                Size autoScrollMinSize = new Size(_HScrollBar.Maximum, _VScrollBar.Maximum);
                int offset = (e.Location.X - _TouchStartLocation.X);
                int offsetChange = offset + _TouchStartScrollPosition.X;
                bool overflowH = false;
                if (autoScrollMinSize.Width > _TouchInnerBounds.Width)
                {
                    if (-offsetChange + MaximumReversePageOffset > autoScrollMinSize.Width - _TouchInnerBounds.Width)
                    {
                        autoScrollPosition.X = -(autoScrollMinSize.Width + MaximumReversePageOffset - _TouchInnerBounds.Width);
                        overflowH = true;
                    }
                    else if (offsetChange > MaximumReversePageOffset)
                    {
                        autoScrollPosition.X = MaximumReversePageOffset;
                        overflowH = true;
                    }
                    else
                        autoScrollPosition.X = offsetChange;
                }
                // Y Scroll
                bool overflowV = false;
                if (autoScrollMinSize.Height > _TouchInnerBounds.Height)
                {
                    offset = (e.Location.Y - _TouchStartLocation.Y);
                    offsetChange = offset + _TouchStartScrollPosition.Y;
                    if (-offsetChange + MaximumReversePageOffset > autoScrollMinSize.Height - _TouchInnerBounds.Height)
                    {
                        autoScrollPosition.Y = -(autoScrollMinSize.Height + MaximumReversePageOffset - _TouchInnerBounds.Height);
                        overflowV = true;
                    }
                    else if (offsetChange > MaximumReversePageOffset)
                    {
                        autoScrollPosition.Y = MaximumReversePageOffset;
                        overflowV = true;
                    }
                    else
                        autoScrollPosition.Y = offsetChange;
                }
                
                if (AutoScrollPosition != autoScrollPosition)
                {
                    AutoScrollPosition = autoScrollPosition;
                    Update();
                }
                if (overflowH && overflowV && e.IsInertia)
                    EndTouchPan();
                e.Handled = true;
            }
        }
        #endregion
        #region Localize Members
        #region InvokeLocalizeString
        ///
        /// InvokeLocalizeString
        ///
        ///
        public void InvokeLocalizeString(LocalizeEventArgs e)
        {
            if (LocalizeString != null)
                LocalizeString(this, e);
        }
        #endregion
        #region LocalizedString
        private string LocalizedString(ref string lstring)
        {
            LoadLocalizedStrings();
            return (lstring);
        }
        #endregion
        #region LoadLocalizedStrings
        private void LoadLocalizedStrings()
        {
            if (_LocalizedStringsLoaded == false)
            {
                using (LocalizationManager lm = new LocalizationManager(this))
                {
                    string s;
                    if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterShowAll)) != "")
                        _FilterShowAllString = s;
                    if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterCustom)) != "")
                        _FilterCustomString = s;
                    if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterShowNull)) != "")
                        _FilterShowNullString = s;
                    if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterShowNotNull)) != "")
                        _FilterShowNotNullString = s;
                    if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterApply)) != "")
                        _FilterApplyString = s;
                    if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterOk)) != "")
                        _FilterOkString = s;
                    if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterCancel)) != "")
                        _FilterCancelString = s;
                    if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterClose)) != "")
                        _FilterCloseString = s;
                    if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridGroupByWaterMarkText)) != "")
                        _GroupByWaterMarkText = s;
                }
                _LocalizedStringsLoaded = true;
            }
        }
        #endregion
        #endregion
    }
    #region enums
    #region AutoScrollEnable
    [Flags]
    internal enum AutoScrollEnable
    {
        None = 0,
        Vertical = (1 << 0),
        Horizontal = (1 << 1),
    }
    #endregion
    #region PlaySoundContext
    ///
    /// Context under which system sound ('beep') is played.
    ///
    public enum PlaySoundContext
    {
        ///
        /// Attempted activation of a cell which is marked as non-selectable
        /// or is an EmptyCell with AllowEmptyCellSelection set to false.
        ///
        CellActivate,
        ///
        /// Cell validation failure notification.
        ///
        CellValidate,
        ///
        /// Attempted activation of a grid row which is marked as non-selectable.
        ///
        RowActivate,
        ///
        /// Row validation failure notification.
        ///
        RowDeactivate,
        ///
        /// Row validation failure notification.
        ///
        RowValidate,
        
        ///
        /// Row deletion failure via DEL key input.
        ///
        RowDeleteAttempt,
        ///
        /// Row un-deletion failure via Shift-DEL key input.
        ///
        RowUnDeleteAttempt,
        ///
        /// Row insert failure via INS key input.
        ///
        RowInsertAttempt,
        ///
        /// Trying to suspend merge of a group of mergesd cells when
        /// AllowSuspend is set to false.
        ///
        MergeSuspend,
    }
    #endregion
    #region DataContext
    ///
    /// Context under which data is being accessed
    ///
    public enum DataContext
    {
        ///
        /// CellEdit
        ///
        CellEdit,
        ///
        /// CellKeyEvent
        ///
        CellKeyEvent,
        ///
        /// CellMouseEvent
        ///
        CellMouseEvent,
        ///
        /// CellProposedSize
        ///
        CellProposedSize,
        ///
        /// CellRender
        ///
        CellRender,
        ///
        /// CellValueLoad
        ///
        CellValueLoad,
        ///
        /// CellValueStore
        ///
        CellValueStore,
        ///
        /// CellExpressionParse
        ///
        CellExpressionParse,
        ///
        /// CellExpressionEval
        ///
        CellExpressionEval,
        /// 
        /// CellGetFormattedValue
        /// 
        CellGetFormattedValue,
        ///
        /// SetRowPosition
        ///
        SetRowPosition,
        ///
        /// RowFlush
        ///
        RowFlush,
        ///
        /// InsertRow
        ///
        InsertRow,
    }
    #endregion
    #region ExpandButtonType
    ///
    /// Expand button type
    ///
    public enum ExpandButtonType
    {
        ///
        /// NotSet
        ///
        NotSet = -1,
        ///
        /// None
        ///
        None,
        ///
        /// Circle
        ///
        Circle,
        ///
        /// Square
        ///
        Square,
        ///
        /// Triangle
        ///
        Triangle,
    }
    #endregion
    #region NewRowContext
    ///
    /// Context under which the New
    /// row is being accessed / created
    ///
    public enum NewRowContext
    {
        ///
        /// RowInit
        ///
        RowInit,
        ///
        /// RowActivate
        ///
        RowActivate,
        ///
        /// RowDeactivate
        ///
        RowDeactivate,
    }
    #endregion
    #region RenderParts
    ///
    /// Identifies grid 'parts' to be rendered
    ///
    [Flags]
    public enum RenderParts
    {
        ///
        /// Nothing to render
        ///
        Nothing = 0,
        ///
        /// Background needs to be rendered
        ///
        Background = (1 << 0),
        ///
        /// Border needs to be rendered
        ///
        Border = (1 << 1),
        ///
        /// Content needs to be rendered
        ///
        Content = (1 << 2),
        ///
        /// RowHeader needs to be rendered
        ///
        RowHeader = (1 << 3),
        ///
        /// Whitespace needs to be rendered
        ///
        Whitespace = (1 << 4),
    }
    #endregion
    #region TabSelection
    ///
    /// Identifies selection style when the Tab key is pressed
    ///
    public enum TabSelection
    {
        ///
        /// Previous / Next cell.
        ///
        Cell,
        ///
        /// Previous / Next cell in the same row.
        ///
        CellSameRow,
        ///
        /// Previous / Next Control.
        ///
        Control,
    }
    #endregion
    #endregion
    #region EventArgs
    #region GridCellActivatedEventArgs
    /// 
    /// GridCellActivatedEventArgs
    /// 
    public class GridCellActivatedEventArgs : GridEventArgs
    {
        #region Private variables
        private readonly GridCell _OldActiveCell;
        private readonly GridCell _NewActiveCell;
        #endregion
        ///
        /// GridCellActivatedEventArgs
        ///
        ///
        ///
        ///
        public GridCellActivatedEventArgs(
            GridPanel gridPanel, GridCell oldCell, GridCell newCell)
            : base(gridPanel)
        {
            _OldActiveCell = oldCell;
            _NewActiveCell = newCell;
        }
        #region Public properties
        /// 
        /// Gets the old (previous) ActiveCell
        /// 
        public GridCell OldActiveCell
        {
            get { return (_OldActiveCell); }
        }
        /// 
        /// Gets the new (current) ActiveCell
        /// 
        public GridCell NewActiveCell
        {
            get { return (_NewActiveCell); }
        }
        #endregion
    }
    #endregion
    #region GridCellActivatingEventArgs
    /// 
    /// GridCellActivatingEventArgs
    /// 
    public class GridCellActivatingEventArgs : GridCellActivatedEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridCellActivatedEventArgs
        ///
        ///
        ///
        ///
        public GridCellActivatingEventArgs(
            GridPanel gridPanel, GridCell oldCell, GridCell newCell)
            : base(gridPanel, oldCell, newCell)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether to Cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridActiveGridChangedEventArgs
    /// 
    /// ActiveGridChangedEventArgs
    /// 
    public class GridActiveGridChangedEventArgs : EventArgs
    {
        #region Private variables
        private readonly GridPanel _NewGridPanel;
        private readonly GridPanel _OldGridPanel;
        #endregion
        ///
        /// GridActiveGridChangedEventArgs
        ///
        ///
        ///
        public GridActiveGridChangedEventArgs(
            GridPanel oldGridPanel, GridPanel newGridPanel)
        {
            _OldGridPanel = oldGridPanel;
            _NewGridPanel = newGridPanel;
        }
        #region Public properties
        /// 
        /// Gets the old (previous) active GridPanel
        /// 
        public GridPanel OldGridPanel
        {
            get { return (_OldGridPanel); }
        }
        /// 
        /// Gets the new (current) active GridPanel
        /// 
        public GridPanel NewGridPanel
        {
            get { return (_NewGridPanel); }
        }
        #endregion
    }
    #endregion
    #region GridAfterCheckEventArgs
    /// 
    /// GridAfterCheckEventArgs
    /// 
    public class GridAfterCheckEventArgs : GridEventArgs
    {
        #region Private variables
        private GridElement _Item;
        #endregion
        ///
        /// GridAfterCheckEventArgs
        ///
        ///
        ///
        public GridAfterCheckEventArgs(GridPanel gridPanel, GridElement item)
            : base(gridPanel)
        {
            _Item = item;
        }
        #region Public properties
        /// 
        /// Gets the Item being checked or unchecked
        /// 
        public GridElement Item
        {
            get { return (_Item); }
        }
        #endregion
    }
    #endregion
    #region GridAfterCollapseEventArgs
    /// 
    /// GridAfterCollapseEventArgs
    /// 
    public class GridAfterCollapseEventArgs : GridAfterExpandEventArgs
    {
        ///
        /// GridRowAfterCollapseEventArgs
        ///
        ///
        ///
        ///
        public GridAfterCollapseEventArgs(GridPanel gridPanel, GridContainer gridContainer, ExpandSource expandSource)
            : base(gridPanel, gridContainer, expandSource)
        {
        }
    }
    #endregion
    #region GridAfterExpandEventArgs
    /// 
    /// GridAfterExpandChangeEventArgs
    /// 
    public class GridAfterExpandEventArgs : GridEventArgs
    {
        #region Private variables
        private GridContainer _GridContainer;
        private ExpandSource _ExpandSource;
        #endregion
        ///
        /// GridAfterExpandChangeEventArgs
        ///
        ///
        ///
        ///
        public GridAfterExpandEventArgs(
            GridPanel gridPanel, GridContainer gridContainer, ExpandSource expandSource)
            : base(gridPanel)
        {
            _GridContainer = gridContainer;
            _ExpandSource = expandSource;
        }
        #region Public properties
        /// 
        /// Gets the GridContainer being expanded or collapsed
        /// 
        public GridContainer GridContainer
        {
            get { return (_GridContainer); }
        }
        /// 
        /// Returns the source of the operation
        /// 
        public ExpandSource ExpandSource
        {
            get { return (_ExpandSource); }
        }
        #endregion
    }
    #endregion
    #region GridBeforeCheckEventArgs
    /// 
    /// GridRowBeforeExpandEventArgs
    /// 
    public class GridBeforeCheckEventArgs : GridAfterCheckEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridBeforeCheckEventArgs
        ///
        ///
        ///
        public GridBeforeCheckEventArgs(GridPanel gridPanel, GridElement gridRow)
            : base(gridPanel, gridRow)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether to Cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridBeforeCollapseEventArgs
    /// 
    /// GridBeforeExpandEventArgs
    /// 
    public class GridBeforeCollapseEventArgs : GridBeforeExpandEventArgs
    {
        ///
        /// GridBeforeExpandEventArgs
        ///
        ///
        ///
        ///
        public GridBeforeCollapseEventArgs(GridPanel gridPanel, GridContainer gridContainer, ExpandSource expandSource)
            : base(gridPanel, gridContainer, expandSource)
        {
        }
    }
    #endregion
    #region GridBeforeExpandEventArgs
    /// 
    /// GridBeforeExpandEventArgs
    /// 
    public class GridBeforeExpandEventArgs : GridAfterExpandEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridRowBeforeExpandEventArgs
        ///
        ///
        ///
        ///
        public GridBeforeExpandEventArgs(GridPanel gridPanel, GridContainer gridContainer, ExpandSource expandSource)
            : base(gridPanel, gridContainer, expandSource)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether to Cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridCellEventArgs
    /// 
    /// GridCellEventArgs
    /// 
    public class GridCellEventArgs : GridEventArgs
    {
        #region Private variables
        private readonly GridCell _GridCell;
        #endregion
        ///
        /// GridCellEventArgs
        ///
        ///
        ///
        public GridCellEventArgs(GridPanel gridPanel, GridCell gridCell)
            : base(gridPanel)
        {
            _GridCell = gridCell;
        }
        #region Public properties
        /// 
        /// Gets the associated GridCell
        /// 
        public GridCell GridCell
        {
            get { return (_GridCell); }
        }
        #endregion
    }
    #endregion
    #region GridCellClickEventArgs
    /// 
    /// GridCellClickEventArgs
    /// 
    public class GridCellClickEventArgs : GridCellEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private MouseEventArgs _MouseEventArgs;
        #endregion
        ///
        /// GridCellClickEventArgs
        ///
        ///
        ///
        ///
        public GridCellClickEventArgs(
            GridPanel gridPanel, GridCell gridCell, MouseEventArgs e)
            : base(gridPanel, gridCell)
        {
            _MouseEventArgs = e;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated MouseEventArgs
        /// 
        public MouseEventArgs MouseEventArgs
        {
            get { return (_MouseEventArgs); }
        }
        #endregion
    }
    #endregion
    #region GridCellDoubleClickEventArgs
    /// 
    /// GridCellDoubleClickEventArgs
    /// 
    public class GridCellDoubleClickEventArgs : GridCellClickEventArgs
    {
        ///
        /// GridCellDoubleClickEventArgs
        ///
        ///
        ///
        ///
        public GridCellDoubleClickEventArgs(GridPanel gridPanel, GridCell gridCell, MouseEventArgs e)
            : base(gridPanel, gridCell, e)
        {
        }
    }
    #endregion
    #region GridCellInfoEnterEventArgs
    /// 
    /// GridCellInfoEnterEventArgs
    /// 
    public class GridCellInfoEnterEventArgs : GridCellEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private Point _Location;
        private Control _Control;
        private System.Windows.Forms.ToolTip _ToolTip;
        #endregion
        ///
        /// GridCellInfoEnterEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridCellInfoEnterEventArgs(GridPanel gridPanel,
            GridCell gridCell, Control control, System.Windows.Forms.ToolTip toolTip, Point pt)
            : base(gridPanel, gridCell)
        {
            _Location = pt;
            _Control = control;
            _ToolTip = toolTip;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the default operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated Control associated with the CellInfo (can
        /// either be the GridControl or CellInfoWindow - depending upon
        /// whether an edit is currently active or not).
        /// 
        public Control Control
        {
            get { return (_Control); }
        }
        // 
        /// Gets the associated event ToolTip control
        /// 
        public System.Windows.Forms.ToolTip ToolTip
        {
            get { return (_ToolTip); }
        }
        // 
        /// Gets the associated event Location
        /// 
        public Point Location
        {
            get { return (_Location); }
        }
        #endregion
    }
    #endregion
    #region GridCellInfoLeaveEventArgs
    /// 
    /// GridCellInfoLeaveEventArgs
    /// 
    public class GridCellInfoLeaveEventArgs : GridCellEventArgs
    {
        #region Private variables
        private Control _Control;
        private System.Windows.Forms.ToolTip _ToolTip;
        #endregion
        ///
        /// GridRowInfoLeaveEventArgs
        ///
        ///
        ///
        ///
        public GridCellInfoLeaveEventArgs(GridPanel gridPanel,
            GridCell gridCell, Control control, System.Windows.Forms.ToolTip toolTip)
            : base(gridPanel, gridCell)
        {
            _Control = control;
            _ToolTip = toolTip;
        }
        #region Public properties
        /// 
        /// Gets the associated Control associated with the CellInfo (can
        /// either be the GridControl or CellInfoWindow - depending upon
        /// whether an edit is currently active or not).
        /// 
        public Control Control
        {
            get { return (_Control); }
        }
        // 
        /// Gets the associated event ToolTip control
        /// 
        public System.Windows.Forms.ToolTip ToolTip
        {
            get { return (_ToolTip); }
        }
        #endregion
    }
    #endregion
    #region GridCellMouseEventArgs
    /// 
    /// GridCellMouseEventArgs
    /// 
    public class GridCellMouseEventArgs : MouseEventArgs
    {
        #region Private variables
        private readonly GridPanel _GridPanel;
        private readonly GridCell _GridCell;
        #endregion
        ///
        /// GridCellMouseEventArgs
        ///
        ///
        ///
        ///
        public GridCellMouseEventArgs(GridPanel gridPanel, GridCell gridCell, MouseEventArgs ev)
            : base(ev.Button, ev.Clicks, ev.X, ev.Y, ev.Delta)
        {
            _GridPanel = gridPanel;
            _GridCell = gridCell;
        }
        #region Public properties
        /// 
        /// Gets the associated GridCell
        /// 
        public GridCell GridCell
        {
            get { return (_GridCell); }
        }
        /// 
        /// Gets the associated GridPanel
        /// 
        public GridPanel GridPanel
        {
            get { return (_GridPanel); }
        }
        #endregion
    }
    #endregion
    #region GridCellUserFunctionEventArgs
    /// 
    /// GridCellUserFunctionEventArgs
    /// 
    public class GridCellUserFunctionEventArgs : GridCellEventArgs
    {
        #region Private variables
        private object[] _Args;
        private object _Result;
        #endregion
        ///
        /// GridCellUserFunctionEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridCellUserFunctionEventArgs(
            GridPanel gridPanel, GridCell gridCell, object[] args, object result)
            : base(gridPanel, gridCell)
        {
            _Args = args;
            _Result = result;
        }
        #region Public properties
        /// 
        /// Gets or sets the associated function arguments
        /// 
        public object[] Args
        {
            get { return (_Args); }
            set { _Args = value; }
        }
        /// 
        /// Gets or sets the associated function result
        /// 
        public object Result
        {
            get { return (_Result); }
            set { _Result = value; }
        }
        #endregion
    }
    #endregion
    #region GridCellValidatedEventArgs
    /// 
    /// GridCellValidatedEventArgs
    /// 
    public class GridCellValidatedEventArgs : GridCellEventArgs
    {
        ///
        /// GridCellValidatedEventArgs
        ///
        ///
        ///
        public GridCellValidatedEventArgs(GridPanel gridPanel, GridCell gridCell)
            : base(gridPanel, gridCell)
        {
        }
    }
    #endregion
    #region GridCellValidatingEventArgs
    /// 
    /// GridCellValidatingEventArgs
    /// 
    public class GridCellValidatingEventArgs : GridCellEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private object _Value;
        private object _FormattedValue;
        #endregion
        ///
        /// GridCellValidatingEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridCellValidatingEventArgs(GridPanel gridPanel,
            GridCell gridCell, object value, object formattedValue)
            : base(gridPanel, gridCell)
        {
            _Value = value;
            _FormattedValue = formattedValue;
        }
        #region Public properties
        /// 
        /// Gets or sets the Value to validate
        /// 
        public object Value
        {
            get { return (_Value); }
            set { _Value = value; }
        }
        /// 
        /// Gets the formatted Value
        /// 
        public object FormattedValue
        {
            get { return (_FormattedValue); }
        }
        /// 
        /// Gets or sets whether to cancel the operation
        /// resulting in the cell validation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridCellValueChangedEventArgs
    /// 
    /// GridCellValueChangedEventArgs
    /// 
    public class GridCellValueChangedEventArgs : GridCellEventArgs
    {
        #region Private variables
        private object _OldValue;
        private object _NewValue;
        private DataContext _DataContext;
        #endregion
        ///
        /// GridCellValueChangedEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        public GridCellValueChangedEventArgs(GridPanel gridPanel,
            GridCell gridCell, object oldValue, object newValue, DataContext context)
            : base(gridPanel, gridCell)
        {
            _OldValue = oldValue;
            _NewValue = newValue;
            _DataContext = context;
        }
        #region Public properties
        ///
        /// Gets the context under which
        /// the call value was changed
        ///
        public DataContext DataContext
        {
            get { return (_DataContext); }
        }      
        ///
        /// Gets the old cell Value
        ///
        public object OldValue
        {
            get { return (_OldValue); }
        }
        ///
        /// Gets the new cell Value
        ///
        public object NewValue
        {
            get { return (_NewValue); }
        }      
        #endregion
    }
    #endregion
    #region GridColumnEventArgs
    /// 
    /// GridColumnEventArgs
    /// 
    public class GridColumnEventArgs : EventArgs
    {
        #region Private variables
        private GridPanel _GridPanel;
        private GridColumn _GridColumn;
        #endregion
        ///
        /// GridColumnEventArgs
        ///
        ///
        ///
        public GridColumnEventArgs(GridPanel gridPanel, GridColumn gridColumn)
        {
            _GridPanel = gridPanel;
            _GridColumn = gridColumn;
        }
        #region Public properties
        /// 
        /// Gets th associated GridPanel
        /// 
        public GridPanel GridPanel
        {
            get { return (_GridPanel); }
        }
        /// 
        /// Gets the associated GridColumn
        /// 
        public GridColumn GridColumn
        {
            get { return (_GridColumn); }
        }
        #endregion
    }
    #endregion
    #region GridColumnHeaderClickEventArgs
    /// 
    /// GridColumnHeaderClickEventArgs
    /// 
    public class GridColumnHeaderClickEventArgs : GridColumnEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private MouseEventArgs _MouseEventArgs;
        #endregion
        ///
        /// GridColumnHeaderClickEventArgs
        ///
        ///
        ///
        ///
        public GridColumnHeaderClickEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, MouseEventArgs e)
            : base(gridPanel, gridColumn)
        {
            _MouseEventArgs = e;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated MouseEventArgs
        /// 
        public MouseEventArgs MouseEventArgs
        {
            get { return (_MouseEventArgs); }
        }
        #endregion
    }
    #endregion
    #region GridColumnHeaderEventArgs
    /// 
    /// GridColumnHeaderEventArgs
    /// 
    public class GridColumnHeaderEventArgs : EventArgs
    {
        #region Private variables
        private GridColumnHeader _GridColumnHeader;
        #endregion
        ///
        /// GridColumnHeaderEventArgs
        ///
        ///
        ///
        public GridColumnHeaderEventArgs(GridColumnHeader gridColumnHeader)
        {
            _GridColumnHeader = gridColumnHeader;
        }
        #region Public properties
        /// 
        /// Gets th associated GridPanel
        /// 
        public GridPanel GridPanel
        {
            get { return (_GridColumnHeader.GridPanel); }
        }
        /// 
        /// Gets the associated GridColumnHeader
        /// 
        public GridColumnHeader GridColumnHeader
        {
            get { return (_GridColumnHeader); }
        }
        #endregion
    }
    #endregion
    #region GridColumnHeaderMarkupLinkClickEventArgs
    /// 
    /// GridColumnHeaderMarkupLinkClickEventArgs
    /// 
    public class GridColumnHeaderMarkupLinkClickEventArgs : GridColumnEventArgs
    {
        #region Private variables
        private string _HRef;
        private string _Name;
        #endregion
        ///
        /// GridColumnHeaderMarkupLinkClickEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridColumnHeaderMarkupLinkClickEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, string name, string href)
            : base(gridPanel, gridColumn)
        {
            _HRef = href;
            _Name = name;
        }
        #region Public properties
        /// 
        /// Gets the associated HyperLink HRef
        /// 
        public string HRef
        {
            get { return (_HRef); }
        }
        /// 
        /// Gets the associated HyperLink Name
        /// 
        public string Name
        {
            get { return (_Name); }
        }
        #endregion
    }
    #endregion
    #region GridColumnHeaderDoubleClickEventArgs
    /// 
    /// GridColumnHeaderDoubleClickEventArgs
    /// 
    public class GridColumnHeaderDoubleClickEventArgs : GridColumnHeaderClickEventArgs
    {
        ///
        /// GridColumnHeaderDoubleClickEventArgs
        ///
        ///
        ///
        ///
        public GridColumnHeaderDoubleClickEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, MouseEventArgs e)
            : base(gridPanel, gridColumn, e)
        {
        }
    }
    #endregion
    #region GridColumnHeaderMouseEventArgs
    /// 
    /// GridColumnHeaderMouseEventArgs
    /// 
    public class GridColumnHeaderMouseEventArgs : MouseEventArgs
    {
        #region Private variables
        private readonly GridColumnHeader _GridColumnHeader;
        #endregion
        ///
        /// GridColumnHeaderMouseEventArgs
        ///
        ///
        ///
        ///
        public GridColumnHeaderMouseEventArgs(GridColumnHeader gridColumnHeader, MouseEventArgs ev)
            : base(ev.Button, ev.Clicks, ev.X, ev.Y, ev.Delta)
        {
            _GridColumnHeader = gridColumnHeader;
        }
        #region Public properties
        /// 
        /// Gets the associated GridColumnHeader
        /// 
        public GridColumnHeader GridColumnHeader
        {
            get { return (_GridColumnHeader); }
        }
        /// 
        /// Gets the associated GridPanel
        /// 
        public GridPanel GridPanel
        {
            get { return (_GridColumnHeader.GridPanel); }
        }
        #endregion
    }
    #endregion
    #region GridColumnGroupHeaderClickEventArgs
    /// 
    /// GridColumnGroupHeaderClickEventArgs
    /// 
    public class GridColumnGroupHeaderClickEventArgs : GridEventArgs
    {
        #region Private variables
        private GridColumnHeader _ColumnHeader;
        private ColumnGroupHeader _GroupHeader;
        private MouseEventArgs _MouseEventArgs;
        private bool _Cancel;
        #endregion
        ///
        /// GridColumnGroupHeaderClickEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridColumnGroupHeaderClickEventArgs(GridPanel gridPanel,
            GridColumnHeader header, ColumnGroupHeader groupHeader, MouseEventArgs e)
            : base(gridPanel)
        {
            _ColumnHeader = header;
            _GroupHeader = groupHeader;
            _MouseEventArgs = e;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated ColumnHeader
        /// 
        public GridColumnHeader ColumnHeader
        {
            get { return (_ColumnHeader); }
        }
        /// 
        /// Gets the associated GroupHeader
        /// 
        public ColumnGroupHeader GroupHeader
        {
            get { return (_GroupHeader); }
        }
        /// 
        /// Gets the associated MouseEventArgs
        /// 
        public MouseEventArgs MouseEventArgs
        {
            get { return (_MouseEventArgs); }
        }
        #endregion
    }
    #endregion
    #region GridColumnGroupHeaderMarkupLinkClickEventArgs
    /// 
    /// GridColumnGroupHeaderMarkupLinkClickEventArgs
    /// 
    public class GridColumnGroupHeaderMarkupLinkClickEventArgs : GridEventArgs
    {
        #region Private variables
        private GridColumnHeader _ColumnHeader;
        private ColumnGroupHeader _GroupHeader;
        private string _HRef;
        private string _Name;
        #endregion
        ///
        /// GridColumnGroupHeaderMarkupLinkClickEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        public GridColumnGroupHeaderMarkupLinkClickEventArgs(GridPanel gridPanel,
            GridColumnHeader header, ColumnGroupHeader groupHeader, string name, string href)
            : base(gridPanel)
        {
            _ColumnHeader = header;
            _GroupHeader = groupHeader;
            _HRef = href;
            _Name = name;
        }
        #region Public properties
        /// 
        /// Gets the associated ColumnHeader
        /// 
        public GridColumnHeader ColumnHeader
        {
            get { return (_ColumnHeader); }
        }
        /// 
        /// Gets the associated GroupHeader
        /// 
        public ColumnGroupHeader GroupHeader
        {
            get { return (_GroupHeader); }
        }
        /// 
        /// Gets the associated HyperLink HRef
        /// 
        public string HRef
        {
            get { return (_HRef); }
        }
        /// 
        /// Gets the associated HyperLink Name
        /// 
        public string Name
        {
            get { return (_Name); }
        }
        #endregion
    }
    #endregion
    #region GridColumnGroupHeaderDoubleClickEventArgs
    /// 
    /// GridColumnGroupHeaderDoubleClickEventArgs
    /// 
    public class GridColumnGroupHeaderDoubleClickEventArgs : GridColumnGroupHeaderClickEventArgs
    {
        ///
        /// GridColumnGroupHeaderDoubleClickEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridColumnGroupHeaderDoubleClickEventArgs(GridPanel gridPanel,
            GridColumnHeader header, ColumnGroupHeader groupHeader, MouseEventArgs e)
            : base(gridPanel, header, groupHeader, e)
        {
        }
    }
    #endregion
    #region GridColumnGroupHeaderResizedEventArgs
    /// 
    /// GridColumnGroupHeaderResizedEventArgs
    /// 
    public class GridColumnGroupHeaderResizedEventArgs : EventArgs
    {
        #region Private variables
        private GridPanel _GridPanel;
        private ColumnGroupHeader _GroupHeader;
        private Size _OldSize;
        #endregion
        ///
        /// GridColumnGroupHeaderResizedEventArgs
        ///
        ///
        ///
        ///
        public GridColumnGroupHeaderResizedEventArgs(
            GridPanel gridPanel, ColumnGroupHeader groupHeader, Size oldSize)
        {
            _GridPanel = gridPanel;
            _GroupHeader = groupHeader;
            _OldSize = oldSize;
        }
        #region Public properties
        /// 
        /// Gets th associated GridPanel
        /// 
        public GridPanel GridPanel
        {
            get { return (_GridPanel); }
        }
        /// 
        /// Gets the associated GridHeader
        /// 
        public ColumnGroupHeader GroupHeader
        {
            get { return (_GroupHeader); }
        }
        /// 
        /// Gets the OldSize
        /// 
        public Size OldSize
        {
            get { return (_OldSize); }
        }
        /// 
        /// Gets the NewSize
        /// 
        public Size NewSize
        {
            get { return (_GroupHeader.Size); }
        }
        #endregion
    }
    #endregion
    #region GridColumnGroupedEventArgs
    /// 
    /// GridColumnGroupedEventArgs
    /// 
    public class GridColumnGroupedEventArgs : GridColumnEventArgs
    {
        #region Private variables
        private GridGroup _GridGroup;
        #endregion
        ///
        /// GridColumnEventArgs
        ///
        ///
        ///
        ///
        public GridColumnGroupedEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, GridGroup gridGroup)
            : base(gridPanel, gridColumn)
        {
            _GridGroup = gridGroup;
        }
        #region Public properties
        /// 
        /// Gets th associated GridGroup
        /// 
        public GridGroup GridGroup
        {
            get { return (_GridGroup); }
        }
        #endregion
    }
    #endregion
    #region GridCompareElementsEventArgs
    /// 
    /// GridCompareElementsEventArgs
    /// 
    public class GridCompareElementsEventArgs : GridCancelEventArgs
    {
        #region Private variables
        private readonly GridElement _ElementA;
        private readonly GridElement _ElementB;
        private int _Result;
        #endregion
        ///
        /// GridCompareElementsEventArgs
        ///
        ///
        ///
        ///
        public GridCompareElementsEventArgs(
            GridPanel gridPanel, GridElement a, GridElement b)
            : base(gridPanel)
        {
            _ElementA = a;
            _ElementB = b;
        }
        #region Public properties
        /// 
        /// Gets the left-hand element of the comparison
        /// 
        public GridElement ElementA
        {
            get { return (_ElementA); }
        }
        /// 
        /// Gets the right-hand element of the comparison
        /// 
        public GridElement ElementB
        {
            get { return (_ElementB); }
        }
        /// 
        /// Gets or sets the result of the element compare.
        /// -1 = ElementA is less than ElementB
        /// 0 = ElementA is equal to ElementB
        /// +1 = ElementA is greater than ElementB
        /// 
        public int Result
        {
            get { return (_Result); }
            set { _Result = value; }
        }
        #endregion
    }
    #endregion
    #region GridDataBindingStartEventArgs
    /// 
    /// GridDataBindingStartEventArgs
    /// 
    public class GridDataBindingStartEventArgs : GridRowCancelEventArgs
    {
        #region Private variables
        private string _TableName;
        private bool _AutoGenerateColumns;
        private ProcessChildRelations _ProcessChildRelations;
        #endregion
        ///
        /// GridDataBindingStartEventArgs
        ///
        ///Associated GridPanel
        ///Associated GridRow
        ///Name of table being bound to
        ///Whether to auto-generate columns
        ///
        public GridDataBindingStartEventArgs(GridPanel gridPanel,
            GridRow row, string tableName, bool autoGenerateColumns, ProcessChildRelations crProcess)
            : base(gridPanel, row)
        {
            _TableName = tableName;
            _AutoGenerateColumns = autoGenerateColumns;
            _ProcessChildRelations = crProcess;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to auto-generate
        /// the nested table columns
        /// 
        public bool AutoGenerateColumns
        {
            get { return (_AutoGenerateColumns); }
            set { _AutoGenerateColumns = value; }
        }
        /// 
        /// Gets or sets how Child Relations
        /// are processed by the SuperGrid
        /// 
        public ProcessChildRelations ProcessChildRelations
        {
            get { return (_ProcessChildRelations); }
            set { _ProcessChildRelations = value; }
        }
        /// 
        /// Gets the nested table name being bound
        /// 
        public string TableName
        {
            get { return (_TableName); }
        }
        #endregion
    }
    #endregion
    #region GridDataBindingCompleteEventArgs
    /// 
    /// GridDataBindingCompleteEventArgs
    /// 
    public class GridDataBindingCompleteEventArgs : GridEventArgs
    {
        #region Private variables
        private ListChangedType _ListChangedType;
        #endregion
        ///
        /// GridDataBindingCompleteEventArgs
        ///
        ///
        public GridDataBindingCompleteEventArgs(GridPanel gridPanel)
            : base(gridPanel)
        {
            _ListChangedType = ListChangedType.Reset;
        }
        #region Public properties
        /// 
        /// Gets how the list was changed
        /// 
        public ListChangedType ListChangedType
        {
            get { return (_ListChangedType); }
        }
        #endregion
    }
    #endregion
    #region GridDataErrorEventArgs
    /// 
    /// GridDataErrorEventArgs
    /// 
    public class GridDataErrorEventArgs : CancelEventArgs
    {
        #region Private variables
        private GridPanel _GridPanel;
        private GridCell _GridCell;
        private Exception _Exception;
        private DataContext _ErrorContext;
        private object _Value;
        private bool _Retry;
        private bool _ThrowException;
        #endregion
        ///
        /// GridDataErrorEventArgs
        ///
        public GridDataErrorEventArgs(
            GridPanel gridPanel, GridCell gridCell,
            Exception exception, DataContext context, object value)
        {
            _GridPanel = gridPanel;
            _GridCell = gridCell;
            _Exception = exception;
            _ErrorContext = context;
            _Value = value;
        }
        #region Public properties
        /// 
        /// Gets the associated GridPanel
        /// 
        public GridPanel GridPanel
        {
            get { return (_GridPanel); }
        }
        /// 
        /// Gets the associated cell
        /// 
        public GridCell GridCell
        {
            get { return (_GridCell); }
        }
        /// 
        /// Gets the context under which the Exception was thrown
        /// 
        public DataContext ErrorContext
        {
            get { return (_ErrorContext); }
        }
        /// 
        /// Gets the Exception that was thrown
        /// 
        public Exception Exception
        {
            get { return (_Exception); }
        }
        /// 
        /// Gets or sets whether the grid should retry the operation
        /// 
        public bool Retry
        {
            get { return (_Retry); }
            set { _Retry = value; }
        }
        /// 
        /// Gets whether the exception should be re-thrown by the grid
        /// 
        public bool ThrowException
        {
            get { return (_ThrowException); }
            set { _ThrowException = value; }
        }
        /// 
        /// Gets the value that caused the Exception
        /// 
        public object Value
        {
            get { return (_Value); }
            set { _Value = value; }
        }
        #endregion
    }
    #endregion
    #region GridDataFilteringStartEventArgs
    /// 
    /// GridDataFilteringStartEventArgs
    /// 
    public class GridDataFilteringStartEventArgs : GridCancelEventArgs
    {
        ///
        /// GridDataFilteringStartEventArgs
        ///
        ///Associated GridPanel
        public GridDataFilteringStartEventArgs(GridPanel gridPanel)
            : base(gridPanel)
        {
        }
    }
    #endregion
    #region GridDataFilteringCompleteEventArgs
    /// 
    /// GridDataFilteringCompleteEventArgs
    /// 
    public class GridDataFilteringCompleteEventArgs : GridEventArgs
    {
        ///
        /// GridDataFilteringCompleteEventArgs
        ///
        ///
        public GridDataFilteringCompleteEventArgs(GridPanel gridPanel)
            : base(gridPanel)
        {
        }
    }
    #endregion
    #region GridFilterBeginEditEventArgs
    /// 
    /// GridFilterBeginEditEventArgs
    /// 
    public class GridFilterBeginEditEventArgs : GridFilterEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private FilterPanel _FilterPanel;
        #endregion
        ///
        /// GridFilterBeginEditEventArgs
        ///
        ///
        ///
        ///
        public GridFilterBeginEditEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, FilterPanel filterPanel)
            : base(gridPanel, gridColumn)
        {
            _FilterPanel = filterPanel;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated FilterPanel
        /// 
        public FilterPanel FilterPanel
        {
            get { return (_FilterPanel); }
        }
        #endregion
    }
    #endregion
    #region GridFilterCancelEditEventArgs
    /// 
    /// GridFilterCancelEditEventArgs
    /// 
    public class GridFilterCancelEditEventArgs : GridFilterEventArgs
    {
        #region Private variables
        private FilterPanel _FilterPanel;
        #endregion
        ///
        /// GridFilterCancelEditEventArgs
        ///
        ///
        ///
        ///
        public GridFilterCancelEditEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, FilterPanel filterPanel)
            : base(gridPanel, gridColumn)
        {
            _FilterPanel = filterPanel;
        }
        #region Public properties
        /// 
        /// Gets the associated FilterPanel
        /// 
        public FilterPanel FilterPanel
        {
            get { return (_FilterPanel); }
        }
        #endregion
    }
    #endregion
    #region GridFilterColumnErrorEventArgs
    /// 
    /// GridFilterColumnErrorEventArgs
    /// 
    public class GridFilterColumnErrorEventArgs : GridFilterRowErrorEventArgs
    {
        #region Private variables
        private GridColumn _GridColumn;
        #endregion
        ///
        /// GridFilterColumnErrorEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        public GridFilterColumnErrorEventArgs(GridPanel gridPanel, GridRow gridRow,
            GridColumn gridColumn, Exception exp, bool filteredOut, bool throwException, bool postError)
            : base(gridPanel, gridRow, exp, filteredOut, throwException, postError)
        {
            _GridColumn = gridColumn;
        }
        #region Public properties
        /// 
        /// Gets the associated GridColumn
        /// 
        public GridColumn GridColumn
        {
            get { return (_GridColumn); }
        }
        #endregion
    }
    #endregion
    #region GridFilterEditValueChangedEventArgs
    /// 
    /// GridFilterEditValueChangedEventArgs
    /// 
    public class GridFilterEditValueChangedEventArgs : GridFilterEventArgs
    {
        #region Private variables
        private object _OldValue;
        private object _NewValue;
        private object _NewDisplayValue;
        private string _NewExpr;
        private FilterPanel _FilterPanel;
        private bool _Cancel;
        #endregion
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        public GridFilterEditValueChangedEventArgs(GridPanel gridPanel, GridColumn gridColumn,
            FilterPanel fp, object oldValue, object newValue, object newDisplayValue, string newExpr)
            : base(gridPanel, gridColumn)
        {
            _FilterPanel = fp;
            _OldValue = oldValue;
            _NewValue = newValue;
            _NewDisplayValue = newDisplayValue;
            _NewExpr = newExpr;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        ///
        /// Gets the associated FilterPanel
        ///
        public FilterPanel FilterPanel
        {
            get { return (_FilterPanel); }
        }
        ///
        /// Gets the old filter value
        ///
        public object OldValue
        {
            get { return (_OldValue); }
        }
        ///
        /// Gets or sets the new filter value
        ///
        public object NewValue
        {
            get { return (_NewValue); }
            set { _NewValue = value; }
        }
        ///
        /// Gets or sets the new filter display value
        ///
        public object NewDisplayValue
        {
            get { return (_NewDisplayValue); }
            set { _NewDisplayValue = value; }
        }
        ///
        /// Gets or sets the new filter expression
        ///
        public string NewExpr
        {
            get { return (_NewExpr); }
            set { _NewExpr = value; }
        }
        #endregion
    }
    #endregion
    #region GridFilterEndEditEventArgs
    /// 
    /// GridFilterEndEditEventArgs
    /// 
    public class GridFilterEndEditEventArgs : GridFilterEventArgs
    {
        #region Private variables
        private FilterPanel _FilterPanel;
        #endregion
        
        ///
        /// GridFilterEndEditEventArgs
        ///
        ///
        ///
        ///
        public GridFilterEndEditEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, FilterPanel filterPanel)
            : base(gridPanel, gridColumn)
        {
            _FilterPanel = filterPanel;
        }
        #region Public properties
        /// 
        /// Gets the associated FilterPanel
        /// 
        public FilterPanel FilterPanel
        {
            get { return (_FilterPanel); }
        }
        #endregion
    }
    #endregion
    #region GridFilterEventArgs
    /// 
    /// GridFilterEventArgs
    /// 
    public class GridFilterEventArgs : GridColumnEventArgs
    {
        ///
        /// GridFilterEventArgs
        ///
        ///
        ///
        public GridFilterEventArgs(GridPanel gridPanel, GridColumn gridColumn)
            : base(gridPanel, gridColumn)
        {
        }
    }
    #endregion
    #region GridFilterHeaderClickEventArgs
    /// 
    /// GridFilterHeaderClickEventArgs
    /// 
    public class GridFilterHeaderClickEventArgs : GridColumnEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private MouseEventArgs _MouseEventArgs;
        #endregion
        ///
        /// GridFilterHeaderClickEventArgs
        ///
        ///
        ///
        ///
        public GridFilterHeaderClickEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, MouseEventArgs e)
            : base(gridPanel, gridColumn)
        {
            _MouseEventArgs = e;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated MouseEventArgs
        /// 
        public MouseEventArgs MouseEventArgs
        {
            get { return (_MouseEventArgs); }
        }
        #endregion
    }
    #endregion
    #region GridFilterHelpClosingEventArgs
    /// 
    /// GridFilterHelpClosingEventArgs
    /// 
    public class GridFilterHelpClosingEventArgs : GridFilterEventArgs
    {
        #region Private variables
        private SampleExpr _SampleExpr;
        #endregion
        ///
        /// GridFilterHelpClosingEventArgs
        ///
        ///
        ///
        ///
        public GridFilterHelpClosingEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, SampleExpr sampleExpr)
            : base(gridPanel, gridColumn)
        {
            _SampleExpr = sampleExpr;
        }
        #region Public properties
        /// 
        /// Gets the associated Sample Expression help window
        /// 
        public SampleExpr SampleExpr
        {
            get { return (_SampleExpr); }
        }
        #endregion
    }
    #endregion
    #region GridFilterHelpOpeningEventArgs
    /// 
    /// GridFilterHelpOpeningEventArgs
    /// 
    public class GridFilterHelpOpeningEventArgs : GridFilterEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private SampleExpr _SampleExpr;
        #endregion
        ///
        /// GridFilterHelpOpeningEventArgs
        ///
        ///
        ///
        ///
        public GridFilterHelpOpeningEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, SampleExpr sampleExpr)
            : base(gridPanel, gridColumn)
        {
            _SampleExpr = sampleExpr;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated Sample Expression help window
        /// 
        public SampleExpr SampleExpr
        {
            get { return (_SampleExpr); }
        }
        #endregion
    }
    #endregion
    #region GridFilterItemsLoadedEventArgs
    /// 
    /// GridFilterItemsLoadedEventArgs
    /// 
    public class GridFilterItemsLoadedEventArgs : GridFilterEventArgs
    {
        #region Private variables
        private ComboBoxEx _ComboBox;
        #endregion
        ///
        /// GridFilterItemsLoadedEventArgs
        ///
        ///
        ///
        ///
        public GridFilterItemsLoadedEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, ComboBoxEx comboBox)
            : base(gridPanel, gridColumn)
        {
            _ComboBox = comboBox;
        }
        #region Public properties
        /// 
        /// Gets the associated ComboBoxEx
        /// 
        public ComboBoxEx ComboBox
        {
            get { return (_ComboBox); }
        }
        #endregion
    }
    #endregion
    #region GridFilterLoadItemsEventArgs
    /// 
    /// GridFilterLoadItemsEventArgs
    /// 
    public class GridFilterLoadItemsEventArgs : GridFilterEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private ComboBoxEx _ComboBox;
        #endregion
        ///
        /// GridFilterBeginEditEventArgs
        ///
        ///
        ///
        ///
        public GridFilterLoadItemsEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, ComboBoxEx comboBox)
            : base(gridPanel, gridColumn)
        {
            _ComboBox = comboBox;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated ComboBoxEx
        /// 
        public ComboBoxEx ComboBox
        {
            get { return (_ComboBox); }
        }
        #endregion
    }
    #endregion
    #region GridFilterLoadUserDataEventArgs
    /// 
    /// GridFilterLoadUserDataEventArgs
    /// 
    public class GridFilterLoadUserDataEventArgs : GridCancelEventArgs
    {
        #region Private variables
        private string _FilterPath;
        private List _FilterData;
        #endregion
        ///
        /// GridFilterLoadUserDataEventArgs
        ///
        ///
        ///
        ///
        public GridFilterLoadUserDataEventArgs(
            GridPanel gridPanel, string filterPath, List filterData)
            : base(gridPanel)
        {
            _FilterPath = filterPath;
            _FilterData = filterData;
        }
        #region Public properties
        /// 
        /// Gets or sets the associated FilterData (user defined
        /// Custom filter expressions)
        /// 
        public List FilterData
        {
            get { return (_FilterData); }
            set { _FilterData = value; }
        }
        /// 
        /// Gets or sets the associated Path to
        /// the user defined filter data expression file
        /// 
        public string FilterPath
        {
            get { return (_FilterPath); }
            set { _FilterPath = value; }
        }
        #endregion
    }
    #endregion
    #region GridFilterPopupClosingEventArgs
    /// 
    /// GridFilterPopupClosingEventArgs
    /// 
    public class GridFilterPopupClosingEventArgs : GridFilterEventArgs
    {
        #region Private variables
        private FilterPopup _FilterPopup;
        #endregion
        ///
        /// GridFilterPopupClosingEventArgs
        ///
        ///
        ///
        ///
        public GridFilterPopupClosingEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, FilterPopup filterPopup)
            : base(gridPanel, gridColumn)
        {
            _FilterPopup = filterPopup;
        }
        #region Public properties
        /// 
        /// Gets the associated filter popup
        /// 
        public FilterPopup FilterPopup
        {
            get { return (_FilterPopup); }
        }
        #endregion
    }
    #endregion
    #region GridFilterPopupLoadEventArgs
    /// 
    /// GridFilterPopupLoadEventArgs
    /// 
    public class GridFilterPopupLoadEventArgs : GridFilterEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private FilterPopup _FilterPopup;
        #endregion
        ///
        /// GridFilterPopupLoadEventArgs
        ///
        ///
        ///
        ///
        public GridFilterPopupLoadEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, FilterPopup filterPopup)
            : base(gridPanel, gridColumn)
        {
            _FilterPopup = filterPopup;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated filter popup
        /// 
        public FilterPopup FilterPopup
        {
            get { return (_FilterPopup); }
        }
        #endregion
    }
    #endregion
    #region GridFilterPopupLoadedEventArgs
    /// 
    /// GridFilterPopupLoadedEventArgs
    /// 
    public class GridFilterPopupLoadedEventArgs : GridFilterEventArgs
    {
        #region Private variables
        private FilterPopup _FilterPopup;
        #endregion
        ///
        /// GridFilterPopupLoadedEventArgs
        ///
        ///
        ///
        ///
        public GridFilterPopupLoadedEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, FilterPopup filterPopup)
            : base(gridPanel, gridColumn)
        {
            _FilterPopup = filterPopup;
        }
        #region Public properties
        /// 
        /// Gets the associated filter popup
        /// 
        public FilterPopup FilterPopup
        {
            get { return (_FilterPopup); }
        }
        #endregion
    }
    #endregion
    #region GridFilterPopupOpeningEventArgs
    /// 
    /// GridFilterPopupOpeningEventArgs
    /// 
    public class GridFilterPopupOpeningEventArgs : GridFilterEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private FilterPopup _FilterPopup;
        #endregion
        ///
        /// GridFilterPopupOpeningEventArgs
        ///
        ///
        ///
        ///
        public GridFilterPopupOpeningEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, FilterPopup filterPopup)
            : base(gridPanel, gridColumn)
        {
            _FilterPopup = filterPopup;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated filter popup
        /// 
        public FilterPopup FilterPopup
        {
            get { return (_FilterPopup); }
        }
        #endregion
    }
    #endregion
    #region GridFilterPopupValueChangedEventArgs
    /// 
    /// GridFilterPopupValueChangedEventArgs
    /// 
    public class GridFilterPopupValueChangedEventArgs : GridFilterEventArgs
    {
        #region Private variables
        private object _FilterValue;
        private object _FilterDisplayValue;
        private string _FilterExpr;
        private FilterItemType _FilterItemType;
        private bool _Cancel;
        #endregion
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        public GridFilterPopupValueChangedEventArgs(GridPanel gridPanel, GridColumn gridColumn,
            FilterItemType filterItemType, object filterValue, object filterDisplayValue, string filterExpr)
            : base(gridPanel, gridColumn)
        {
            _FilterItemType = filterItemType;
            _FilterValue = filterValue;
            _FilterDisplayValue = filterDisplayValue;
            _FilterExpr = filterExpr;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        ///
        /// Gets or sets the new filter value
        ///
        public object FilterValue
        {
            get { return (_FilterValue); }
            set { _FilterValue = value; }
        }
        ///
        /// Gets or sets the new filter display value
        ///
        public object FilterDisplayValue
        {
            get { return (_FilterDisplayValue); }
            set { _FilterDisplayValue = value; }
        }
        ///
        /// Gets or sets the new filter expression
        ///
        public string FilterExpr
        {
            get { return (_FilterExpr); }
            set { _FilterExpr = value; }
        }
        ///
        /// Gets the filter popup item selected
        ///
        public FilterItemType FilterItemType
        {
            get { return (_FilterItemType); }
        }
        #endregion
    }
    #endregion
    #region GridFilterRowErrorEventArgs
    /// 
    /// GridFilterRowErrorEventArgs
    /// 
    public class GridFilterRowErrorEventArgs : GridRowEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private bool _FilteredOut;
        private bool _ThrowException;
        private bool _PostError;
        private Exception _Exception;
        #endregion
        ///
        /// GridFilterRowErrorEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        public GridFilterRowErrorEventArgs(GridPanel gridPanel,
            GridRow gridRow, Exception exp, bool filteredOut, bool throwException, bool postError)
            : base(gridPanel, gridRow)
        {
            _Exception = exp;
            _FilteredOut = filteredOut;
            _ThrowException = throwException;
            _PostError = postError;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated filter Exception
        /// 
        public Exception Exception
        {
            get { return (_Exception); }
        }
        /// 
        /// Gets or sets whether the row is filtered out
        /// 
        public bool FilteredOut
        {
            get { return (_FilteredOut); }
            set { _FilteredOut = value; }
        }
        /// 
        /// Gets or sets whether to re-throw the exception
        /// 
        public bool ThrowException
        {
            get { return (_ThrowException); }
            set { _ThrowException = value; }
        }
        /// 
        /// Gets or sets whether to post/display the error to the user
        /// 
        public bool PostError
        {
            get { return (_PostError); }
            set { _PostError = value; }
        }
        #endregion
    }
    #endregion
    #region GridFilterStoreUserDataEventArgs
    /// 
    /// GridFilterStoreUserDataEventArgs
    /// 
    public class GridFilterStoreUserDataEventArgs : GridCancelEventArgs
    {
        #region Private variables
        private string _FilterPath;
        private List _FilterData;
        #endregion
        ///
        /// GridFilterStoreUserDataEventArgs
        ///
        ///
        ///
        ///
        public GridFilterStoreUserDataEventArgs(
            GridPanel gridPanel, string filterPath, List filterData)
            : base(gridPanel)
        {
            _FilterPath = filterPath;
            _FilterData = filterData;
        }
        #region Public properties
        /// 
        /// Gets or sets the associated FilterData (user defined
        /// Custom filter expressions)
        /// 
        public List FilterData
        {
            get { return (_FilterData); }
            set { _FilterData = value; }
        }
        /// 
        /// Gets or sets the associated Path to
        /// the user defined filter data expression file
        /// 
        public string FilterPath
        {
            get { return (_FilterPath); }
            set { _FilterPath = value; }
        }
        #endregion
    }
    #endregion
    #region GridFilterUserFunctionEventArgs
    /// 
    /// GridFilterUserFunctionEventArgs
    /// 
    public class GridFilterUserFunctionEventArgs : GridRowEventArgs
    {
        #region Private variables
        private object[] _Args;
        private object _Result;
        private bool _Handled;
        #endregion
        ///
        /// GridFilterUserFunctionEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridFilterUserFunctionEventArgs(
            GridPanel gridPanel, GridRow gridRow, object[] args, object result)
            : base(gridPanel, gridRow)
        {
            _Args = args;
            _Result = result;
        }
        #region Public properties
        /// 
        /// Gets or sets the associated function arguments
        /// 
        public object[] Args
        {
            get { return (_Args); }
            set { _Args = value; }
        }
        /// 
        /// Gets or sets whether the function was handled
        /// 
        public bool Handled
        {
            get { return (_Handled); }
            set { _Handled = value; }
        }
        /// 
        /// Gets or sets the associated function result
        /// 
        public object Result
        {
            get { return (_Result); }
            set { _Result = value; }
        }
        #endregion
    }
    #endregion
    #region GridGetGroupDetailRowsEventArgs
    /// 
    /// GridGetGroupDetailRowsEventArgs
    /// 
    public class GridGetGroupDetailRowsEventArgs : GridColumnEventArgs
    {
        #region Private variables
        private GridGroup _GridGroup;
        private List _PreDetailRows;
        private List _PostDetailRows;
        #endregion
        ///
        /// GridGetGroupDetailRowsEventArgs
        ///
        ///
        ///
        ///
        public GridGetGroupDetailRowsEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, GridGroup gridGroup)
            : base(gridPanel, gridColumn)
        {
            _GridGroup = gridGroup;
        }
        #region Public properties
        /// 
        /// Gets or sets the list of Post grouping DetailRows
        /// 
        [Obsolete]
        public List DetailRows
        {
            get { return (_PostDetailRows); }
            set { _PostDetailRows = value; }
        }
        /// 
        /// Gets or sets the list of Post grouping DetailRows
        /// 
        public List PostDetailRows
        {
            get { return (_PostDetailRows); }
            set { _PostDetailRows = value; }
        }
        /// 
        /// Gets or sets the list of Pre grouping DetailRows
        /// 
        public List PreDetailRows
        {
            get { return (_PreDetailRows); }
            set { _PreDetailRows = value; }
        }
        /// 
        /// Gets the associated GridGroup
        /// 
        public GridGroup GridGroup
        {
            get { return (_GridGroup); }
        }
        #endregion
    }
    #endregion
    #region GridItemDragEventArgs
    /// 
    /// GridItemDragEventArgs
    /// 
    public class GridItemDragEventArgs : ItemDragEventArgs
    {
        #region Private variables
        private GridPanel _GridPanel;
        private bool _Cancel;
        #endregion
        ///
        /// GridDragStartedEventArgs
        ///
        ///
        ///
        ///
        public GridItemDragEventArgs(GridPanel gridPanel, GridElement item, MouseEventArgs e)
            : base(e.Button, item)
        {
            _GridPanel = gridPanel;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated GridPanel
        /// 
        public GridPanel GridPanel
        {
            get { return (_GridPanel); }
        }
        #endregion
    }
    #endregion
    #region GridGetCellFormattedValueEventArgs
    /// 
    /// GridGetCellFormattedValueEventArgs
    /// 
    public class GridGetCellFormattedValueEventArgs : GridCellEventArgs
    {
        #region Private variables
        private string _FormattedValue;
        private CellSizingSource _SizingSource;
        #endregion
        ///
        /// GridGetCellFormattedValueEventArgs
        ///
        ///
        ///
        ///
        public GridGetCellFormattedValueEventArgs(
            GridPanel gridPanel, GridCell gridCell, string formattedValue, CellSizingSource sizingSource)
            : base(gridPanel, gridCell)
        {
            _FormattedValue = formattedValue;
            _SizingSource = sizingSource;
        }
        #region Public properties
        /// 
        /// Gets or sets the associated FormattedValue
        /// 
        public string FormattedValue
        {
            get { return (_FormattedValue); }
            set { _FormattedValue = value; }
        }
        /// 
        /// Gets or sets the associated cell SizingSource
        /// 
        public CellSizingSource SizingSource
        {
            get { return (_SizingSource); }
            set { _SizingSource = value; }
        }
        #endregion
    }
    #endregion
    #region GridGetCellRangeFormattedValueEventArgs
    /// 
    /// GridGetCellRangeFormattedValueEventArgs
    /// 
    public class GridGetCellRangeFormattedValueEventArgs : GridRowEventArgs
    {
        #region Private variables
        private CellRange _CellRange;
        private string _FormattedValue;
        #endregion
        ///
        /// GridGetCellRangeFormattedValueEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetCellRangeFormattedValueEventArgs(GridPanel gridPanel,
            GridContainer gridContainer, CellRange cellRange, string formattedValue)
            : base(gridPanel, gridContainer)
        {
            _CellRange = cellRange;
            _FormattedValue = formattedValue;
        }
        #region Public properties
        /// 
        /// Gets the associated CellRange
        /// 
        public CellRange CellRange
        {
            get { return (_CellRange); }
            set { _CellRange = value; }
        }
        /// 
        /// Gets or sets the associated FormattedValue
        /// 
        public string FormattedValue
        {
            get { return (_FormattedValue); }
            set { _FormattedValue = value; }
        }
        #endregion
    }
    #endregion
    #region GridGetCellRangesEventArgs
    /// 
    /// GridGetCellRangesEventArgs
    /// 
    public class GridGetCellRangesEventArgs : GridEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private List _CellRanges;
        private DisplayRange _DisplayRange;
        private GridContainer _GridContainer;
        #endregion
        ///
        /// GridGetCellRangesEventArgs
        ///
        ///Associated GridPanel
        ///Associated GridContainer
        ///Row/col range being merge evaluated
        ///List of CellRanges
        public GridGetCellRangesEventArgs(GridPanel gridPanel,
            GridContainer gridContainer, DisplayRange displayRange, List cellRanges)
            : base(gridPanel)
        {
            _GridContainer = gridContainer;
            _DisplayRange = displayRange;
            _CellRanges = cellRanges;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the default operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets or sets the CellRanges
        /// 
        public List CellRanges
        {
            get { return (_CellRanges); }
            set { _CellRanges = value; }
        }
        /// 
        /// Gets the current DisplayRange (row/col range
        /// being processed / merged evaluated)
        /// 
        public DisplayRange DisplayRange
        {
            get { return (_DisplayRange); }
        }
        /// 
        /// Gets the associated GridContainer 
        /// 
        public GridContainer GridContainer
        {
            get { return (_GridContainer); }
        }
        #endregion
    }
    #endregion
    #region GridGetCellStyleEventArgs
    /// 
    /// GridGetCellStyleEventArgs
    /// 
    public class GridGetCellStyleEventArgs : GridCellEventArgs
    {
        #region Private variables
        private StyleType _StyleType;
        private CellVisualStyle _Style;
        #endregion
        ///
        /// GridGetCellStyleEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetCellStyleEventArgs(
            GridPanel gridPanel, GridCell gridCell, StyleType styleType, CellVisualStyle style)
            : base(gridPanel, gridCell)
        {
            _StyleType = styleType;
            _Style = style;
        }
        #region Public properties
        /// 
        /// Gets the associated StyleType
        /// 
        public StyleType StyleType
        {
            get { return (_StyleType); }
        }
        /// 
        /// Gets or sets the associated VisualStyle
        /// 
        public CellVisualStyle Style
        {
            get { return (_Style); }
            set
            {
                if (value == null)
                    throw new Exception("Style cannot be null.");
                _Style = value;
            }
        }
        #endregion
    }
    #endregion
    #region GridGetCellToolTipEventArgs
    /// 
    /// GridGetCellToolTipEventArgs
    /// 
    public class GridGetCellToolTipEventArgs : GridCellEventArgs
    {
        #region Private variables
        private string _ToolTip;
        private bool _Cancel;
        #endregion
        ///
        /// GridGetCellToolTipEventArgs
        ///
        ///
        ///
        ///
        public GridGetCellToolTipEventArgs(
            GridPanel gridPanel, GridCell gridCell, string toolTip)
            : base(gridPanel, gridCell)
        {
            _ToolTip = toolTip;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets or sets the associated ToolTip text
        /// 
        public string ToolTip
        {
            get { return (_ToolTip); }
            set { _ToolTip = value; }
        }
        #endregion
    }
    #endregion
    #region GridGetCellValueEventArgs
    /// 
    /// GridGetCellValueEventArgs
    /// 
    public class GridGetCellValueEventArgs : GridCellEventArgs
    {
        #region Private variables
        private object _Value;
        #endregion
        ///
        /// GridGetCellValueEventArgs
        ///
        ///
        ///
        ///
        public GridGetCellValueEventArgs(
            GridPanel gridPanel, GridCell gridCell, object value)
            : base(gridPanel, gridCell)
        {
            _Value = value;
        }
        #region Public properties
        /// 
        /// Gets or sets the associated Value
        /// 
        public object Value
        {
            get { return (_Value); }
            set { _Value = value; }
        }
        #endregion
    }
    #endregion
    #region GridGetColumnGroupHeaderStyleEventArgs
    /// 
    /// GridGetColumnGroupHeaderStyleEventArgs
    /// 
    public class GridGetColumnGroupHeaderStyleEventArgs : GridEventArgs
    {
        #region Private variables
        private StyleType _StyleType;
        private ColumnHeaderVisualStyle _Style;
        private ColumnGroupHeader _GroupHeader;
        #endregion
        ///
        /// GridGetColumnGroupHeaderStyleEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetColumnGroupHeaderStyleEventArgs(GridPanel gridPanel,
            ColumnGroupHeader groupHeader, StyleType styleType, ColumnHeaderVisualStyle style)
            : base(gridPanel)
        {
            _GroupHeader = groupHeader;
            _StyleType = styleType;
            _Style = style;
        }
        #region Public properties
        /// 
        /// Gets the associated StyleType
        /// 
        public StyleType StyleType
        {
            get { return (_StyleType); }
        }
        /// 
        /// Gets or sets the associated VisualStyle
        /// 
        public ColumnHeaderVisualStyle Style
        {
            get { return (_Style); }
            set
            {
                if (value == null)
                    throw new Exception("Style cannot by null.");
                _Style = value;
            }
        }
        /// 
        /// Gets the associated ColumnGroupHeader
        /// 
        public ColumnGroupHeader GroupHeader
        {
            get { return (_GroupHeader); }
        }
        #endregion
    }
    #endregion
    #region GridGetColumnHeaderRowHeaderStyleEventArgs
    /// 
    /// GridGetColumnHeaderRowHeaderStyleEventArgs
    /// 
    public class GridGetColumnHeaderRowHeaderStyleEventArgs : GridEventArgs
    {
        #region Private variables
        private StyleType _StyleType;
        private GridColumnHeader _ColumnHeader;
        private ColumnHeaderRowVisualStyle _Style;
        #endregion
        ///
        /// GridGetColumnHeaderRowHeaderStyleEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetColumnHeaderRowHeaderStyleEventArgs(GridPanel gridPanel,
            GridColumnHeader columnHeader, StyleType styleType, ColumnHeaderRowVisualStyle style)
            : base(gridPanel)
        {
            _ColumnHeader = columnHeader;
            _StyleType = styleType;
            _Style = style;
        }
        #region Public properties
        /// 
        /// Gets the associated ColumnHeader
        /// 
        public GridColumnHeader ColumnHeader
        {
            get { return (_ColumnHeader); }
        }
        /// 
        /// Gets the associated StyleType
        /// 
        public StyleType StyleType
        {
            get { return (_StyleType); }
        }
        /// 
        /// Gets or sets the associated VisualStyle
        /// 
        public ColumnHeaderRowVisualStyle Style
        {
            get { return (_Style); }
            set
            {
                if (value == null)
                    throw new Exception("Style cannot by null.");
                _Style = value;
            }
        }
        #endregion
    }
    #endregion
    #region GridGetColumnHeaderStyleEventArgs
    /// 
    /// GridGetColumnHeaderStyleEventArgs
    /// 
    public class GridGetColumnHeaderStyleEventArgs : GridColumnEventArgs
    {
        #region Private variables
        private StyleType _StyleType;
        private ColumnHeaderVisualStyle _Style;
        #endregion
        ///
        /// GridGetColumnHeaderStyleEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetColumnHeaderStyleEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, StyleType styleType, ColumnHeaderVisualStyle style)
            : base(gridPanel, gridColumn)
        {
            _StyleType = styleType;
            _Style = style;
        }
        #region Public properties
        /// 
        /// Gets the associated StyleType
        /// 
        public StyleType StyleType
        {
            get { return (_StyleType); }
        }
        /// 
        /// Gets or sets the associated VisualStyle
        /// 
        public ColumnHeaderVisualStyle Style
        {
            get { return (_Style); }
            set
            {
                if (value == null)
                    throw new Exception("Style cannot by null.");
                _Style = value;
            }
        }
        #endregion
    }
    #endregion
    #region GridGetColumnGroupHeaderToolTipEventArgs
    /// 
    /// GridGetColumnGroupHeaderToolTipEventArgs
    /// 
    public class GridGetColumnGroupHeaderToolTipEventArgs : GridEventArgs
    {
        #region Private variables
        private string _ToolTip;
        private HeaderArea _HitArea;
        private ColumnGroupHeader _GroupHeader;
        private bool _Cancel;
        #endregion
        ///
        /// GridGetColumnGroupHeaderToolTipEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetColumnGroupHeaderToolTipEventArgs(
            GridPanel gridPanel, ColumnGroupHeader groupHeader, HeaderArea hitArea, string toolTip)
            : base(gridPanel)
        {
            _GroupHeader = groupHeader;
            _HitArea = hitArea;
            _ToolTip = toolTip;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated ColumnGroupHeader
        /// 
        public ColumnGroupHeader GroupHeader
        {
            get { return (_GroupHeader); }
        }
        /// 
        /// Gets the associated Header hit area
        /// 
        public HeaderArea HitArea
        {
            get { return (_HitArea); }
        }
        /// 
        /// Gets or sets the associated ToolTip text
        /// 
        public string ToolTip
        {
            get { return (_ToolTip); }
            set { _ToolTip = value; }
        }
        #endregion
    }
    #endregion
    #region GridGetColumnHeaderToolTipEventArgs
    /// 
    /// GridGetColumnHeaderToolTipEventArgs
    /// 
    public class GridGetColumnHeaderToolTipEventArgs : GridColumnEventArgs
    {
        #region Private variables
        private string _ToolTip;
        private HeaderArea _HitArea;
        private bool _Cancel;
        #endregion
        ///
        /// GridGetColumnHeaderToolTipEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetColumnHeaderToolTipEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, HeaderArea hitArea, string toolTip)
            : base(gridPanel, gridColumn)
        {
            _HitArea = hitArea;
            _ToolTip = toolTip;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated Header hit area
        /// 
        public HeaderArea HitArea
        {
            get { return (_HitArea); }
        }
        /// 
        /// Gets or sets the associated ToolTip text
        /// 
        public string ToolTip
        {
            get { return (_ToolTip); }
            set { _ToolTip = value; }
        }
        #endregion
    }
    #endregion
    #region GridGetDisplayRangesEventArgs
    /// 
    /// GridGetDisplayRangesEventArgs
    /// 
    public class GridGetDisplayRangesEventArgs : GridEventArgs
    {
        #region Private variables
        private List _DisplayRanges;
        private GridContainer _GridContainer;
        #endregion
        ///
        /// GridGetDisplayRangesEventArgs
        ///
        ///Associated GridPanel
        ///Associated GridContainer
        ///List of Row/col ranges to be merge evaluated
        public GridGetDisplayRangesEventArgs(GridPanel gridPanel,
            GridContainer gridContainer, List displayRanges)
            : base(gridPanel)
        {
            _GridContainer = gridContainer;
            _DisplayRanges = displayRanges;
        }
        #region Public properties
        /// 
        /// Gets or sets the DisplayRanges
        /// 
        public List DisplayRanges
        {
            get { return (_DisplayRanges); }
            set { _DisplayRanges = value; }
        }
        /// 
        /// Gets the associated GridContainer 
        /// 
        public GridContainer GridContainer
        {
            get { return (_GridContainer); }
        }
        #endregion
    }
    #endregion
    #region GridGetFilterRowStyleEventArgs
    /// 
    /// GridGetFilterRowStyleEventArgs
    /// 
    public class GridGetFilterRowStyleEventArgs : GridEventArgs
    {
        #region Private variables
        private StyleType _StyleType;
        private GridFilter _GridFilter;
        private FilterRowVisualStyle _Style;
        #endregion
        ///
        /// GridGetFilterRowStyleEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetFilterRowStyleEventArgs(GridPanel gridPanel,
            GridFilter gridFilter, StyleType styleType, FilterRowVisualStyle style)
            : base(gridPanel)
        {
            _GridFilter = gridFilter;
            _StyleType = styleType;
            _Style = style;
        }
        #region Public properties
        /// 
        /// Gets the associated GridFilter
        /// 
        public GridFilter GridFilter
        {
            get { return (_GridFilter); }
        }
        /// 
        /// Gets the associated StyleType
        /// 
        public StyleType StyleType
        {
            get { return (_StyleType); }
        }
        /// 
        /// Gets or sets the associated VisualStyle
        /// 
        public FilterRowVisualStyle Style
        {
            get { return (_Style); }
            set
            {
                if (value == null)
                    throw new Exception("Style cannot by null.");
                _Style = value;
            }
        }
        #endregion
    }
    #endregion
    #region GridGetFilterColumnHeaderStyleEventArgs
    /// 
    /// GridGetFilterColumnHeaderStyleEventArgs
    /// 
    public class GridGetFilterColumnHeaderStyleEventArgs : GridColumnEventArgs
    {
        #region Private variables
        private StyleType _StyleType;
        private FilterColumnHeaderVisualStyle _Style;
        #endregion
        ///
        /// GridGetFilterColumnHeaderStyleEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetFilterColumnHeaderStyleEventArgs(GridPanel gridPanel,
            GridColumn gridColumn, StyleType styleType, FilterColumnHeaderVisualStyle style)
            : base(gridPanel, gridColumn)
        {
            _StyleType = styleType;
            _Style = style;
        }
        #region Public properties
        /// 
        /// Gets the associated StyleType
        /// 
        public StyleType StyleType
        {
            get { return (_StyleType); }
        }
        /// 
        /// Gets or sets the associated VisualStyle
        /// 
        public FilterColumnHeaderVisualStyle Style
        {
            get { return (_Style); }
            set
            {
                if (value == null)
                    throw new Exception("Style cannot by null.");
                _Style = value;
            }
        }
        #endregion
    }
    #endregion
    #region GridConfigureGroupBoxEventArgs
    /// 
    /// GridConfigureGroupBoxEventArgs
    /// 
    public class GridConfigureGroupBoxEventArgs : GridEventArgs
    {
        #region Private variables
        private GridGroupByRow _GroupByRow;
        private GridGroupBox _GridGroupBox;
        #endregion
        ///
        /// GridConfigureGroupBoxEventArgs
        ///
        ///
        ///
        ///
        public GridConfigureGroupBoxEventArgs(GridPanel gridPanel,
            GridGroupByRow groupByRow, GridGroupBox gridGroupBox)
            : base(gridPanel)
        {
            _GroupByRow = groupByRow;
            _GridGroupBox = gridGroupBox;
        }
        #region Public properties
        /// 
        /// Gets the associated GroupByRow
        /// 
        public GridGroupByRow GroupByRow
        {
            get { return (_GroupByRow); }
        }
        /// 
        /// Gets the associated GridColumn
        /// 
        public GridGroupBox GridGroupBox
        {
            get { return (_GridGroupBox); }
        }
        #endregion
    }
    #endregion
    #region GridGetGroupHeaderStyleEventArgs
    /// 
    /// GridGetGroupHeaderStyleEventArgs
    /// 
    public class GridGetGroupHeaderStyleEventArgs : GridEventArgs
    {
        #region Private variables
        private GridGroup _GridRow;
        private StyleType _StyleType;
        private GroupHeaderVisualStyle _Style;
        #endregion
        ///
        /// GridGetGroupHeaderStyleEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetGroupHeaderStyleEventArgs(
            GridPanel gridPanel, GridGroup gridRow, StyleType styleType, GroupHeaderVisualStyle style)
            : base(gridPanel)
        {
            _GridRow = gridRow;
            _StyleType = styleType;
            _Style = style;
        }
        #region Public properties
        /// 
        /// Gets the associated StyleType
        /// 
        public StyleType StyleType
        {
            get { return (_StyleType); }
        }
        /// 
        /// Gets the associated Group Header Row
        /// 
        public GridGroup GridRow
        {
            get { return (_GridRow); }
        }
        /// 
        /// Gets or sets the associated VisualStyle
        /// 
        public GroupHeaderVisualStyle Style
        {
            get { return (_Style); }
            set
            {
                if (value == null)
                    throw new Exception("Style cannot by null.");
                _Style = value;
            }
        }
        #endregion
    }
    #endregion
    #region GridGetMergedCellStyleEventArgs
    /// 
    /// GridGetMergedCellStyleEventArgs
    /// 
    public class GridGetMergedCellStyleEventArgs : GridEventArgs
    {
        #region Private variables
        private CellRange _CellRange;
        private StyleType _StyleType;
        private CellVisualStyle _Style;
        #endregion
        ///
        /// GridGetMergedCellStyleEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetMergedCellStyleEventArgs(
            GridPanel gridPanel, CellRange cellRange, StyleType styleType, CellVisualStyle style)
            : base(gridPanel)
        {
            _CellRange = cellRange;
            _StyleType = styleType;
            _Style = style;
        }
        #region Public properties
        /// 
        /// Gets the associated CellRange
        /// 
        public CellRange CellRange
        {
            get { return (_CellRange); }
        }
        /// 
        /// Gets the associated StyleType
        /// 
        public StyleType StyleType
        {
            get { return (_StyleType); }
        }
        /// 
        /// Gets or sets the associated VisualStyle
        /// 
        public CellVisualStyle Style
        {
            get { return (_Style); }
            set
            {
                if (value == null)
                    throw new Exception("Style cannot by null.");
                _Style = value;
            }
        }
        #endregion
    }
    #endregion
    #region GridGetPanelStyleEventArgs
    /// 
    /// GridGetPanelStyleEventArgs
    /// 
    public class GridGetPanelStyleEventArgs : GridEventArgs
    {
        #region Private variables
        private GridPanelVisualStyle _Style;
        #endregion
        ///
        /// GridGetPanelStyleEventArgs
        ///
        ///
        ///
        public GridGetPanelStyleEventArgs(GridPanel gridPanel, GridPanelVisualStyle style)
            : base(gridPanel)
        {
            _Style = style;
        }
        #region Public properties
        /// 
        /// Gets or sets the associated VisualStyle
        /// 
        public GridPanelVisualStyle Style
        {
            get { return (_Style); }
            set
            {
                if (value == null)
                    throw new Exception("Style cannot by null.");
                _Style = value;
            }
        }
        #endregion
    }
    #endregion
    #region GridGetRowCellStyleEventArgs
    /// 
    /// GridGetRowCellStyleEventArgs
    /// 
    public class GridGetRowCellStyleEventArgs : GridRowEventArgs
    {
        #region Private variables
        private StyleType _StyleType;
        private CellVisualStyle _Style;
        #endregion
        ///
        /// GridGetRowCellStyleEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetRowCellStyleEventArgs(
            GridPanel gridPanel, GridContainer gridRow, StyleType styleType, CellVisualStyle style)
            : base(gridPanel, gridRow)
        {
            _StyleType = styleType;
            _Style = style;
        }
        #region Public properties
        /// 
        /// Gets the associated StyleType
        /// 
        public StyleType StyleType
        {
            get { return (_StyleType); }
        }
        /// 
        /// Gets or sets the associated VisualStyle
        /// 
        public CellVisualStyle Style
        {
            get { return (_Style); }
            set
            {
                if (value == null)
                    throw new Exception("Style cannot by null.");
                _Style = value;
            }
        }
        #endregion
    }
    #endregion
    #region GridGetRowHeaderStyleEventArgs
    /// 
    /// GridGetRowHeaderStyleEventArgs
    /// 
    public class GridGetRowHeaderStyleEventArgs : GridRowEventArgs
    {
        #region Private variables
        private StyleType _StyleType;
        private RowHeaderVisualStyle _Style;
        #endregion
        ///
        /// GridGetRowHeaderStyleEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetRowHeaderStyleEventArgs(
            GridPanel gridPanel, GridContainer row, StyleType styleType, RowHeaderVisualStyle style)
            : base(gridPanel, row)
        {
            _StyleType = styleType;
            _Style = style;
        }
        #region Public properties
        /// 
        /// Gets the associated StyleType
        /// 
        public StyleType StyleType
        {
            get { return (_StyleType); }
        }
        /// 
        /// Gets or sets the associated VisualStyle
        /// 
        public RowHeaderVisualStyle Style
        {
            get { return (_Style); }
            set
            {
                if (value == null)
                    throw new Exception("Style cannot by null.");
                _Style = value;
            }
        }
        #endregion
    }
    #endregion
    #region GridGetRowHeaderTextEventArgs
    /// 
    /// GridGetRowHeaderTextEventArgs
    /// 
    public class GridGetRowHeaderTextEventArgs : GridRowEventArgs
    {
        #region Private variables
        private string _Text;
        #endregion
        ///
        /// GridGetRowHeaderTextEventArgs
        ///
        ///Associated GridPanel
        ///Associated container row
        ///Text to display in row header
        public GridGetRowHeaderTextEventArgs(
            GridPanel gridPanel, GridContainer row, string text)
            : base(gridPanel, row)
        {
            _Text = text;
        }
        #region Public properties
        /// 
        /// Gets or sets the associated header text
        /// 
        public string Text
        {
            get { return (_Text); }
            set { _Text = value; }
        }
        #endregion
    }
    #endregion
    #region GridGetRowStyleEventArgs
    /// 
    /// GridGetRowStyleEventArgs
    /// 
    public class GridGetRowStyleEventArgs : GridRowEventArgs
    {
        #region Private variables
        private StyleType _StyleType;
        private RowVisualStyle _Style;
        #endregion
        ///
        /// GridGetCellStyleEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetRowStyleEventArgs(
            GridPanel gridPanel, GridContainer gridRow, StyleType styleType, RowVisualStyle style)
            : base(gridPanel, gridRow)
        {
            _StyleType = styleType;
            _Style = style;
        }
        #region Public properties
        /// 
        /// Gets the associated StyleType
        /// 
        public StyleType StyleType
        {
            get { return (_StyleType); }
        }
        /// 
        /// Gets or sets the associated VisualStyle
        /// 
        public RowVisualStyle Style
        {
            get { return (_Style); }
            set
            {
                if (value == null)
                    throw new Exception("Style cannot by null.");
                _Style = value;
            }
        }
        #endregion
    }
    #endregion
    #region GridGetTextRowStyleEventArgs
    /// 
    /// GridGetTextRowStyleEventArgs
    /// 
    public class GridGetTextRowStyleEventArgs : GridEventArgs
    {
        #region Private variables
        private StyleType _StyleType;
        private TextRowVisualStyle _Style;
        private readonly GridTextRow _GridTextRow;
        #endregion
        ///
        /// GridGetTextRowStyleEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetTextRowStyleEventArgs(
            GridPanel gridPanel, GridTextRow gridTextRow, StyleType styleType, TextRowVisualStyle style)
            : base(gridPanel)
        {
            _GridTextRow = gridTextRow;
            _StyleType = styleType;
            _Style = style;
        }
        #region Public properties
        /// 
        /// Gets the associated StyleType
        /// 
        public StyleType StyleType
        {
            get { return (_StyleType); }
        }
        /// 
        /// Gets or sets the associated VisualStyle
        /// 
        public TextRowVisualStyle Style
        {
            get { return (_Style); }
            set
            {
                if (value == null)
                    throw new Exception("Style cannot by null.");
                _Style = value;
            }
        }
        /// 
        /// Gets the associated GridTextRow
        /// 
        public GridTextRow GridTextRow
        {
            get { return (_GridTextRow); }
        }
        #endregion
    }
    #endregion
    #region GridEditEventArgs
    /// 
    /// GridEditEventArgs
    /// 
    public class GridEditEventArgs : CancelEventArgs
    {
        #region Private variables
        private GridPanel _GridPanel;
        private GridCell _GridCell;
        private IGridCellEditControl _EditControl;
        #endregion
        ///
        /// GridEditEventArgs
        ///
        public GridEditEventArgs(
            GridPanel gridPanel, GridCell gridCell, IGridCellEditControl editControl)
        {
            _GridPanel = gridPanel;
            _GridCell = gridCell;
            _EditControl = editControl;
        }
        #region Public properties
        /// 
        /// Gets the associated GridPanel
        /// 
        public GridPanel GridPanel
        {
            get { return (_GridPanel); }
        }
        /// 
        /// Gets the associated cell
        /// 
        public GridCell GridCell
        {
            get { return (_GridCell); }
        }
        /// 
        /// Gets the associated cell EditControl
        /// 
        public IGridCellEditControl EditControl
        {
            get { return (_EditControl); }
        }
        #endregion
    }
    #endregion
    #region GridEventArgs
    /// 
    /// GridEventArgs
    /// 
    public class GridEventArgs : EventArgs
    {
        #region Private variables
        private readonly GridPanel _GridPanel;
        #endregion
        ///
        /// GridEventArgs
        ///
        ///
        public GridEventArgs(GridPanel gridPanel)
        {
            _GridPanel = gridPanel;
        }
        #region Public properties
        /// 
        /// Gets the event Grid
        /// 
        public GridPanel GridPanel
        {
            get { return (_GridPanel); }
        }
        #endregion
    }
    #endregion
    #region GridCancelEventArgs
    /// 
    /// GridCancelEventArgs
    /// 
    public class GridCancelEventArgs : GridEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridEventArgs
        ///
        ///
        public GridCancelEventArgs(GridPanel gridPanel)
            : base(gridPanel)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether
        /// to cancel the operation entirely
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridCloseEditEventArgs
    /// 
    /// GridCloseEditEventArgs
    /// 
    public class GridCloseEditEventArgs : GridCellEventArgs
    {
        ///
        /// GridCloseEditEventArgs
        ///
        public GridCloseEditEventArgs(GridPanel gridPanel, GridCell gridCell)
            : base(gridPanel, gridCell)
        {
        }
    }
    #endregion
    #region GridGetEditorEventArgs
    /// 
    /// GridGetEditorEventArgs
    /// 
    public class GridGetEditorEventArgs : GridEventArgs
    {
        #region Private variables
        private readonly GridCell _GridCell;
        private Type _EditorType;
        private object[] _EditorParams;
        #endregion
        ///
        /// GridGetEditorEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetEditorEventArgs(
            GridPanel gridPanel, GridCell gridCell, Type editorType, object[] editorParams)
            : base(gridPanel)
        {
            _GridCell = gridCell;
            _EditorType = editorType;
            _EditorParams = editorParams;
        }
        #region Public properties
        /// 
        /// Gets the associated GridCell
        /// 
        public GridCell GridCell
        {
            get { return (_GridCell); }
        }
        /// 
        /// Gets or sets the associated cell editor Type
        /// 
        public Type EditorType
        {
            get { return (_EditorType); }
            set { _EditorType = value; }
        }
        /// 
        /// Gets or sets the associated cell editor params
        /// 
        public object[] EditorParams
        {
            get { return (_EditorParams); }
            set { _EditorParams = value; }
        }
        #endregion
    }
    #endregion
    #region GridGetRendererEventArgs
    /// 
    /// GridGetRendererEventArgs
    /// 
    public class GridGetRendererEventArgs : GridEventArgs
    {
        #region Private variables
        private readonly GridCell _GridCell;
        private Type _RenderType;
        private object[] _RenderParams;
        #endregion
        ///
        /// GridGetRendererEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGetRendererEventArgs(
            GridPanel gridPanel, GridCell gridCell, Type renderType, object[] renderParams)
            : base(gridPanel)
        {
            _GridCell = gridCell;
            _RenderType = renderType;
            _RenderParams = renderParams;
        }
        #region Public properties
        /// 
        /// Gets the associated GridCell
        /// 
        public GridCell GridCell
        {
            get { return (_GridCell); }
        }
        /// 
        /// Gets or sets the associated cell Render Type
        /// 
        public Type RenderType
        {
            get { return (_RenderType); }
            set { _RenderType = value; }
        }
        /// 
        /// Gets or sets the associated cell Render params
        /// 
        public object[] RenderParams
        {
            get { return (_RenderParams); }
            set { _RenderParams = value; }
        }
        #endregion
    }
    #endregion
    #region GridGetFilterEditTypeEventArgs
    /// 
    /// GridGetFilterEditTypeEventArgs
    /// 
    public class GridGetFilterEditTypeEventArgs : GridColumnEventArgs
    {
        #region Private variables
        private FilterEditType _FilterEditType;
        #endregion
        ///
        /// GridGetFilterEditTypeEventArgs
        ///
        ///
        ///
        ///
        public GridGetFilterEditTypeEventArgs(
            GridPanel gridPanel, GridColumn gridColumn, FilterEditType filterEditType)
            : base(gridPanel, gridColumn)
        {
            _FilterEditType = filterEditType;
        }
        #region Public properties
        /// 
        /// Gets the associated Filter edit type
        /// 
        public FilterEditType FilterEditType
        {
            get { return (_FilterEditType); }
            set { _FilterEditType = value; }
        }
        #endregion
    }
    #endregion
    #region GridGroupChangedEventArgs
    /// 
    /// GridGroupChangedEventArgs
    /// 
    public class GridGroupChangedEventArgs : GridEventArgs
    {
        #region Private variables
        private GroupChangedAction _Action;
        private GridColumn _GridColumn;
        #endregion
        ///
        /// GridRowClickEventArgs
        ///
        ///
        ///
        ///
        public GridGroupChangedEventArgs(
            GridPanel gridPanel, GroupChangedAction action, GridColumn column)
            : base(gridPanel)
        {
            _Action = action;
            _GridColumn = column;
        }
        #region Public properties
        /// 
        /// Gets the associated GroupChangedAction
        /// 
        public GroupChangedAction Action
        {
            get { return (_Action); }
        }
        /// 
        /// Gets the associated GridColumn
        /// 
        public GridColumn GridColumn
        {
            get { return (_GridColumn); }
        }
        #endregion
    }
    #endregion
    #region GridGroupHeaderClickEventArgs
    /// 
    /// GridGroupHeaderClickEventArgs
    /// 
    public class GridGroupHeaderClickEventArgs : GridEventArgs
    {
        #region Private variables
        private GridGroup _GridGroup;
        private bool _Cancel;
        private GroupArea _GroupArea;
        private MouseEventArgs _MouseEventArgs;
        #endregion
        ///
        /// GridRowClickEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGroupHeaderClickEventArgs(
            GridPanel gridPanel, GridGroup gridGroup, GroupArea area, MouseEventArgs e)
            : base(gridPanel)
        {
            _GridGroup = gridGroup;
            _GroupArea = area;
            _MouseEventArgs = e;
        }
        #region Public properties
        /// 
        /// Gets the associated GridGroup
        /// 
        public GridGroup GridGroup
        {
            get { return (_GridGroup); }
        }
        /// 
        /// Gets or sets whether to cancel the default operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated MouseEventArgs
        /// 
        public MouseEventArgs MouseEventArgs
        {
            get { return (_MouseEventArgs); }
        }
        /// 
        /// Gets the associated GroupArea
        /// 
        public GroupArea GroupArea
        {
            get { return (_GroupArea); }
        }
        #endregion
    }
    #endregion
    #region GridGroupHeaderDoubleClickEventArgs
    /// 
    /// GridGroupHeaderDoubleClickEventArgs
    /// 
    public class GridGroupHeaderDoubleClickEventArgs : GridGroupHeaderClickEventArgs
    {
        ///
        /// GridRowClickEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridGroupHeaderDoubleClickEventArgs(
            GridPanel gridPanel, GridGroup gridGroup, GroupArea area, MouseEventArgs e)
            : base(gridPanel, gridGroup, area, e)
        {
        }
    }
    #endregion
    #region GridInitEditContextEventArgs
    /// 
    /// GridInitEditContextEventArgs
    /// 
    public class GridInitEditContextEventArgs : GridCellEventArgs
    {
        #region Private variables
        private readonly IGridCellEditControl _EditControl;
        #endregion
        ///
        /// GridInitEditContextEventArgs
        ///
        ///
        ///
        ///
        public GridInitEditContextEventArgs(GridPanel gridPanel,
            GridCell gridCell, IGridCellEditControl editControl)
            : base(gridPanel, gridCell)
        {
            _EditControl = editControl;
        }
        #region Public properties
        /// 
        /// Gets the associated GridCell
        /// 
        public IGridCellEditControl EditControl
        {
            get { return (_EditControl); }
        }
        #endregion
    }
    #endregion
    #region GridNoRowsTextMarkupLinkClickEventArgs
    /// 
    /// GridNoRowsMarkupLinkClickEventArgs
    /// 
    public class GridNoRowsMarkupLinkClickEventArgs : GridEventArgs
    {
        #region Private variables
        private string _HRef;
        private string _Name;
        #endregion
        ///
        /// GridNoRowsMarkupLinkClickEventArgs
        ///
        ///
        ///
        ///
        public GridNoRowsMarkupLinkClickEventArgs(
            GridPanel gridPanel, string name, string href)
            : base(gridPanel)
        {
            _HRef = href;
            _Name = name;
        }
        #region Public properties
        /// 
        /// Gets the associated HyperLink HRef
        /// 
        public string HRef
        {
            get { return (_HRef); }
        }
        /// 
        /// Gets the associated HyperLink Name
        /// 
        public string Name
        {
            get { return (_Name); }
        }
        #endregion
    }
    #endregion
    #region GridPlayingSoundEventArgs
    /// 
    /// GridPlayingSoundEventArgs
    /// 
    public class GridPlayingSoundEventArgs : CancelEventArgs
    {
        #region Private variables
        private GridPanel _GridPanel;
        private object _Item;
        private PlaySoundContext _PlaySoundContext;
        #endregion
        /// 
        /// GridPlayingSoundEventArgs
        /// 
        /// 
        /// 
        /// 
        public GridPlayingSoundEventArgs(
            GridPanel panel, object item, PlaySoundContext context)
        {
            _GridPanel = panel;
            _Item = item;
            _PlaySoundContext = context;
        }
        #region Public properties
        /// 
        /// Gets the GridPanel
        /// 
        public GridPanel GridPanel
        {
            get { return (_GridPanel); }
        }
        /// 
        /// Gets the grid "item" (GridCell, GridRow, CellRange, etc)
        /// associated with the event.
        /// 
        public object Item
        {
            get { return (_Item); }
        }
        /// 
        /// Gets the context under which the event is being played.
        /// 
        public PlaySoundContext PlaySoundContext
        {
            get { return (_PlaySoundContext); }
        }
        #endregion
    }
    #endregion
    #region GridPostRenderCellEventArgs
    /// 
    /// GridPostRenderCellEventArgs
    /// 
    public class GridPostRenderCellEventArgs : GridCellEventArgs
    {
        #region Private variables
        private Rectangle _Bounds;
        private Graphics _Graphics;
        private RenderParts _RenderParts;
        #endregion
        ///
        /// GridPostRenderCellEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPostRenderCellEventArgs(Graphics graphics,
            GridPanel gridPanel, GridCell gridCell, RenderParts parts, Rectangle bounds)
            : base(gridPanel, gridCell)
        {
            _Bounds = bounds;
            _Graphics = graphics;
            _RenderParts = parts;
        }
        #region Public properties
        /// 
        /// Gets the cell bounding rectangle
        /// 
        public Rectangle Bounds
        {
            get { return (_Bounds); }
        }
        /// 
        /// Gets the Graphics object
        /// 
        public Graphics Graphics
        {
            get { return (_Graphics); }
        }
        /// 
        /// Gets the cell parts to render
        /// 
        public RenderParts RenderParts
        {
            get { return (_RenderParts); }
        }
        #endregion
    }
    #endregion
    #region GridPreRenderCellEventArgs
    /// 
    /// GridPreRenderCellEventArgs
    /// 
    public class GridPreRenderCellEventArgs : GridPostRenderCellEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridPreRenderCellEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPreRenderCellEventArgs(Graphics graphics,
            GridPanel gridPanel, GridCell gridCell, RenderParts parts, Rectangle bounds)
            : base(graphics, gridPanel, gridCell, parts, bounds)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether
        /// to cancel the operation entirely
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridPostRenderRowEventArgs
    /// 
    /// GridPostRenderRowEventArgs
    /// 
    public class GridPostRenderRowEventArgs : GridRowEventArgs
    {
        #region Private variables
        private Graphics _Graphics;
        private Rectangle _Bounds;
        private RenderParts _RenderParts;
        #endregion
        ///
        /// GridPostRenderEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPostRenderRowEventArgs(Graphics graphics, GridPanel gridPanel,
            GridContainer gridRow, RenderParts parts, Rectangle bounds)
            : base(gridPanel, gridRow)
        {
            _Graphics = graphics;
            _RenderParts = parts;
            _Bounds = bounds;
        }
        #region Public properties
        /// 
        /// Gets the Graphics object
        /// 
        public Graphics Graphics
        {
            get { return (_Graphics); }
        }
        /// 
        /// Gets the bounding rectangle
        /// 
        public Rectangle Bounds
        {
            get { return (_Bounds); }
        }
        /// 
        /// Gets the parts to render
        /// 
        public RenderParts RenderParts
        {
            get { return (_RenderParts); }
        }
        #endregion
    }
    #endregion
    #region GridPreRenderRowEventArgs
    /// 
    /// GridPreRenderRowEventArgs
    /// 
    public class GridPreRenderRowEventArgs : GridPostRenderRowEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridPreRenderRowEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPreRenderRowEventArgs(Graphics graphics, GridPanel gridPanel,
            GridContainer gridRow, RenderParts parts, Rectangle bounds)
            : base(graphics, gridPanel, gridRow, parts, bounds)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether
        /// to cancel the operation entirely
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridPostRenderColumnHeaderEventArgs
    /// 
    /// GridPostRenderColumnHeaderEventArgs
    /// 
    public class GridPostRenderColumnHeaderEventArgs : GridEventArgs
    {
        #region Private variables
        private Rectangle _Bounds;
        private Graphics _Graphics;
        private GridColumnHeader _ColumnHeader;
        private GridColumn _GridColumn;
        private RenderParts _RenderParts;
        #endregion
        ///
        /// GridPostRenderColumnHeaderEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPostRenderColumnHeaderEventArgs(Graphics graphics, GridPanel gridPanel,
            GridColumnHeader columnHeader, GridColumn column, RenderParts parts, Rectangle bounds)
            : base(gridPanel)
        {
            _Bounds = bounds;
            _Graphics = graphics;
            _ColumnHeader = columnHeader;
            _GridColumn = column;
            _RenderParts = parts;
        }
        #region Public properties
        /// 
        /// Gets the cell bounding rectangle
        /// 
        public Rectangle Bounds
        {
            get { return (_Bounds); }
        }
        /// 
        /// Gets the Graphics object
        /// 
        public Graphics Graphics
        {
            get { return (_Graphics); }
        }
        /// 
        /// Gets the associated GridColumnHeader
        /// 
        public GridColumnHeader ColumnHeader
        {
            get { return (_ColumnHeader); }
        }
        /// 
        /// Gets the associated GridColumn (which can be null
        /// if the ColumnHeader's RowHeader is being rendered)
        /// 
        public GridColumn GridColumn
        {
            get { return (_GridColumn); }
        }
        /// 
        /// Gets the cell parts to render
        /// 
        public RenderParts RenderParts
        {
            get { return (_RenderParts); }
        }
        #endregion
    }
    #endregion
    #region GridPreRenderColumnHeaderEventArgs
    /// 
    /// GridPreRenderColumnHeaderEventArgs
    /// 
    public class GridPreRenderColumnHeaderEventArgs : GridPostRenderColumnHeaderEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridPreRenderColumnHeaderEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPreRenderColumnHeaderEventArgs(Graphics graphics, GridPanel gridPanel,
            GridColumnHeader header, GridColumn column, RenderParts parts, Rectangle bounds)
            : base(graphics, gridPanel, header, column, parts, bounds)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether
        /// to cancel the operation entirely
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridPostRenderColumnGroupHeaderEventArgs
    /// 
    /// GridPostRenderColumnGroupHeaderEventArgs
    /// 
    public class GridPostRenderColumnGroupHeaderEventArgs : GridEventArgs
    {
        #region Private variables
        private Rectangle _Bounds;
        private Graphics _Graphics;
        private GridColumnHeader _ColumnHeader;
        private ColumnGroupHeader _GroupHeader;
        private RenderParts _RenderParts;
        #endregion
        ///
        /// GridPostRenderColumnGroupHeaderEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPostRenderColumnGroupHeaderEventArgs(Graphics graphics, GridPanel gridPanel,
            GridColumnHeader columnHeader, ColumnGroupHeader groupHeader, RenderParts parts, Rectangle bounds)
            : base(gridPanel)
        {
            _Bounds = bounds;
            _Graphics = graphics;
            _ColumnHeader = columnHeader;
            _GroupHeader = groupHeader;
            _RenderParts = parts;
        }
        #region Public properties
        /// 
        /// Gets the cell bounding rectangle
        /// 
        public Rectangle Bounds
        {
            get { return (_Bounds); }
        }
        /// 
        /// Gets the Graphics object
        /// 
        public Graphics Graphics
        {
            get { return (_Graphics); }
        }
        /// 
        /// Gets the associated ColumnHeader
        /// 
        public GridColumnHeader ColumnHeader
        {
            get { return (_ColumnHeader); }
        }
        /// 
        /// Gets the associated GroupHeader
        /// 
        public ColumnGroupHeader GroupHeader
        {
            get { return (_GroupHeader); }
        }
        /// 
        /// Gets the cell parts to render
        /// 
        public RenderParts RenderParts
        {
            get { return (_RenderParts); }
        }
        #endregion
    }
    #endregion
    #region GridPreRenderColumnGroupHeaderEventArgs
    /// 
    /// GridPreRenderColumnGroupHeaderEventArgs
    /// 
    public class GridPreRenderColumnGroupHeaderEventArgs : GridPostRenderColumnGroupHeaderEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridPreRenderColumnGroupHeaderEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPreRenderColumnGroupHeaderEventArgs(Graphics graphics, GridPanel gridPanel,
            GridColumnHeader header, ColumnGroupHeader groupHeader, RenderParts parts, Rectangle bounds)
            : base(graphics, gridPanel, header, groupHeader, parts, bounds)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether
        /// to cancel the operation entirely
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridPostRenderFilterPopupGripBarEventArgs
    /// 
    /// GridPostRenderFilterPopupGripBarEventArgs
    /// 
    public class GridPostRenderFilterPopupGripBarEventArgs : GridColumnEventArgs
    {
        #region Private variables
        private Graphics _Graphics;
        private FilterPopup _FilterPopup;
        private Rectangle _Bounds;
        #endregion
        ///
        /// GridPostRenderFilterPopupGripBarEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridPostRenderFilterPopupGripBarEventArgs(Graphics graphics,
            FilterPopup filterPopup, GridColumn gridColumn, Rectangle bounds)
            : base(gridColumn.GridPanel, gridColumn)
        {
            _Graphics = graphics;
            _FilterPopup = filterPopup;
            _Bounds = bounds;
        }
        #region Public properties
        /// 
        /// Gets the GripBar bounding rectangle
        /// 
        public Rectangle Bounds
        {
            get { return (_Bounds); }
        }
        /// 
        /// Gets the FilterPopup object
        /// 
        public FilterPopup FilterPopup
        {
            get { return (_FilterPopup); }
        }
        /// 
        /// Gets the Graphics object
        /// 
        public Graphics Graphics
        {
            get { return (_Graphics); }
        }
        #endregion
    }
    #endregion
    #region GridPreRenderFilterPopupGripBarEventArgs
    /// 
    /// GridPreRenderFilterPopupGripBarEventArgs
    /// 
    public class GridPreRenderFilterPopupGripBarEventArgs : GridPostRenderFilterPopupGripBarEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridPreRenderFilterPopupGripBarEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridPreRenderFilterPopupGripBarEventArgs(Graphics graphics,
            FilterPopup filterPopup, GridColumn gridColumn, Rectangle bounds)
            : base(graphics, filterPopup, gridColumn, bounds)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation entirely
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridPostRenderFilterRowEventArgs
    /// 
    /// GridPostRenderFilterRowEventArgs
    /// 
    public class GridPostRenderFilterRowEventArgs : GridEventArgs
    {
        #region Private variables
        private Rectangle _Bounds;
        private Graphics _Graphics;
        private GridFilter _GridFilter;
        private GridColumn _GridColumn;
        private RenderParts _RenderParts;
        #endregion
        ///
        /// GridPostRenderFilterRowEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPostRenderFilterRowEventArgs(Graphics graphics, GridPanel gridPanel,
            GridFilter filter, GridColumn column, RenderParts parts, Rectangle bounds)
            : base(gridPanel)
        {
            _Bounds = bounds;
            _Graphics = graphics;
            _GridFilter = filter;
            _GridColumn = column;
            _RenderParts = parts;
        }
        #region Public properties
        /// 
        /// Gets the bounding rectangle
        /// 
        public Rectangle Bounds
        {
            get { return (_Bounds); }
        }
        /// 
        /// Gets the Graphics object
        /// 
        public Graphics Graphics
        {
            get { return (_Graphics); }
        }
        /// 
        /// Gets the associated GridFilter
        /// 
        public GridFilter GridFilter
        {
            get { return (_GridFilter); }
        }
        /// 
        /// Gets the associated GridColumn (which can be null
        /// if the Filter's RowHeader is being rendered)
        /// 
        public GridColumn GridColumn
        {
            get { return (_GridColumn); }
        }
        /// 
        /// Gets the parts to render
        /// 
        public RenderParts RenderParts
        {
            get { return (_RenderParts); }
        }
        #endregion
    }
    #endregion
    #region GridPreRenderFilterRowEventArgs
    /// 
    /// GridPreRenderFilterRowEventArgs
    /// 
    public class GridPreRenderFilterRowEventArgs : GridPostRenderFilterRowEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridPreRenderFilterRowEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPreRenderFilterRowEventArgs(Graphics graphics, GridPanel gridPanel,
            GridFilter filter, GridColumn column, RenderParts parts, Rectangle bounds)
            : base(graphics, gridPanel, filter, column, parts, bounds)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether
        /// to cancel the operation entirely
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridPostRenderGroupBoxConnectorEventArgs
    /// 
    /// GridPostRenderGroupBoxConnectorEventArgs
    /// 
    public class GridPostRenderGroupBoxConnectorEventArgs : GridEventArgs
    {
        #region Private variables
        private Graphics _Graphics;
        private GridGroupByRow _GroupByRow;
        private GridGroupBox _GridGroupBox1;
        private GridGroupBox _GridGroupBox2;
        #endregion
        ///
        /// GridPostRenderGroupBoxConnectorEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPostRenderGroupBoxConnectorEventArgs(Graphics graphics,
            GridPanel gridPanel, GridGroupByRow groupByRow, GridGroupBox groupBox1, GridGroupBox groupBox2)
            : base(gridPanel)
        {
            _Graphics = graphics;
            _GroupByRow = groupByRow;
            _GridGroupBox1 = groupBox1;
            _GridGroupBox2 = groupBox2;
        }
        #region Public properties
        /// 
        /// Gets the Graphics object
        /// 
        public Graphics Graphics
        {
            get { return (_Graphics); }
        }
        /// 
        /// Gets the associated GroupByRow
        /// 
        public GridGroupByRow GroupByRow
        {
            get { return (_GroupByRow); }
        }
        /// 
        /// Gets the first associated GridGroupBox
        /// 
        public GridGroupBox GridGroupBox1
        {
            get { return (_GridGroupBox1); }
        }
        /// 
        /// Gets the second associated GridGroupBox
        /// 
        public GridGroupBox GridGroupBox2
        {
            get { return (_GridGroupBox2); }
        }
        #endregion
    }
    #endregion
    #region GridPreRenderGroupBoxConnectorEventArgs
    /// 
    /// GridPreRenderGroupBoxConnectorEventArgs
    /// 
    public class GridPreRenderGroupBoxConnectorEventArgs : GridPostRenderGroupBoxConnectorEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridPreRenderGroupBoxConnectorEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPreRenderGroupBoxConnectorEventArgs(Graphics graphics, GridPanel gridPanel,
            GridGroupByRow groupByRow, GridGroupBox groupBox1, GridGroupBox groupBox2)
            : base(graphics, gridPanel, groupByRow, groupBox1, groupBox2)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether
        /// to cancel the operation entirely
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridPostRenderGroupBoxEventArgs
    /// 
    /// GridPostRenderGroupBoxEventArgs
    /// 
    public class GridPostRenderGroupBoxEventArgs : GridEventArgs
    {
        #region Private variables
        private Graphics _Graphics;
        private Rectangle _Bounds;
        private RenderParts _RenderParts;
        private GridGroupByRow _GroupByRow;
        private GridGroupBox _GridGroupBox;
        #endregion
        ///
        /// GridPostRenderGroupBoxEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPostRenderGroupBoxEventArgs(Graphics graphics, GridPanel gridPanel,
            GridGroupByRow groupByRow, GridGroupBox gridGroupBox, RenderParts parts, Rectangle bounds)
            : base(gridPanel)
        {
            _Graphics = graphics;
            _GroupByRow = groupByRow;
            _GridGroupBox = gridGroupBox;
            _RenderParts = parts;
            _Bounds = bounds;
        }
        #region Public properties
        /// 
        /// Gets the Graphics object
        /// 
        public Graphics Graphics
        {
            get { return (_Graphics); }
        }
        /// 
        /// Gets the bounding rectangle
        /// 
        public Rectangle Bounds
        {
            get { return (_Bounds); }
        }
        /// 
        /// Gets the parts to render
        /// 
        public RenderParts RenderParts
        {
            get { return (_RenderParts); }
        }
        /// 
        /// Gets the associated GroupByRow
        /// 
        public GridGroupByRow GroupByRow
        {
            get { return (_GroupByRow); }
        }
        /// 
        /// Gets the associated GridGroupBox
        /// 
        public GridGroupBox GridGroupBox
        {
            get { return (_GridGroupBox); }
        }
        #endregion
    }
    #endregion
    #region GridPreRenderGroupBoxEventArgs
    /// 
    /// GridPreRenderGroupBoxEventArgs
    /// 
    public class GridPreRenderGroupBoxEventArgs : GridPostRenderGroupBoxEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridPreRenderGroupBoxEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPreRenderGroupBoxEventArgs(Graphics graphics, GridPanel gridPanel,
            GridGroupByRow groupByRow, GridGroupBox gridGroupBox, RenderParts parts, Rectangle bounds)
            : base(graphics, gridPanel, groupByRow, gridGroupBox, parts, bounds)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether
        /// to cancel the operation entirely
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridPostRenderTextRowEventArgs
    /// 
    /// GridPostRenderTextRowEventArgs
    /// 
    public class GridPostRenderTextRowEventArgs : GridEventArgs
    {
        #region Private variables
        private Graphics _Graphics;
        private Rectangle _Bounds;
        private RenderParts _RenderParts;
        private GridTextRow _GridTextRow;
        #endregion
        ///
        /// GridPostRenderTextRowEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPostRenderTextRowEventArgs(Graphics graphics, GridPanel gridPanel,
            GridTextRow gridTextRow, RenderParts parts, Rectangle bounds)
            : base(gridPanel)
        {
            _Graphics = graphics;
            _RenderParts = parts;
            _Bounds = bounds;
            _GridTextRow = gridTextRow;
        }
        #region Public properties
        /// 
        /// Gets the Graphics object
        /// 
        public Graphics Graphics
        {
            get { return (_Graphics); }
        }
        /// 
        /// Gets the bounding rectangle
        /// 
        public Rectangle Bounds
        {
            get { return (_Bounds); }
        }
        /// 
        /// Gets the parts to render
        /// 
        public RenderParts RenderParts
        {
            get { return (_RenderParts); }
        }
        /// 
        /// Gets the associated GridTextRow
        /// 
        public GridTextRow GridTextRow
        {
            get { return (_GridTextRow); }
        }
        #endregion
    }
    #endregion
    #region GridPreRenderTextRowEventArgs
    /// 
    /// GridPreRenderTextRowEventArgs
    /// 
    public class GridPreRenderTextRowEventArgs : GridPostRenderTextRowEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridPreRenderTextRowEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        public GridPreRenderTextRowEventArgs(Graphics graphics, GridPanel gridPanel,
            GridTextRow gridTextRow, RenderParts parts, Rectangle bounds)
            : base(graphics, gridPanel, gridTextRow, parts, bounds)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether
        /// to cancel the operation entirely
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridPreviewKeyDownEventArgs
    ///
    /// PreviewKeyDown event, with the ability to specify that the key has been handled
    ///
    public class GridPreviewKeyDownEventArgs : PreviewKeyDownEventArgs
    {
        #region Private variables
        private bool _Handled;
        #endregion
        ///
        /// PreviewKeyDown event, with the ability to specify that the key has been handled
        ///
        ///
        public GridPreviewKeyDownEventArgs(Keys keyData)
            : base(keyData)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether the key was handled
        /// 
        public bool Handled
        {
            get { return (_Handled); }
            set { _Handled = value; }
        }
        #endregion
    }
    #endregion
    #region GridRefreshFilterEventArgs
    /// 
    /// GridRefreshFilterEventArgs
    /// 
    public class GridRefreshFilterEventArgs : GridCancelEventArgs
    {
        ///
        /// GridRefreshFilterEventArgs
        ///
        ///
        public GridRefreshFilterEventArgs(GridPanel gridPanel)
            : base(gridPanel)
        {
        }
    }
    #endregion
    #region GridRowActivatedEventArgs
    /// 
    /// GridRowActivatedEventArgs
    /// 
    public class GridRowActivatedEventArgs : GridEventArgs
    {
        #region Private variables
        private readonly GridContainer _OldActiveRow;
        private readonly GridContainer _NewActiveRow;
        #endregion
        ///
        /// GridRowActivatedEventArgs
        ///
        ///
        ///
        ///
        public GridRowActivatedEventArgs(GridPanel gridPanel,
            GridContainer oldRow, GridContainer newRow)
            : base(gridPanel)
        {
            _OldActiveRow = oldRow;
            _NewActiveRow = newRow;
        }
        #region Public properties
        /// 
        /// Gets the old (previous) ActiveRow
        /// 
        public GridContainer OldActiveRow
        {
            get { return (_OldActiveRow); }
        }
        /// 
        /// Gets the new (current) ActiveRow
        /// 
        public GridContainer NewActiveRow
        {
            get { return (_NewActiveRow); }
        }
        #endregion
    }
    #endregion
    #region GridRowActivatingEventArgs
    /// 
    /// GridRowActivatingEventArgs
    /// 
    public class GridRowActivatingEventArgs : GridRowActivatedEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridRowActivatingEventArgs
        ///
        ///
        ///
        ///
        public GridRowActivatingEventArgs(GridPanel gridPanel, GridContainer oldRow, GridContainer newRow)
            : base(gridPanel, oldRow, newRow)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether
        /// to cancel the operation entirely
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridRowAddedEventArgs
    /// 
    /// GridRowAddedEventArgs
    /// 
    public class GridRowAddedEventArgs : GridEventArgs
    {
        #region Private variables
        private int _Index;
        #endregion
        ///
        /// GridRowAddedEventArgs
        ///
        ///
        ///
        public GridRowAddedEventArgs(GridPanel gridPanel, int index)
            : base(gridPanel)
        {
            _Index = index;
        }
        #region Public properties
        /// 
        /// Gets the associated GridPanel.Rows
        /// index where the row is to be inserted
        /// 
        public int Index
        {
            get { return (_Index); }
            protected set { _Index = value; }
        }
        #endregion
    }
    #endregion
    #region GridRowAddingEventArgs
    /// 
    /// GridRowAddingEventArgs
    /// 
    public class GridRowAddingEventArgs : GridRowAddedEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridRowAddingEventArgs
        ///
        ///
        ///
        public GridRowAddingEventArgs(GridPanel gridPanel, int index)
            : base(gridPanel, index)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether
        /// to cancel the operation entirely
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated GridPanel.Rows
        /// index where the row is to be inserted
        /// 
        public new int Index
        {
            get { return (base.Index); }
            set { base.Index = value; }
        }
        #endregion
    }
    #endregion
    #region GridRowCancelEventArgs
    /// 
    /// GridRowCancelEventArgs
    /// 
    public class GridRowCancelEventArgs : GridRowEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridRowCancelEventArgs
        ///
        ///
        ///
        public GridRowCancelEventArgs(
            GridPanel gridPanel, GridContainer gridRow)
            : base(gridPanel, gridRow)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the operation.
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridRowDeletedEventArgs
    /// 
    /// GridRowMovedEventArgs
    /// 
    public class GridRowDeletedEventArgs : GridEventArgs
    {
        #region Private variables
        private readonly SelectedElements _SelectedRows;
        #endregion
        ///
        /// GridRowDeletedEventArgs
        ///
        ///
        ///
        public GridRowDeletedEventArgs(GridPanel gridPanel, SelectedElements selRows)
            : base(gridPanel)
        {
            _SelectedRows = selRows;
        }
        #region Public properties
        /// 
        /// Gets the associated selection of row indices to delete
        /// 
        public SelectedElements SelectedRows
        {
            get { return (_SelectedRows); }
        }
        #endregion
    }
    #endregion
    #region GridRowDeletingEventArgs
    /// 
    /// GridRowDeletingEventArgs
    /// 
    public class GridRowDeletingEventArgs : GridRowDeletedEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridRowDeletingEventArgs
        ///
        ///
        ///
        public GridRowDeletingEventArgs(GridPanel gridPanel, SelectedElements selRows)
            : base(gridPanel, selRows)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether
        /// to cancel the operation entirely
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridRowEventArgs
    /// 
    /// GridRowEventArgs
    /// 
    public class GridRowEventArgs : GridEventArgs
    {
        #region Private variables
        private GridContainer _GridRow;
        #endregion
        ///
        /// GridRowEventArgs
        ///
        ///
        ///
        public GridRowEventArgs(GridPanel gridPanel, GridContainer gridRow)
            : base(gridPanel)
        {
            _GridRow = gridRow;
        }
        #region Public properties
        /// 
        /// Gets the associated GridRow
        /// 
        public GridContainer GridRow
        {
            get { return (_GridRow); }
        }
        #endregion
    }
    #endregion
    #region GridRowClickEventArgs
    /// 
    /// GridRowClickEventArgs
    /// 
    public class GridRowClickEventArgs : GridRowEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private RowArea _RowArea;
        private MouseEventArgs _MouseEventArgs;
        #endregion
        ///
        /// GridRowClickEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridRowClickEventArgs(
            GridPanel gridPanel, GridRow gridRow, RowArea rowArea, MouseEventArgs e)
            : base(gridPanel, gridRow)
        {
            _RowArea = rowArea;
            _MouseEventArgs = e;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the default operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated MouseEventArgs
        /// 
        public MouseEventArgs MouseEventArgs
        {
            get { return (_MouseEventArgs); }
        }
        /// 
        /// Gets the associated RowArea
        /// 
        public RowArea RowArea
        {
            get { return (_RowArea); }
        }
        #endregion
    }
    #endregion
    #region GridRowDoubleClickEventArgs
    /// 
    /// GridRowDoubleClickEventArgs
    /// 
    public class GridRowDoubleClickEventArgs : GridRowClickEventArgs
    {
        ///
        /// GridRowDoubleClickEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridRowDoubleClickEventArgs(
            GridPanel gridPanel, GridRow gridRow, RowArea rowArea, MouseEventArgs e)
            : base(gridPanel, gridRow, rowArea, e)
        {
        }
    }
    #endregion
    #region GridGetDetailRowHeightEventArgs
    /// 
    /// GridGetDetailRowHeightEventArgs
    /// 
    public class GridGetDetailRowHeightEventArgs : EventArgs
    {
        #region Private variables
        private GridRow _GridRow;
        private GridPanel _GridPanel;
        private int _PreDetailHeight;
        private int _PostDetailHeight;
        private GridLayoutInfo _LayoutInfo;
        private Size _SizeNeeded;
        #endregion
        ///
        /// GridGetDetailRowHeightEventArgs
        ///
        ///Associated GridPanel
        ///Associated container row
        ///
        ///
        ///
        ///
        public GridGetDetailRowHeightEventArgs(GridPanel gridPanel,
            GridRow gridRow, GridLayoutInfo layoutInfo, Size sizeNeeded, int preHeight, int postHeight)
        {
            _GridPanel = gridPanel;
            _GridRow = gridRow;
            _SizeNeeded = sizeNeeded;
            _LayoutInfo = layoutInfo;
            _PreDetailHeight = preHeight;
            _PostDetailHeight = postHeight;
        }
        #region Public properties
        /// 
        /// Gets the event Grid
        /// 
        public GridPanel GridPanel
        {
            get { return (_GridPanel); }
        }
        /// 
        /// Gets the associated GridRow
        /// 
        public GridRow GridRow
        {
            get { return (_GridRow); }
        }
        /// 
        /// Gets or sets the associated row PreDetail Height
        /// 
        public int PreDetailHeight
        {
            get { return (_PreDetailHeight); }
            set { _PreDetailHeight = value; }
        }
        /// 
        /// Gets or sets the associated row PostDetail Height
        /// 
        public int PostDetailHeight
        {
            get { return (_PostDetailHeight); }
            set { _PostDetailHeight = value; }
        }
        /// 
        /// Gets the associated row LayoutInfo
        /// 
        public GridLayoutInfo LayoutInfo
        {
            get { return (_LayoutInfo); }
        }
        /// 
        /// Gets or sets the associated row's needed size
        /// 
        public Size SizeNeeded
        {
            get { return (_SizeNeeded); }
            set { _SizeNeeded = value; }
        }
        #endregion
    }
    #endregion
    #region GridGetGroupIdEventArgs
    /// 
    /// GridGetGroupIdEventArgs
    /// 
    public class GridGetGroupIdEventArgs : EventArgs
    {
        #region Private variables
        private GridPanel _GridPanel;
        private GridElement _GridItem;
        private GridColumn _GridColumn;
        private object _GroupId;
        #endregion
        ///
        /// GridGetGroupIdEventArgs
        ///
        ///Associated GridPanel
        ///Associated grid element
        ///Associated grid column
        ///Associated Group identifier
        public GridGetGroupIdEventArgs(
            GridPanel gridPanel, GridElement gridItem, GridColumn column, object groupId)
        {
            _GridPanel = gridPanel;
            _GridColumn = column;
            _GridItem = gridItem;
            _GroupId = groupId;
        }
        #region Public properties
        /// 
        /// Gets the event Grid
        /// 
        public GridPanel GridPanel
        {
            get { return (_GridPanel); }
        }
        /// 
        /// Gets the associated GridElement
        /// 
        public GridElement GridItem
        {
            get { return (_GridItem); }
        }
        /// 
        /// Gets the associated GridColumn
        /// 
        public GridColumn GridColumn
        {
            get { return (_GridColumn); }
        }
        /// 
        /// Gets or sets the associated row Group Identifier
        /// 
        public object GroupId
        {
            get { return (_GroupId); }
            set { _GroupId = value; }
        }
        #endregion
    }
    #endregion
    #region GridRowHeaderClickEventArgs
    /// 
    /// GridRowHeaderClickEventArgs
    /// 
    public class GridRowHeaderClickEventArgs : GridRowEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private MouseEventArgs _MouseEventArgs;
        #endregion
        ///
        /// GridRowHeaderClickEventArgs
        ///
        ///
        ///
        ///
        public GridRowHeaderClickEventArgs(
            GridPanel gridPanel, GridContainer row, MouseEventArgs e)
            : base(gridPanel, row)
        {
            _MouseEventArgs = e;
        }
        #region Public properties
        /// 
        /// Gets the associated MouseEventArgs
        /// 
        public MouseEventArgs MouseEventArgs
        {
            get { return (_MouseEventArgs); }
        }
        /// 
        /// Gets or sets whether to cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridRowHeaderDoubleClickEventArgs
    /// 
    /// GridRowHeaderDoubleClickEventArgs
    /// 
    public class GridRowHeaderDoubleClickEventArgs : GridRowHeaderClickEventArgs
    {
        ///
        /// GridRowHeaderDoubleClickEventArgs
        ///
        ///
        ///
        ///
        public GridRowHeaderDoubleClickEventArgs(
            GridPanel gridPanel, GridContainer row, MouseEventArgs e)
            : base(gridPanel, row, e)
        {
        }
    }
    #endregion
    #region GridRowInfoEnterEventArgs
    /// 
    /// GridRowInfoEnterEventArgs
    /// 
    public class GridRowInfoEnterEventArgs : GridRowEventArgs
    {
        #region Private variables
        private bool _Cancel;
        private Point _Location;
        #endregion
        ///
        /// GridRowInfoEnterEventArgs
        ///
        ///
        ///
        ///
        public GridRowInfoEnterEventArgs(
            GridPanel gridPanel, GridRow gridRow, Point pt)
            : base(gridPanel, gridRow)
        {
            _Location = pt;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to cancel the default operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated event Location
        /// 
        public Point Location
        {
            get { return (_Location); }
        }
        #endregion
    }
    #endregion
    #region GridRowInfoLeaveEventArgs
    /// 
    /// GridRowInfoLeaveEventArgs
    /// 
    public class GridRowInfoLeaveEventArgs : GridRowEventArgs
    {
        ///
        /// GridRowInfoLeaveEventArgs
        ///
        ///
        ///
        public GridRowInfoLeaveEventArgs(
            GridPanel gridPanel, GridRow gridRow)
            : base(gridPanel, gridRow)
        {
        }
    }
    #endregion
    #region GridRowLoadedEventArgs
    /// 
    /// GridRowLoadedEventArgs
    /// 
    public class GridRowLoadedEventArgs : GridEventArgs
    {
        #region Private variables
        private GridRow _GridRow;
        #endregion
        ///
        /// GridRowLoadedEventArgs
        ///
        ///
        ///
        public GridRowLoadedEventArgs(GridPanel gridPanel, GridRow row)
            : base(gridPanel)
        {
            _GridRow = row;
        }
        #region Public properties
        /// 
        /// Gets a reference to the loaded GridRow
        /// 
        public GridRow GridRow
        {
            get { return (_GridRow); }
        }
        #endregion
    }
    #endregion
    #region GridRowMouseEventArgs
    /// 
    /// GridRowMouseEventArgs
    /// 
    public class GridRowMouseEventArgs : MouseEventArgs
    {
        #region Private variables
        private readonly GridPanel _GridPanel;
        private readonly GridContainer _GridRow;
        private readonly RowArea _RowArea;
        #endregion
        ///
        /// GridRowMouseEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridRowMouseEventArgs(GridPanel gridPanel, GridContainer gridRow, MouseEventArgs ev, RowArea rowArea)
            : base(ev.Button, ev.Clicks, ev.X, ev.Y, ev.Delta)
        {
            _GridPanel = gridPanel;
            _GridRow = gridRow;
            _RowArea = rowArea;
        }
        #region Public properties
        /// 
        /// Gets the associated GridRow
        /// 
        public GridContainer GridRow
        {
            get { return (_GridRow); }
        }
        /// 
        /// Gets the associated GridPanel
        /// 
        public GridPanel GridPanel
        {
            get { return (_GridPanel); }
        }
        /// 
        /// Gets the associated RowArea
        /// 
        public RowArea RowArea
        {
            get { return (_RowArea); }
        }
        #endregion
    }
    #endregion
    #region GridRowMovedEventArgs
    /// 
    /// GridRowMovedEventArgs
    /// 
    public class GridRowMovedEventArgs : GridRowEventArgs
    {
        #region Private variables
        private readonly GridContainer _GridContainer;
        #endregion
        ///
        /// GridRowMovedEventArgs
        ///
        ///
        ///
        ///
        public GridRowMovedEventArgs(GridPanel gridPanel,
            GridContainer gridContainer, GridContainer gridRow)
            : base(gridPanel, gridRow)
        {
            _GridContainer = gridContainer;
        }
        #region Public properties
        /// 
        /// Gets the associated GridContainer
        /// 
        public GridContainer GridContainer
        {
            get { return (_GridContainer); }
        }
        #endregion
    }
    #endregion
    #region GridRowMovingEventArgs
    /// 
    /// GridRowMovingEventArgs
    /// 
    public class GridRowMovingEventArgs : GridRowCancelEventArgs
    {
        #region Private variables
        private int _SrcIndex;
        private GridContainer _SrcContainer;
        private int _DestIndex;
        private GridContainer _DestContainer;
        #endregion
        ///
        /// GridRowMovingEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        ///
        public GridRowMovingEventArgs(GridPanel gridPanel, GridRow gridRow,
            GridContainer srcCont, int srcIndex, GridContainer destCont, int destIndex)
            : base(gridPanel, gridRow)
        {
            _SrcIndex = srcIndex;
            _SrcContainer = srcCont;
            _DestIndex = destIndex;
            _DestContainer = destCont;
        }
        #region Public properties
        /// 
        /// Gets or sets the Destination Container for the row
        /// being moved.
        /// 
        public GridContainer DestContainer
        {
            get { return (_DestContainer); }
            set { _DestContainer = value; }
        }
        /// 
        /// Gets or sets the Destination index for the row
        /// being moved.
        /// 
        public int DestIndex
        {
            get { return (_DestIndex); }
            set { _DestIndex = value; }
        }
        /// 
        /// Gets the Source Container of the row
        /// being moved.
        /// 
        public GridContainer SrcContainer
        {
            get { return (_SrcContainer); }
        }
        /// 
        /// Gets the Source index of the row being moved.
        /// 
        public int SrcIndex
        {
            get { return (_SrcIndex); }
        }
        #endregion
    }
    #endregion
    #region GridRowsPurgingEventArgs
    /// 
    /// GridRowsPurgingEventArgs
    /// 
    public class GridRowsPurgingEventArgs : GridRowCancelEventArgs
    {
        #region Private variables
        private bool _IncludeNestedRows;
        #endregion
        ///
        /// GridRowPurgeEventArgs
        ///
        ///
        ///
        ///
        public GridRowsPurgingEventArgs(
            GridPanel gridPanel, GridContainer gridRow, bool includeNestedRows)
            : base(gridPanel, gridRow)
        {
            _IncludeNestedRows = includeNestedRows;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to include the associated GridPanel's 
        /// nested rows when purging deleted rows.
        /// 
        public bool IncludeNestedRows
        {
            get { return (_IncludeNestedRows); }
            set { _IncludeNestedRows = value; }
        }
        #endregion
    }
    #endregion
    #region GridRowRestoredEventArgs
    /// 
    /// GridRowRestoredEventArgs
    /// 
    public class GridRowRestoredEventArgs : GridRowDeletedEventArgs
    {
        ///
        /// GridRowRestoredEventArgs
        ///
        ///
        ///
        public GridRowRestoredEventArgs(GridPanel gridPanel, SelectedElements selRows)
            : base(gridPanel, selRows)
        {
        }
    }
    #endregion
    #region GridRowRestoringEventArgs
    /// 
    /// GridRowRestoringEventArgs
    /// 
    public class GridRowRestoringEventArgs : GridRowDeletingEventArgs
    {
        ///
        /// GridRowRestoringEventArgs
        ///
        ///
        ///
        public GridRowRestoringEventArgs(GridPanel gridPanel, SelectedElements selRows)
            : base(gridPanel, selRows)
        {
        }
    }
    #endregion
    #region GridRowSetDefaultValuesEventArgs
    /// 
    /// GridRowSetDefaultValuesEventArgs
    /// 
    public class GridRowSetDefaultValuesEventArgs : GridEventArgs
    {
        #region Private variables
        private readonly GridRow _GridRow;
        private readonly NewRowContext _NewRowContext;
        #endregion
        ///
        /// GridRowDeletedEventArgs
        ///
        ///
        ///
        ///
        public GridRowSetDefaultValuesEventArgs(
            GridPanel gridPanel, GridRow gridRow, NewRowContext context)
            : base(gridPanel)
        {
            _GridRow = gridRow;
            _NewRowContext = context;
        }
        #region Public properties
        /// 
        /// Gets the associated GridRow
        /// 
        public GridRow GridRow
        {
            get { return (_GridRow); }
        }
        /// 
        /// Gets the associated context under which
        /// the new row data needs to be initialized
        /// 
        public NewRowContext NewRowContext
        {
            get { return (_NewRowContext); }
        }
        #endregion
    }
    #endregion
    #region GridRowValidatedEventArgs
    /// 
    /// GridRowValidatedEventArgs
    /// 
    public class GridRowValidatedEventArgs : GridEventArgs
    {
        #region Private variables
        private readonly GridRow _GridRow;
        #endregion
        ///
        /// GridRowDeletedEventArgs
        ///
        ///
        ///
        public GridRowValidatedEventArgs(GridPanel gridPanel, GridRow gridRow)
            : base(gridPanel)
        {
            _GridRow = gridRow;
        }
        #region Public properties
        /// 
        /// Gets the associated GridRow
        /// 
        public GridRow GridRow
        {
            get { return (_GridRow); }
        }
        #endregion
    }
    #endregion
    #region GridRowValidatingEventArgs
    /// 
    /// GridRowValidatingEventArgs
    /// 
    public class GridRowValidatingEventArgs : GridRowValidatedEventArgs
    {
        #region Private variables
        private bool _Cancel;
        #endregion
        ///
        /// GridRowValidatingEventArgs
        ///
        ///
        ///
        public GridRowValidatingEventArgs(GridPanel gridPanel, GridRow gridRow)
            : base(gridPanel, gridRow)
        {
        }
        #region Public properties
        /// 
        /// Gets or sets whether
        /// to cancel the operation entirely
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        #endregion
    }
    #endregion
    #region GridScrollEventArgs
    /// 
    /// GridScrollEventArgs
    /// 
    public class GridScrollEventArgs : GridEventArgs
    {
        #region Private variables
        private ScrollEventArgs _ScrollEventArgs;
        #endregion
        ///
        /// GridScrollEventArgs
        ///
        ///
        ///
        public GridScrollEventArgs(
            GridPanel gridPanel, ScrollEventArgs scrollEventArgs)
            : base(gridPanel)
        {
            _ScrollEventArgs = scrollEventArgs;
        }
        #region Public properties
        /// 
        /// Gets the scroll event args
        /// 
        public ScrollEventArgs ScrollEventArgs
        {
            get { return (_ScrollEventArgs); }
        }
        #endregion
    }
    #endregion
    #region GridSelectionChangingEventArgs
    /// 
    /// GridSelectionChangingEventArgs
    /// 
    public class GridSelectionChangingEventArgs : GridEventArgs
    {
        #region Private variables
        private SelectedElements _SelectedElements;
        private int _Index;
        private int _Count;
        private bool _Selected;
        private bool _Cancel;
        #endregion
        ///
        /// GridSelectionChangingEventArgs
        ///
        ///
        ///
        ///
        ///
        ///
        public GridSelectionChangingEventArgs(GridPanel gridPanel,
            SelectedElements selectedElements, int index, int count, bool selected)
            : base (gridPanel)
        {
            _SelectedElements = selectedElements;
            _Index = index;
            _Count = count;
            _Selected = selected;
        }
        #region Public properties
        /// 
        /// Gets or sets whether to Cancel the operation
        /// 
        public bool Cancel
        {
            get { return (_Cancel); }
            set { _Cancel = value; }
        }
        /// 
        /// Gets the associated SelectedElements collection
        /// 
        public SelectedElements SelectedElements
        {
            get { return (_SelectedElements); }
            set { _SelectedElements = value; }
        }
        /// 
        /// Gets the associated starting selection index
        /// 
        public int Index
        {
            get { return (_Index); }
        }
        /// 
        /// Gets the associated starting selection count
        /// 
        public int Count
        {
            get { return (_Count); }
        }
        /// 
        /// Gets the selected state (true/selected, false/cleared)
        /// 
        public bool Selected
        {
            get { return (_Selected); }
        }
        #endregion
    }
    #endregion
    #region GridTextRowEventArgs
    /// 
    /// GridTextRowEventArgs
    /// 
    public class GridTextRowEventArgs : GridEventArgs
    {
        #region Private variables
        private readonly GridTextRow _GridTextRow;
        private MouseEventArgs _MouseEventArgs;
        #endregion
        ///
        /// GridTextRowEventArgs
        ///
        ///
        ///
        ///
        public GridTextRowEventArgs(
            GridPanel gridPanel, GridTextRow textRow, MouseEventArgs e)
            : base(gridPanel)
        {
            _GridTextRow = textRow;
            _MouseEventArgs = e;
        }
        #region Public properties
        /// 
        /// Gets the associated GridTextRow
        /// 
        public GridTextRow GridTextRow
        {
            get { return (_GridTextRow); }
        }
        /// 
        /// Gets the associated MouseEventArgs
        /// 
        public MouseEventArgs MouseEventArgs
        {
            get { return (_MouseEventArgs); }
        }
        #endregion
    }
    #endregion
    #region GridTextRowMarkupLinkClickEventArgs
    /// 
    /// GridTextRowMarkupLinkClickEventArgs
    /// 
    public class GridTextRowMarkupLinkClickEventArgs : GridEventArgs
    {
        #region Private variables
        private string _HRef;
        private string _Name;
        private readonly GridTextRow _GridTextRow;
        #endregion
        ///
        /// GridTextRowMarkupLinkClickEventArgs
        ///
        ///
        ///
        ///
        ///
        public GridTextRowMarkupLinkClickEventArgs(GridPanel gridPanel,
            GridTextRow gridTextRow, string name, string href)
            : base(gridPanel)
        {
            _GridTextRow = gridTextRow;
            _HRef = href;
            _Name = name;
        }
        #region Public properties
        /// 
        /// Gets the associated HyperLink HRef
        /// 
        public string HRef
        {
            get { return (_HRef); }
        }
        /// 
        /// Gets the associated HyperLink Name
        /// 
        public string Name
        {
            get { return (_Name); }
        }
        /// 
        /// Gets the associated GridTextRow
        /// 
        public GridTextRow GridTextRow
        {
            get { return (_GridTextRow); }
        }
        #endregion
    }
    #endregion
    #region GridUpdateCellDisplayRangesEventArgs
    /// 
    /// GridUpdateCellDisplayRangesEventArgs
    /// 
    public class GridUpdateCellDisplayRangesEventArgs : GridEventArgs
    {
        #region Private variables
        private DisplayRange _DisplayRange;
        private List _CellRanges;
        private GridContainer _GridContainer;
        #endregion
        ///
        /// GridUpdateCellDisplayRangesEventArgs
        ///
        ///Associated GridPanel
        ///Associated GridContainer
        ///Row/col range being merge evaluated
        ///List of CellRanges
        public GridUpdateCellDisplayRangesEventArgs(GridPanel gridPanel,
            GridContainer gridContainer, DisplayRange displayRange, List cellRanges)
            : base(gridPanel)
        {
            _GridContainer = gridContainer;
            _DisplayRange = displayRange;
            _CellRanges = cellRanges;
        }
        #region Public properties
        /// 
        /// Gets or sets the CellRanges
        /// 
        public List CellRanges
        {
            get { return (_CellRanges); }
            set { _CellRanges = value; }
        }
        /// 
        /// Gets the current DisplayRange (row/col range
        /// being processed / merged evaluated)
        /// 
        public DisplayRange DisplayRange
        {
            get { return (_DisplayRange); }
        }
        /// 
        /// Gets the GridContainer 
        /// 
        public GridContainer GridContainer
        {
            get { return (_GridContainer); }
        }
        #endregion
    }
    #endregion
    #region GridVirtualRowEventArgs
    /// 
    /// GridVirtualRowEventArgs
    /// 
    public class GridVirtualRowEventArgs : GridEventArgs
    {
        #region Private variables
        private GridRow _GridRow;
        private int _Index;
        #endregion
        ///
        /// GridVirtualRowEventArgs
        ///
        ///
        ///
        ///
        public GridVirtualRowEventArgs(GridPanel gridPanel, GridRow gridRow, int index)
            : base(gridPanel)
        {
            _GridRow = gridRow;
            _Index = index;
        }
        #region Public properties
        /// 
        /// Gets the GridRow
        /// 
        public GridRow GridRow
        {
            get { return (_GridRow); }
        }
        /// 
        /// Gets the associated row index
        /// 
        public int Index
        {
            get { return (_Index); }
        }
        #endregion
    }
    #endregion
    #endregion
}