Пример #1
0
        private static DataGridViewColumn GenericColumn(GridColumnAttrib column)
        {
            var newCol = new DataGridViewColumn();

            newCol.Name             = column.ColumnName;
            newCol.DataPropertyName = column.ColumnName;
            newCol.HeaderText       = column.ColumnCaption;
            newCol.ValueType        = column.ColumnType;
            newCol.CellTemplate     = new DataGridViewTextBoxCell();
            newCol.SortMode         = DataGridViewColumnSortMode.Automatic;
            newCol.ReadOnly         = column.ColumnReadOnly;
            newCol.Visible          = column.ColumnVisible;
            return(newCol);
        }
Пример #2
0
        private static DataGridViewColumn GetColumn(GridColumnAttrib column)
        {
            switch (column.ColumnFormatType)
            {
            case ColumnFormatType.DefaultFormat:
            case ColumnFormatType.AttributeDisplayMemberOnly:
            case ColumnFormatType.NotePreview:
            case ColumnFormatType.FileSize:
                return(GenericColumn(column));

            case ColumnFormatType.AttributeCombo:
                return(DataGridComboColumn(column.Attributes, column.ColumnCaption, column.ColumnName));

            case ColumnFormatType.Image:
                return(DataGridImageColumn(column));
            }
            return(null);
        }