public void Remove(DataGridColumnStyle column)
 {
 }
 public int IndexOf(DataGridColumnStyle element)
 {
 }
 // Methods
 public virtual int Add(DataGridColumnStyle column)
 {
 }
	public bool Contains(DataGridColumnStyle column) {}
 public bool Contains(DataGridColumnStyle column)
 {
 }
Exemple #6
0
        /// <summary>
        ///    Required method for Designer support - do not modify
        ///    the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            // This method will be called every time that the Tools Options dialog is loaded. The first
            // time, we initialize the internal controls, etc. All subsequent times, however, we re-initialize
            // the datagrid and checkboxes.
            try
            {
                if (!m_fInitialized)
                {
                    m_fInitialized = true;

                    this.components      = new System.ComponentModel.Container();
                    this.bDelete         = new System.Windows.Forms.Button();
                    this.label1          = new System.Windows.Forms.Label();
                    this.cbCollapse      = new System.Windows.Forms.CheckBox();
                    this.cbPromptForTodo = new System.Windows.Forms.CheckBox();
                    this.bNew            = new System.Windows.Forms.Button();
                    this.dgEntries       = new System.Windows.Forms.DataGrid();
                    //@this.TrayLargeIcon = false;
                    //@this.TrayAutoArrange = true;
                    //@this.TrayHeight = 0;
                    this.Size = new System.Drawing.Size(400, 300);

                    label1.Location = new System.Drawing.Point(0, 8);
                    label1.Text     = AMResources.GetLocalizedString("ToolsOptionsDescriptionLabel");
                    label1.Size     = new System.Drawing.Size(376, 26);
                    label1.TabIndex = 100;

                    cbCollapse.Location = new System.Drawing.Point(0, 240);
                    cbCollapse.Text     = AMResources.GetLocalizedString("ToolsOptionsCollapseCombo");
                    cbCollapse.Size     = new System.Drawing.Size(300, 24);
                    cbCollapse.TabIndex = 3;

                    cbPromptForTodo.Location = new System.Drawing.Point(0, 265);
                    cbPromptForTodo.Text     = AMResources.GetLocalizedString("ToolsOptionsTodoCommentCombo");
                    cbPromptForTodo.Size     = new System.Drawing.Size(300, 24);
                    cbPromptForTodo.TabIndex = 4;

                    bNew.Location    = new System.Drawing.Point(0, 42);
                    bNew.Size        = new System.Drawing.Size(96, 23);
                    bNew.TabIndex    = 0;
                    bNew.Text        = AMResources.GetLocalizedString("ToolsOptionsAddRuleButton");
                    bNew.Click      += new System.EventHandler(bNew_OnClick);
                    bDelete.Location = new System.Drawing.Point(102, 42);
                    bDelete.Size     = new System.Drawing.Size(132, 23);
                    bDelete.TabIndex = 1;
                    bDelete.Text     = AMResources.GetLocalizedString("ToolsOptionsDeleteMarkedRulesButton");
                    bDelete.Click   += new System.EventHandler(bDelete_OnClick);

                    // Create the DataTable to contain the data stored in the registry.
                    dtValues = new System.Data.DataTable("ExtractionOptions");

                    dtValues.Columns.Add(new System.Data.DataColumn("X", typeof(bool)));
                    dtValues.Columns.Add(new System.Data.DataColumn(m_strFileExtensionField, typeof(string)));
                    dtValues.Columns.Add(new System.Data.DataColumn(m_strBeginCommentField, typeof(string)));
                    dtValues.Columns.Add(new System.Data.DataColumn(m_strEndCommentField, typeof(string)));

                    // This supresses the automatic new row that is otherwise created by the
                    // DataGrid control. However, the 'Add' button in the UI will still be able
                    // to add new rows explicitly.
                    dtValues.DefaultView.AllowNew = false;

                    // Place the DataGrid control on the form and set some properties
                    dgEntries.Location        = new System.Drawing.Point(0, 71);
                    dgEntries.Size            = new System.Drawing.Size(395, 165);
                    dgEntries.TabIndex        = 2;
                    dgEntries.BackgroundColor = System.Drawing.Color.White;
                    dgEntries.FlatMode        = true;
                    dgEntries.CaptionVisible  = false;
                    dgEntries.AllowNavigation = false;
                    dgEntries.MouseDown      += new System.Windows.Forms.MouseEventHandler(dgEntries_OnMouseDown);

                    // Attach the DataTable to the DataGrid
                    dgEntries.SetDataBinding(dtValues, null);

                    // Reconfigure all of the columns and styles of the DataGrid to better fit our
                    // DataTable.
                    DataGridTableStyle tableStyle = new DataGridTableStyle();
                    tableStyle.MappingName          = dtValues.TableName;
                    tableStyle.AllowSorting         = false;
                    tableStyle.ColumnHeadersVisible = true;
                    tableStyle.RowHeadersVisible    = false;
                    tableStyle.PreferredRowHeight   = 25;

                    // Allocate all of the column style objects (they aren't created automatically
                    // when binding the DataTable to the DataGrid) and set the properites for each
                    // of the individual columns.
                    for (int i = 0; i < dtValues.Columns.Count; i++)
                    {
                        DataGridColumnStyle    gridColumn = null;
                        System.Data.DataColumn dataColumn = dtValues.Columns[i];
                        string sName = dataColumn.ColumnName;

                        if (sName == "X")
                        {
                            gridColumn = new DataGridBoolColumn();                             // A checkbox
                            ((DataGridBoolColumn)gridColumn).AllowNull = false;                // Don't allow the gray-state.
                            gridColumn.Alignment = HorizontalAlignment.Left;
                            gridColumn.Width     = 25;
                        }
                        else if (sName == m_strFileExtensionField)
                        {
                            gridColumn = new DataGridTextBoxColumn();
                            ((DataGridTextBox)((DataGridTextBoxColumn)gridColumn).TextBox).Multiline = false;                             // Don't allow multi-line edits, since they are difficult to handle.
                            gridColumn.Alignment = HorizontalAlignment.Left;
                            gridColumn.Width     = 87;
                        }
                        else if (sName == m_strBeginCommentField)
                        {
                            gridColumn = new DataGridTextBoxColumn();
                            ((DataGridTextBox)((DataGridTextBoxColumn)gridColumn).TextBox).Multiline = false;                             // Don't allow multi-line edits, since they are difficult to handle.
                            gridColumn.Alignment = HorizontalAlignment.Left;
                            gridColumn.Width     = 139;
                        }
                        else if (sName == m_strEndCommentField)
                        {
                            gridColumn = new DataGridTextBoxColumn();
                            ((DataGridTextBox)((DataGridTextBoxColumn)gridColumn).TextBox).Multiline = false;                             // Don't allow multi-line edits, since they are difficult to handle.
                            gridColumn.Alignment = HorizontalAlignment.Left;
                            gridColumn.Width     = 139;
                        }
                        else
                        {
                            System.Diagnostics.Debug.Assert(false, "A column was added to the ToolsOptions dialog, but its style was not created.");
                            return;
                        }

                        gridColumn.MappingName = sName;
                        gridColumn.HeaderText  = sName;
                        tableStyle.GridColumnStyles.Add(gridColumn);
                    }
                    dgEntries.TableStyles.Add(tableStyle);

                    this.bNew.AccessibleName            = "bNew";
                    this.bDelete.AccessibleName         = "bDelete";
                    this.dgEntries.AccessibleName       = "dgEntries";
                    this.cbCollapse.AccessibleName      = "cbCollapse";
                    this.cbPromptForTodo.AccessibleName = "cbPromptForTodo";
                    this.label1.AccessibleName          = "label1";

                    this.Controls.Add(this.bNew);
                    this.Controls.Add(this.bDelete);
                    this.Controls.Add(this.dgEntries);
                    this.Controls.Add(this.cbCollapse);
                    this.Controls.Add(this.cbPromptForTodo);
                    this.Controls.Add(this.label1);
                }
                else
                {
                    // Reset the UI.
                    PopulateTable();
                }
            }
            catch (System.Exception e)
            {
                System.Diagnostics.Debug.Assert(false, "Unable to initialize the dialog." + e.Message);
            }
        }
	public void AddRange(DataGridColumnStyle[] columns) {}
	public int IndexOf(DataGridColumnStyle element) {}
	public void Remove(DataGridColumnStyle column) {}
