private void Populate()
        {
            Slyce.Common.Utility.SuspendPainting(slyceGrid1);
            slyceGrid1.Clear();
            // Populate Columns from Entity
            slyceGrid1.Columns.Add(new ColumnItem("Name", ColumnItem.ColumnTypes.Textbox, "NewProp", "General"));
            slyceGrid1.Columns.Add(new ColumnItem("Description", ColumnItem.ColumnTypes.Textbox, "System.String", "General"));
            slyceGrid1.Columns.Add(new ColumnItem("Is Nullable", ColumnItem.ColumnTypes.Checkbox, false, "General"));
            //slyceGrid1.Columns.Add(new ColumnItem("Data Type", ColumnItem.ColumnTypes.ComboBox, "varchar(20)", "General"));

            string defaultDbType = ArchAngel.Interfaces.ProjectOptions.TypeMappings.Utility.GetDefaultDatabaseType(Table.Database.DatabaseType.ToString(), "System.String");
            ColumnItem col = new ColumnItem("Data Type", ColumnItem.ColumnTypes.ComboBox, defaultDbType, "General");
            col.ColorScheme = ColumnItem.ColorSchemes.Blue;

            foreach (var dbTypeName in ArchAngel.Interfaces.ProjectOptions.TypeMappings.Utility.GetDatabaseTypes(Table.Database.DatabaseType.ToString()).Select(d => d.TypeName).Distinct())
                col.ComboItems.Add(dbTypeName, null);

            slyceGrid1.Columns.Add(col);

            slyceGrid1.Columns.Add(new ColumnItem("Default Value", ColumnItem.ColumnTypes.Textbox, "", "General"));
            slyceGrid1.Columns.Add(new ColumnItem("Ordinal Position", ColumnItem.ColumnTypes.IntegerInput, "0", "General"));
            slyceGrid1.Columns.Add(new ColumnItem("Size", ColumnItem.ColumnTypes.IntegerInput, "8", "General"));
            slyceGrid1.Columns.Add(new ColumnItem("Size Is Max", ColumnItem.ColumnTypes.Checkbox, false, "General"));
            slyceGrid1.Columns.Add(new ColumnItem("Precision", ColumnItem.ColumnTypes.IntegerInput, "1", "General"));
            slyceGrid1.Columns.Add(new ColumnItem("Scale", ColumnItem.ColumnTypes.IntegerInput, "1", "General"));

            foreach (Key key in Table.Keys)
                slyceGrid1.Columns.Add(new ColumnItem(GetColumnHeaderForKey(key), ColumnItem.ColumnTypes.Checkbox, false, "Keys"));

            foreach (Column column in Table.Columns)
                AddColumnToColumnsGrid(column);

            slyceGrid1.Populate();
            Slyce.Common.Utility.ResumePainting(slyceGrid1);
        }
Example #2
0
        private void PopulateEntitiesGrid()
        {
            Slyce.Common.Utility.SuspendPainting(slyceGridEntities);
            slyceGridEntities.ShowDeleteColumn = false;
            slyceGridEntities.Clear();
            ColumnItem entityCol = new ColumnItem("Entity", ColumnItem.ColumnTypes.Textbox, "NewProp", "");
            entityCol.ColorScheme = ColumnItem.ColorSchemes.Black;
            entityCol.ReadOnly = true;
            slyceGridEntities.Columns.Add(entityCol);

            #region Add custom namespaces
            if (ShowNamespaces)
            {
                bool exists = false;

                foreach (CustomNamespace ns in EntitySet.CustomNamespaces.OrderBy(n => n.Value))
                {
                    exists = true;
                    ColumnItem col = new ColumnItem(ns.Value, ColumnItem.ColumnTypes.Checkbox, "NewProp", "Namespaces");
                    col.IsLink = true;
                    col.Clicked += new MouseEventHandler(colNamespace_Clicked);
                    col.Tag = ns;
                    col.ColorScheme = ColumnItem.ColorSchemes.Green;
                    slyceGridEntities.Columns.Add(col);
                }
                if (!exists)
                {
                    ColumnItem addNewColumn = new ColumnItem("", ColumnItem.ColumnTypes.None, null, "Namespaces");
                    addNewColumn.IsLink = false;
                    addNewColumn.ColorScheme = ColumnItem.ColorSchemes.Green;
                    slyceGridEntities.Columns.Add(addNewColumn);
                }
            }
            #endregion

            #region Add custom attributes
            if (ShowAttributes)
            {
                bool exists = false;

                foreach (CustomAttribute ca in EntitySet.CustomAttributes.OrderBy(a => a.RawName))
                {
                    exists = true;
                    ColumnItem col = new ColumnItem(ca.RawName, ColumnItem.ColumnTypes.Checkbox, "NewProp", "Attributes");
                    col.IsLink = true;
                    col.Clicked += new MouseEventHandler(colAttribute_Clicked);
                    col.Tag = ca;
                    col.ColorScheme = ColumnItem.ColorSchemes.Blue;
                    slyceGridEntities.Columns.Add(col);
                }
                if (!exists)
                {
                    ColumnItem addNewColumn = new ColumnItem("", ColumnItem.ColumnTypes.None, null, "Attributes");
                    addNewColumn.IsLink = false;
                    addNewColumn.ColorScheme = ColumnItem.ColorSchemes.Blue;
                    slyceGridEntities.Columns.Add(addNewColumn);
                }
            }
            #endregion

            #region Add custom base names
            if (ShowImplements)
            {
                bool exists = false;

                foreach (CustomImplement ci in EntitySet.CustomImplements.OrderBy(n => n.Value))
                {
                    exists = true;
                    ColumnItem col = new ColumnItem(ci.Value, ColumnItem.ColumnTypes.Checkbox, "NewProp", "Base Names");
                    col.IsLink = true;
                    col.Clicked += new MouseEventHandler(colImplement_Clicked);
                    col.Tag = ci;
                    col.ColorScheme = ColumnItem.ColorSchemes.Yellow;
                    slyceGridEntities.Columns.Add(col);
                }
                if (!exists)
                {
                    ColumnItem addNewColumn = new ColumnItem("", ColumnItem.ColumnTypes.None, null, "Base Names");
                    addNewColumn.IsLink = false;
                    addNewColumn.ColorScheme = ColumnItem.ColorSchemes.Yellow;
                    slyceGridEntities.Columns.Add(addNewColumn);
                }
            }
            #endregion

            #region Add custom properties
            if (ShowProperties)
            {
                bool exists = false;

                foreach (CustomProperty cp in EntitySet.CustomProperties.OrderBy(n => n.Name))
                {
                    exists = true;
                    ColumnItem col = new ColumnItem(cp.Name, ColumnItem.ColumnTypes.Checkbox, "NewProp", "Properties");
                    col.IsLink = true;
                    col.Clicked += new MouseEventHandler(colProperty_Clicked);
                    col.Tag = cp;
                    col.ColorScheme = ColumnItem.ColorSchemes.Red;
                    slyceGridEntities.Columns.Add(col);
                }
                if (!exists)
                {
                    ColumnItem addNewColumn = new ColumnItem("", ColumnItem.ColumnTypes.None, null, "Properties");
                    addNewColumn.IsLink = false;
                    addNewColumn.ColorScheme = ColumnItem.ColorSchemes.Red;
                    slyceGridEntities.Columns.Add(addNewColumn);
                }
            }
            #endregion

            #region Add custom functions
            if (ShowFunctions)
            {
                bool exists = false;

                foreach (CustomFunction cm in EntitySet.CustomFunctions.OrderBy(n => n.Name))
                {
                    exists = true;
                    ColumnItem col = new ColumnItem(cm.Name, ColumnItem.ColumnTypes.Checkbox, "NewProp", "Functions");
                    col.IsLink = true;
                    col.Clicked += new MouseEventHandler(colMethod_Clicked);
                    col.Tag = cm;
                    col.ColorScheme = ColumnItem.ColorSchemes.Orange;
                    slyceGridEntities.Columns.Add(col);
                }
                if (!exists)
                {
                    ColumnItem addNewColumn = new ColumnItem("", ColumnItem.ColumnTypes.None, null, "Functions");
                    addNewColumn.IsLink = false;
                    addNewColumn.ColorScheme = ColumnItem.ColorSchemes.Orange;
                    slyceGridEntities.Columns.Add(addNewColumn);
                }
            }
            #endregion

            foreach (Entity entity in EntitySet.Entities)
                AddEntityToEntitiesGrid(entity);

            slyceGridEntities.Populate();
            slyceGridEntities.FrozenColumnIndex = 1;
            Slyce.Common.Utility.ResumePainting(slyceGridEntities);
        }