Exemple #10
0
        public bool CopyToClipboard()
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                DataGridTableStyle oTableStyle = this.GetCurrentTableStyle();
                DataTable          oDataTable  = this.GetDataTableFromDataSource();
                if (oTableStyle == null || oDataTable == null)
                {
                    return(false);
                }

                int iCol, cCols;

                if (m_slSelColumns.Count > 0)
                {
                    // Copy the selected columns to the clipboard.
                    cCols = m_slSelColumns.Count;

                    DataGridColumnStyle [] oCols = new DataGridColumnStyle[cCols];
                    int [] iTableCols            = new int[cCols];
                    iCol = 0;
                    foreach (object oKey in m_slSelColumns.Keys)
                    {
                        oCols[iCol] = oTableStyle.GridColumnStyles[(int)oKey];
                        string sMappingName = oCols[iCol].MappingName;
                        iTableCols[iCol++] = oDataTable.Columns[sMappingName].Ordinal;
                    }

                    StringBuilder oBuilder = new StringBuilder();

                    // Get the column headings.
                    for (iCol = 0; iCol < cCols; iCol++)
                    {
                        if (iCol == 0)
                        {
                            oBuilder.Append(oCols[iCol].MappingName);
                        }
                        else
                        {
                            oBuilder.Append("\t" + oCols[iCol].MappingName);
                        }
                    }
                    oBuilder.Append("\r\n");

                    // Loop through each row and add it to the string builder.
                    foreach (DataRow oDataRow in oDataTable.Rows)
                    {
                        for (iCol = 0; iCol < cCols; iCol++)
                        {
                            if (iCol == 0)
                            {
                                oBuilder.Append(GetCellValue(oDataRow[iTableCols[iCol]]));
                            }
                            else
                            {
                                oBuilder.Append("\t" + GetCellValue(oDataRow[iTableCols[iCol]]));
                            }
                        }
                        oBuilder.Append("\r\n");
                    }

                    Clipboard.SetDataObject(oBuilder.ToString(), true);
                }
                else
                {
                    ArrayList oSelectedRows = GetSelectedRows();
                    if (oSelectedRows.Count == 0)
                    {
                        // Copy the current cell to the clipboard.
                        string sValue = GetCellValue(oDataTable.DefaultView[this.CurrentCell.RowNumber][this.CurrentCell.ColumnNumber]);
                        Clipboard.SetDataObject(sValue, true);
                    }
                    else
                    {
                        // Copy the selected rows to the clipboard, including the column headers.

                        GridColumnStylesCollection oColStyles = oTableStyle.GridColumnStyles;
                        cCols = oColStyles.Count;

                        StringBuilder oBuilder = new StringBuilder();

                        // Get the column headings.
                        for (iCol = 0; iCol < cCols; iCol++)
                        {
                            if (iCol == 0)
                            {
                                oBuilder.Append(oColStyles[iCol].MappingName);
                            }
                            else
                            {
                                oBuilder.Append("\t" + oColStyles[iCol].MappingName);
                            }
                        }
                        oBuilder.Append("\r\n");

                        // Loop through each row and add it to the string builder.
                        foreach (DataRow oDataRow in oSelectedRows)
                        {
                            for (iCol = 0; iCol < cCols; iCol++)
                            {
                                if (iCol == 0)
                                {
                                    oBuilder.Append(GetCellValue(oDataRow[iCol]));
                                }
                                else
                                {
                                    oBuilder.Append("\t" + GetCellValue(oDataRow[iCol]));
                                }
                            }
                            oBuilder.Append("\r\n");
                        }

                        Clipboard.SetDataObject(oBuilder.ToString(), true);
                    }
                }
                Cursor.Current = Cursors.Default;
                return(true);
            }
            catch (Exception oEx)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(this,
                                "An error occurred while copying the selected text to the clipboard.\n\n" +
                                oEx.ToString(), Globals.ksAppTitle,
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
        }
        public static void SetStyle(DataGrid grid, object dataSource, string[] displayPropertyNames, Type objectType)
        {
            DataGridTableStyle dgts = QMDataGrid.GenerateCommonDataGridTableStyle();

            dgts.SelectionBackColor = System.Drawing.Color.Orange;
            dgts.SelectionForeColor = System.Drawing.Color.White;
            dgts.RowHeadersVisible  = false;
            grid.TableStyles.Clear();
            grid.TableStyles.Add(dgts);
            if (displayPropertyNames == null || dataSource == null)
            {
                return;
            }

            IList listSource = null;

            IList list = dataSource as IList;

            if (list != null)
            {
                listSource = list;
            }

            IListSource listS = dataSource as IListSource;

            if (listS != null)
            {
                listSource = listS.GetList();
            }

            if (listSource != null)
            {
                PropertyInfo[] propertyInfos = objectType.GetProperties();
                foreach (string displayPropertyName in displayPropertyNames)
                {
                    foreach (PropertyInfo property in propertyInfos)
                    {
                        if (property.Name != displayPropertyName)
                        {
                            continue;
                        }
                        else
                        {
                            DataGridColumnStyle dgcs = null;
                            string headText          = DataGridDictionary.Instance.GetDataGridPropertyTitle(string.Format("{0}.{1}", objectType.FullName, property.Name));
                            if (property.PropertyType == typeof(bool))
                            {
                                dgcs            = new DataGridBoolColumn();
                                dgcs.Width      = GetColumnWidth(grid, property, listSource, headText);
                                dgcs.HeaderText = headText;
                            }
                            else
                            {
                                dgcs            = new DataGridTextBoxColumn();
                                dgcs.Width      = GetColumnWidth(grid, property, listSource, headText);
                                dgcs.HeaderText = headText;
                            }
                            dgcs.MappingName = property.Name;

                            dgcs.Alignment = HorizontalAlignment.Center;

                            dgts.GridColumnStyles.Add(dgcs);
                            break;
                        }
                    }
                }
                dgts.MappingName = listSource.GetType().Name;
            }
        }
 public DataGridColumnHeaderAccessibleObject(DataGridColumnStyle owner) : this()
 {
     Debug.Assert(owner != null, "DataGridColumnHeaderAccessibleObject must have a valid owner DataGridColumn");
     Owner = owner;
 }
Exemple #13
0
        private void ShowToolTipForCurrentCell(int x, int y)
        {
            HitTestInfo hitInfo = HitTest(x, y);

            Debug.Assert(hitInfo != null, "hitInfo != null");

            string cellText     = string.Empty;
            bool   overSameCell = false;

            if (hitInfo.Type == HitTestType.Cell)
            {
                DataGridCell hitCell = new DataGridCell(hitInfo.Row, hitInfo.Column);

                overSameCell      = hitCell.Equals(m_lastToolTipCell);
                m_lastToolTipCell = hitCell;

                // Get the column style and text for the cell under the mouse pointer.

                DataGridTableStyle tableStyle = CurrentTableStyle;
                if (tableStyle != null)
                {
                    DataGridColumnStyle columnStyle = tableStyle.GridColumnStyles[hitCell.ColumnNumber];

                    ICellToolTip tooltipColumn = columnStyle as ICellToolTip;
                    if (tooltipColumn != null)
                    {
                        // This column can provide its own tool tip. Make the hit coordinates relative to the cell.

                        Rectangle cellBounds = GetCellBounds(hitCell);
                        cellText = tooltipColumn.GetCellToolTip(x - cellBounds.X, y - cellBounds.Y,
                                                                CurrencyManager, hitCell);
                    }

                    if (tooltipColumn == null || (ShowToolTipsForTextColumns && cellText == null))
                    {
                        System.Windows.Forms.DataGridTextBoxColumn textColumn = columnStyle as System.Windows.Forms.DataGridTextBoxColumn;
                        if (textColumn != null)
                        {
                            cellText = GetToolTipForTextColumn(x, y, hitCell, textColumn);
                        }
                    }
                }
            }
            else
            {
                m_lastToolTipCell = new DataGridCell(-1, -1);
            }

            // If the tooltip text hasn't changed AND the mouse is over the same cell as before then
            // don't make any changes. This check has to be made - if SetToolTip() is called whenever the mouse
            // moves then no tooltip is displayed at all! If we check only for the same cell this doesn't allow
            // for column styles like DataGridEditorColumn where not all of the cell area is the text area. If
            // we check only the text then the tooltip doesn't move when the user moves the mouse from one cell
            // to another cell that happens to contain the same text.

            if (overSameCell && m_toolTip.GetToolTip(this) == cellText)
            {
                return;
            }

            SetToolTip(cellText);
        }