Example #3
0
        private void Populate()
        {
            Slyce.Common.Utility.SuspendPainting(slyceGrid1);
            slyceGrid1.Clear();
            // Populate Columns from Entity
            slyceGrid1.Columns.Add(new ColumnItem("Name", ColumnItem.ColumnTypes.Textbox, "NewProp", "General"));

            ColumnItem keyTypeColumn = new ColumnItem("Type", ColumnItem.ColumnTypes.ComboBox, "", "General");

            foreach (string name in Enum.GetNames(typeof(Helper.DatabaseKeyType)))
                keyTypeColumn.ComboItems.Add(name, name);

            slyceGrid1.Columns.Add(keyTypeColumn);
            slyceGrid1.Columns.Add(new ColumnItem("Description", ColumnItem.ColumnTypes.Textbox, "", "General"));

            foreach (Key key in Table.Keys)
                AddKeyToKeysGrid(key);

            slyceGrid1.Populate();
            Slyce.Common.Utility.ResumePainting(slyceGrid1);
        }
        private void Populate()
        {
            //ArchAngel.Interfaces.
            Slyce.Common.Utility.SuspendPainting(slyceGrid1);
            slyceGrid1.Clear();
            // Populate Columns from Entity

            #region Name column
            ColumnItem col = new ColumnItem("Name", ColumnItem.ColumnTypes.Textbox, "NewProp", "General");
            col.ColorScheme = ColumnItem.ColorSchemes.Blue;
            slyceGrid1.Columns.Add(col);
            #endregion

            #region Type column
            col = new ColumnItem("Type", ColumnItem.ColumnTypes.ComboBox, "System.String", "General");
            col.ColorScheme = ColumnItem.ColorSchemes.Blue;

            foreach (var x in ArchAngel.Interfaces.ProjectOptions.TypeMappings.Utility.DotNetTypes.Select(t => t.CSharpName).Distinct())
                col.ComboItems.Add(x, null);

            slyceGrid1.Columns.Add(col);
            #endregion

            #region NHibernate Type column
            col = new ColumnItem("NHibernate Type", ColumnItem.ColumnTypes.ComboBox, "System.String", "General");
            col.ColorScheme = ColumnItem.ColorSchemes.Blue;

            foreach (var x in Enum.GetNames(typeof(PropertyImpl.NHibernateTypes)).OrderBy(t => t))
                col.ComboItems.Add(x, null);

            slyceGrid1.Columns.Add(col);
            #endregion

            #region MappedColumns column
            ColumnItem mappedColumnsColumn = new ColumnItem("Mapped To", ColumnItem.ColumnTypes.ComboBox, "", "General");
            mappedColumnsColumn.ComboItems.Add("", null);
            mappedColumnsColumn.ColorScheme = ColumnItem.ColorSchemes.Blue;

            int numTables = MappedTables.Count;

            bool hasMultiSchemas = MappedTables.Select(t => t.Schema).Distinct().Count() > 1;

            foreach (Table table in MappedTables)
            {
                foreach (Column column in table.Columns)
                {
                    string name;

                    if (numTables == 1) name = column.Name;
                    else if (hasMultiSchemas) name = string.Format("{0}.{1}.{2}", table.Schema, table.Name, column.Name);
                    else name = string.Format("{0}.{1}", table.Name, column.Name);

                    if (!mappedColumnsColumn.ComboItems.ContainsKey(name))
                        mappedColumnsColumn.ComboItems.Add(name, column);
                }
            }
            slyceGrid1.Columns.Add(mappedColumnsColumn);
            #endregion

            #region InKey column
            col = new ColumnItem("In Key", ColumnItem.ColumnTypes.Checkbox, false, "General");
            col.ColorScheme = ColumnItem.ColorSchemes.Blue;
            slyceGrid1.Columns.Add(col);
            #endregion

            #region ReadOnly column
            col = new ColumnItem("Read-only", ColumnItem.ColumnTypes.Checkbox, false, "General");
            col.ColorScheme = ColumnItem.ColorSchemes.Blue;
            slyceGrid1.Columns.Add(col);
            #endregion

            ArchAngel.Providers.EntityModel.Model.EntityLayer.PropertyImpl prop = new ArchAngel.Providers.EntityModel.Model.EntityLayer.PropertyImpl();

            foreach (ArchAngel.Interfaces.ITemplate.IUserOption uo in prop.Ex.OrderBy(u => u.Name))
            {
                if (uo.DataType == typeof(bool?))
                    col = new ColumnItem(uo.Text, ColumnItem.ColumnTypes.NullableCheckBox, null, "General");
                else if (uo.DataType == typeof(string))
                    col = new ColumnItem(uo.Text, ColumnItem.ColumnTypes.Textbox, null, "General");
                else if (uo.DataType == typeof(int))
                    col = new ColumnItem(uo.Text, ColumnItem.ColumnTypes.IntegerInput, null, "General");
                else if (uo.DataType == typeof(bool))
                    col = new ColumnItem(uo.Text, ColumnItem.ColumnTypes.Checkbox, null, "General");
                else if (uo.DataType.ToString() == "ArchAngel.Interfaces.NHibernateEnums.PropertyAccessTypes")
                {
                    col = new ColumnItem(uo.Text, ColumnItem.ColumnTypes.ComboBox, null, "General");

                    foreach (var x in Enum.GetNames(typeof(ArchAngel.Interfaces.NHibernateEnums.PropertyAccessTypes)).OrderBy(t => t))
                        col.ComboItems.Add(x, null);
                }
                else if (uo.DataType.ToString() == "ArchAngel.Interfaces.NHibernateEnums.PropertyGeneratedTypes")
                {
                    col = new ColumnItem(uo.Text, ColumnItem.ColumnTypes.ComboBox, null, "General");

                    foreach (var x in Enum.GetNames(typeof(ArchAngel.Interfaces.NHibernateEnums.PropertyGeneratedTypes)).OrderBy(t => t))
                        col.ComboItems.Add(x, null);
                }
                else
                    throw new NotImplementedException("Type not handled yet: " + uo.DataType.Name);

                col.ColorScheme = ColumnItem.ColorSchemes.Blue;
                slyceGrid1.Columns.Add(col);
            }
            #region Validation options
            slyceGrid1.Columns.Add(new ColumnItem("Fractional Digits", ColumnItem.ColumnTypes.NullableIntegerInput, 0, "Validation (optional)") { ColorScheme = ColumnItem.ColorSchemes.Green });
            slyceGrid1.Columns.Add(new ColumnItem("Future Date", ColumnItem.ColumnTypes.NullableCheckBox, false, "Validation (optional)") { ColorScheme = ColumnItem.ColorSchemes.Green });
            slyceGrid1.Columns.Add(new ColumnItem("Integer Digits", ColumnItem.ColumnTypes.NullableIntegerInput, 0, "Validation (optional)") { ColorScheme = ColumnItem.ColorSchemes.Green });
            slyceGrid1.Columns.Add(new ColumnItem("Max Length", ColumnItem.ColumnTypes.NullableIntegerInput, 0, "Validation (optional)") { ColorScheme = ColumnItem.ColorSchemes.Green });
            slyceGrid1.Columns.Add(new ColumnItem("Min Length", ColumnItem.ColumnTypes.NullableIntegerInput, 0, "Validation (optional)") { ColorScheme = ColumnItem.ColorSchemes.Green });
            slyceGrid1.Columns.Add(new ColumnItem("Max Value", ColumnItem.ColumnTypes.NullableIntegerInput, 0, "Validation (optional)") { ColorScheme = ColumnItem.ColorSchemes.Green });
            slyceGrid1.Columns.Add(new ColumnItem("Min Value", ColumnItem.ColumnTypes.NullableIntegerInput, 0, "Validation (optional)") { ColorScheme = ColumnItem.ColorSchemes.Green });
            slyceGrid1.Columns.Add(new ColumnItem("Not Empty", ColumnItem.ColumnTypes.NullableCheckBox, false, "Validation (optional)") { ColorScheme = ColumnItem.ColorSchemes.Green });
            slyceGrid1.Columns.Add(new ColumnItem("Nullable", ColumnItem.ColumnTypes.NullableCheckBox, false, "Validation (optional)") { ColorScheme = ColumnItem.ColorSchemes.Green });
            slyceGrid1.Columns.Add(new ColumnItem("Past Date", ColumnItem.ColumnTypes.NullableCheckBox, false, "Validation (optional)") { ColorScheme = ColumnItem.ColorSchemes.Green });
            slyceGrid1.Columns.Add(new ColumnItem("Regex", ColumnItem.ColumnTypes.NullableTextBox, "", "Validation (optional)") { ColorScheme = ColumnItem.ColorSchemes.Green });
            slyceGrid1.Columns.Add(new ColumnItem("Validate", ColumnItem.ColumnTypes.NullableCheckBox, false, "Validation (optional)") { ColorScheme = ColumnItem.ColorSchemes.Green });
            #endregion

            foreach (ArchAngel.Providers.EntityModel.Model.EntityLayer.Property property in Entity.Properties.Except(Entity.ForeignKeyPropertiesToExclude))
            {
                AddPropertyToPropertiesGrid(property, hasMultiSchemas);
            }
            slyceGrid1.Populate();
            slyceGrid1.FrozenColumnIndex = 1;
            Slyce.Common.Utility.ResumePainting(slyceGrid1);
        }