Exemple #14
0
        private void makeGeotiffDataGridStyle()
        {
            if (m_geotiffTS != null)
            {
                return;
            }

            //STEP 1: Create a DataTable style object and set properties if required.
            m_geotiffTS = new DataGridTableStyle();
            //specify the table from dataset (required step)
            m_geotiffTS.MappingName = "geotiff";
            // Set other properties (optional step)
            //m_geotiffTS.AlternatingBackColor = Color.LightBlue;

            int colCount = 0;

            //STEP 1: Create an int column style and add it to the tablestyle
            //this requires setting the format for the column through its property descriptor
            PropertyDescriptorCollection pdc = this.BindingContext[m_geotiffDS, "geotiff"].GetItemProperties();
            //now created a formated column using the pdc
            DataGridDigitsTextBoxColumn csIDInt = new DataGridDigitsTextBoxColumn(pdc["id"], "i", true);

            csIDInt.MappingName = "id";
            csIDInt.HeaderText  = "";
            csIDInt.Width       = 30;
            csIDInt.ReadOnly    = true;
            m_geotiffTS.GridColumnStyles.Add(csIDInt);
            colCount++;

            //STEP 2: Create a string column and add it to the tablestyle
            NameCol             = new DataGridTextBoxColumn();
            NameCol.MappingName = "name";             //from dataset table
            NameCol.HeaderText  = "Name";
            NameCol.Width       = Math.Max(10, Project.nameColWidthCm);
            NameCol.ReadOnly    = true;
            m_geotiffTS.GridColumnStyles.Add(NameCol);
            colCount++;

            //STEP 3: Add the checkbox
            DataGridColumnStyle boolCol = new MyDataGridBoolColumn(colCount);

            boolCol.MappingName = "displayed";
            boolCol.HeaderText  = "Shown";
            //hook the new event to our handler in the grid
            ((MyDataGridBoolColumn)boolCol).BoolValueChanged += new BoolValueChangedEventHandler(HandleCustomMapShowChanges);
            //uncomment this line to get a two-state checkbox
            ((DataGridBoolColumn)boolCol).AllowNull = false;
            boolCol.Width = 45;
            m_geotiffTS.GridColumnStyles.Add(boolCol);
            colCount++;

            //STEP 3: Add the checkbox
            DataGridColumnStyle boolCol2 = new MyDataGridBoolColumn(colCount);

            boolCol2.MappingName = "persist";
            boolCol2.HeaderText  = "Load on start";
            //hook the new event to our handler in the grid
            ((MyDataGridBoolColumn)boolCol2).BoolValueChanged += new BoolValueChangedEventHandler(HandleCustomMapPersistChanges);
            //uncomment this line to get a two-state checkbox
            ((DataGridBoolColumn)boolCol2).AllowNull = false;
            boolCol2.Width = 80;
            m_geotiffTS.GridColumnStyles.Add(boolCol2);
            colCount++;

            //STEP 4: Create a string column and add it to the tablestyle
            DescrCol             = new DataGridTextBoxColumn();
            DescrCol.MappingName = "descr";             //from dataset table
            DescrCol.HeaderText  = "Description";
            //DescrCol.Width = Math.Max(10, Project.descColWidthCm);
            DescrCol.Width    = 1;
            DescrCol.ReadOnly = true;
            m_geotiffTS.GridColumnStyles.Add(DescrCol);
            colCount++;

            //STEP 5: Create a string column and add it to the tablestyle
            SourceCol             = new DataGridTextBoxColumn();
            SourceCol.MappingName = "source";             //from dataset table
            SourceCol.HeaderText  = "Source";
            int colWidthLeft = Math.Max(100, this.Width - csIDInt.Width - NameCol.Width - boolCol.Width - DescrCol.Width - 140);

            SourceCol.Width    = Math.Max(colWidthLeft, 100);          // Project.sourceColWidthCm);
            SourceCol.ReadOnly = true;
            m_geotiffTS.GridColumnStyles.Add(SourceCol);
            colCount++;

            geotiffDataGrid.CaptionVisible = false;

            //STEP 6: Add the tablestyle to your datagrid's tablestlye collection:
            geotiffDataGrid.TableStyles.Add(m_geotiffTS);

            /* how to test for checked checkboxes:
             * if((bool)geotiffDataGrid[row, column])
             *      MessageBox.Show("I am true");
             * else
             *      MessageBox.Show("I am false");
             */
        }
	public virtual bool EndEdit(DataGridColumnStyle gridColumn, int rowNumber, bool shouldAbort) {}
	// Methods
	public virtual int Add(DataGridColumnStyle column) {}
	// Methods
	public virtual bool BeginEdit(DataGridColumnStyle gridColumn, int rowNumber) {}