Example #5
0
        private void dataGridViewX1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
        {
            if (EditColumns.ContainsKey(e.ColumnIndex))
            {
                if (e.RowIndex >= Items.Count)
                {
                    return;
                }

                bool ignore = Items[e.RowIndex].SubItems[EditColumns[e.ColumnIndex]].Ignore;

                if (ignore)
                {
                    return;
                }

                ColumnItem col = Columns[EditColumns[e.ColumnIndex]];
                string     val = e.FormattedValue.ToString();

                switch (col.ControlType)
                {
                case ColumnItem.ColumnTypes.NullableIntegerInput:
                    int result;

                    if (string.IsNullOrEmpty(val))
                    {
                        //dataGridViewX1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = NullColor;
                        return;
                    }
                    else if (!Int32.TryParse((string)e.FormattedValue, out result))
                    {
                        dataGridViewX1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.DarkRed;
                        return;
                    }
                    else
                    {
                        dataGridViewX1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = BackColor;
                        return;
                    }

                case ColumnItem.ColumnTypes.IntegerInput:
                    int result2;

                    if (string.IsNullOrEmpty(val))
                    {
                        // Nulls not allowed
                        dataGridViewX1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.DarkRed;
                        return;
                    }
                    else if (!Int32.TryParse((string)e.FormattedValue, out result2))
                    {
                        dataGridViewX1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.DarkRed;
                        return;
                    }
                    else
                    {
                        dataGridViewX1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = BackColor;
                        return;
                    }
                    //default:
                    //    throw new NotImplementedException("Not handled yet");
                }
            }
        }