Exemple #18
0
        public void DoExecute()
        {
            if (stbMain.Text.Length == 0)
            {
                return;
            }

            if (!panelBottom.Visible)
            {
                stbMain.Dock        = DockStyle.Top;
                sptMain.Visible     = true;
                panelBottom.Visible = true;
            }

            rtxtResults.Clear();
            rtxtResults.BringToFront();

            for (int iControl = panelGrids.Controls.Count; --iControl >= 0;)
            {
                panelGrids.Controls.RemoveAt(iControl);
            }

            m_oDataSet      = null;
            m_fExecuteError = false;
            m_sLastError    = "";
            sbpStatus.Text  = "Executing query batch...";
            sbpTime.Text    = GetTimeText(0);
            sbpRows.Text    = "0 rows";

            try
            {
                if (m_oConn.State != ConnectionState.Open)
                {
                    m_oConn.Open();
                    m_oConn.ChangeDatabase(sbpDatabase.Text);
                }

                m_fCancelExecute = false;

                long cTickStart = DateTime.Now.Ticks;

                System.Threading.Thread oThread = new System.Threading.Thread(new System.Threading.ThreadStart(ExecuteQuery));
                oThread.Start();

                int cRows = 0;

                string sLastTime = "";
                while (oThread.IsAlive)
                {
                    string sTime = GetTimeText(DateTime.Now.Ticks - cTickStart);
                    if (sTime != sLastTime)
                    {
                        Globals.MainForm.UpdateExecuteState(this);
                        sbpTime.Text = sTime;

                        cRows = 0;
                        if (m_oDataSet != null)
                        {
                            foreach (DataTable oTable in m_oDataSet.Tables)
                            {
                                cRows += oTable.Rows.Count;
                            }
                            if (cRows == 1)
                            {
                                sbpRows.Text = "1 row";
                            }
                            else
                            {
                                sbpRows.Text = cRows.ToString("#,##0") + " rows";
                            }
                        }

                        sLastTime = sTime;
                    }

                    if (m_fCancelExecute)
                    {
                        try
                        {
                            oThread.Abort();
                        }
                        catch (Exception oEx)
                        {
                            string s = oEx.ToString();
                            s = "";
                        }
                        m_fIsExecuting = false;
                        Globals.MainForm.UpdateExecuteState(this);
                    }
                    else
                    {
                        Application.DoEvents();
                        System.Threading.Thread.Sleep(200);
                    }
                }

                int cTables = m_oDataSet.Tables.Count;
                int dypGrid = (cTables == 0) ? 0 : panelGrids.Height / cTables;
                if (dypGrid < kdypMinResults)
                {
                    dypGrid = kdypMinResults;
                }
                panelGrids.AutoScrollMinSize = new Size(0, dypGrid * cTables);

                //for (int iTable = cTables; --iTable >= 0; )
                for (int iTable = 0; iTable < cTables; iTable++)
                {
                    DataTable oTable = m_oDataSet.Tables[iTable];

                    NumberedDataGrid oGrid = new NumberedDataGrid();
                    oGrid.AllowSorting      = false;
                    oGrid.Size              = new System.Drawing.Size(panelGrids.Width, dypGrid);
                    oGrid.BackgroundColor   = System.Drawing.SystemColors.Window;
                    oGrid.CaptionVisible    = false;
                    oGrid.HeaderForeColor   = System.Drawing.SystemColors.ControlText;
                    oGrid.ReadOnly          = true;
                    oGrid.RowHeadersVisible = false;
                    //oGrid.Resize += new EventHandler(Grid_Resize);
                    panelGrids.Resize += new EventHandler(Grid_Resize);

                    panelGrids.Controls.Add(oGrid);
                    oGrid.Location = new Point(0, iTable * (dypGrid + kdypSpacing));

                    oTable.DefaultView.AllowNew    = false;
                    oTable.DefaultView.AllowEdit   = false;
                    oTable.DefaultView.AllowDelete = false;

                    DataGridTableStyle oTableStyle = new DataGridTableStyle();
                    oTableStyle.RowHeadersVisible = true;
                    oTableStyle.ReadOnly          = true;
                    oTableStyle.MappingName       = oTable.TableName;
                    oTableStyle.AllowSorting      = false;

                    foreach (DataColumn oColumn in oTable.Columns)
                    {
                        DataGridColumnStyle oColStyle = GetColStyle(oColumn);
                        oTableStyle.GridColumnStyles.Add(oColStyle);
                    }

                    oGrid.TableStyles.Add(oTableStyle);
                    oGrid.DataSource = oTable;
                }

                if (cTables == 0)
                {
                    if (m_sbMessages.Length == 0)
                    {
                        SqlCommand oCommand = m_oConn.CreateCommand();
                        oCommand.CommandText = "select @@rowcount";
                        int cRecords = (int)oCommand.ExecuteScalar();
                        if (cRecords == 1)
                        {
                            m_sbMessages.AppendLine("(1 row affected)");
                        }
                        else
                        {
                            m_sbMessages.AppendLine("(" + cRecords.ToString("#,##0") + " rows affected)");
                        }
                    }
                    rtxtResults.Text = m_sbMessages.ToString();
                    rtxtResults.BringToFront();
                }
                else
                {
                    panelGrids.BringToFront();
                }

                sbpTime.Text = GetTimeText(DateTime.Now.Ticks - cTickStart);

                cRows = 0;
                foreach (DataTable oTable in m_oDataSet.Tables)
                {
                    cRows += oTable.Rows.Count;
                }
                if (cRows == 1)
                {
                    sbpRows.Text = "1 row";
                }
                else
                {
                    sbpRows.Text = cRows.ToString("#,##0") + " rows";
                }

                // Since the database might have changed, update it.
                if (m_oConn.State == ConnectionState.Open)
                {
                    sbpDatabase.Text = m_oConn.Database;
                }

                if (m_fCancelExecute)
                {
                    sbpStatus.Text = "Query batch was cancelled";
                }
                else
                {
                    sbpStatus.Text = "Query batch completed";
                }
            }
            catch (Exception oEx)
            {
                m_sLastError = oEx.Message;
            }

            if (m_fExecuteError && !m_fCancelExecute)
            {
                sbpStatus.Text = "Query batch completed with errors";
                rtxtResults.Clear();
                rtxtResults.SelectionColor = System.Drawing.Color.Red;
                rtxtResults.SelectedText   = m_sLastError;
                rtxtResults.BringToFront();
            }

            m_fIsExecuting = false;
        }