Example #6
0
        private void PopulateColumns()
        {
            BusyPopulatingColumns = true;
            EditColumns.Clear();
            dataGridViewX1.Columns.Clear();

            if (ShowDeleteColumn)
            {
                DataGridViewImageColumn col = new DataGridViewImageColumn();
                col.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                col.DefaultCellStyle.NullValue = DeleteImage;
                col.HeaderText = "";
                col.Frozen     = FrozenColumnIndex.HasValue;
                dataGridViewX1.Columns.Add(col);
            }
            for (int i = 0; i < Columns.Count; i++)
            {
                ColumnItem column = Columns[i];
                //DataGridViewColumn colNullableCheckbox = null;
                DataGridViewColumn col = null;

                switch (column.ControlType)
                {
                case ColumnItem.ColumnTypes.Checkbox:
                    col = new DataGridViewCheckBoxColumn();
                    break;

                case ColumnItem.ColumnTypes.Textbox:
                    col = new DataGridViewTextBoxColumnEx();
                    ((DataGridViewTextBoxColumnEx)col).DisabledColor = DisabledColor;
                    ((DataGridViewTextBoxColumnEx)col).InvalidColor  = InvalidColor;
                    ((DataGridViewTextBoxColumnEx)col).BackColor     = BackColor;
                    break;

                case ColumnItem.ColumnTypes.IntegerInput:
                    col = new DataGridViewIntegerInputColumn();
                    ((DataGridViewIntegerInputColumn)col).DisplayControlForCurrentCellOnly = true;
                    ((DataGridViewIntegerInputColumn)col).BackgroundStyle.Border           = eStyleBorderType.None;
                    ((DataGridViewIntegerInputColumn)col).ShowUpDown = true;
                    break;

                case ColumnItem.ColumnTypes.NullableCheckBox:
                    col = new DataGridViewComboBoxColumnEx();
                    List <string> vals = new List <string>(new string[] { "", "True", "False" });
                    ((DataGridViewComboBoxColumnEx)col).DataSource    = vals;
                    ((DataGridViewComboBoxColumnEx)col).DisplayStyle  = DataGridViewComboBoxDisplayStyle.ComboBox;
                    ((DataGridViewComboBoxColumnEx)col).FlatStyle     = FlatStyle.Flat;
                    ((DataGridViewComboBoxColumnEx)col).DisabledColor = DisabledColor;
                    ((DataGridViewComboBoxColumnEx)col).InvalidColor  = InvalidColor;
                    ((DataGridViewComboBoxColumnEx)col).BackColor     = BackColor;
                    break;

                case ColumnItem.ColumnTypes.NullableTextBox:
                    col = new DataGridViewTextBoxColumnEx();
                    ((DataGridViewTextBoxColumnEx)col).DisabledColor = DisabledColor;
                    ((DataGridViewTextBoxColumnEx)col).InvalidColor  = InvalidColor;
                    ((DataGridViewTextBoxColumnEx)col).BackColor     = BackColor;
                    break;

                case ColumnItem.ColumnTypes.NullableIntegerInput:
                    col = new DataGridViewTextBoxColumnEx();
                    ((DataGridViewTextBoxColumnEx)col).DisabledColor = DisabledColor;
                    ((DataGridViewTextBoxColumnEx)col).InvalidColor  = InvalidColor;
                    ((DataGridViewTextBoxColumnEx)col).BackColor     = BackColor;
                    ((DataGridViewTextBoxColumnEx)col).Alignment     = DataGridViewContentAlignment.MiddleRight;
                    break;

                case ColumnItem.ColumnTypes.ComboBox:
                    col = new DataGridViewComboBoxColumnEx();
                    List <string> keys = column.ComboItems.Keys.ToList();
                    keys.Sort();
                    ((DataGridViewComboBoxColumnEx)col).DataSource    = keys;
                    ((DataGridViewComboBoxColumnEx)col).DisplayStyle  = DataGridViewComboBoxDisplayStyle.ComboBox;
                    ((DataGridViewComboBoxColumnEx)col).FlatStyle     = FlatStyle.Flat;
                    ((DataGridViewComboBoxColumnEx)col).DisabledColor = DisabledColor;
                    ((DataGridViewComboBoxColumnEx)col).InvalidColor  = InvalidColor;
                    ((DataGridViewComboBoxColumnEx)col).BackColor     = BackColor;
                    break;

                case ColumnItem.ColumnTypes.Image:
                    col = new DataGridViewImageColumn();
                    break;

                case ColumnItem.ColumnTypes.Link:
                    col = new DataGridViewLinkColumn();
                    break;

                case ColumnItem.ColumnTypes.None:
                    col = new DataGridViewLinkColumn();
                    break;

                default:
                    throw new NotImplementedException("Not handled yet");
                }
                //if (colNullableCheckbox != null)
                //{
                //    colNullableCheckbox.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;// true;
                //    colNullableCheckbox.Resizable = DataGridViewTriState.False;// false;
                //    dataGridViewX1.Columns.Add(colNullableCheckbox);
                //}
                col.Frozen       = (FrozenColumnIndex.HasValue && i < FrozenColumnIndex);
                col.HeaderText   = column.Text;
                col.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;                //.AllCells;
                col.Resizable    = DataGridViewTriState.True;
                col.ReadOnly     = column.ReadOnly;
                dataGridViewX1.Columns.Add(col);
                EditColumns.Add(dataGridViewX1.Columns.Count - 1, i);
            }
            //dataGridViewX1.Columns[1].Frozen = true;
            BusyPopulatingColumns = false;
        }