/// <summary> /// Use this function if you do not add your columns at design time. /// </summary> /// <param name="colType"></param> /// <returns></returns> private DataGridViewColumn SetupColumn(VaultGridColumn colType) { DataGridViewColumn column = null; switch (colType) { case VaultGridColumn.ColumnIndex: column = new KryptonDataGridViewTextBoxColumn(); column.HeaderText = "Index"; column.Name = "ColumnIndex"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case VaultGridColumn.ColumnHasUCE: column = new KryptonDataGridViewCheckBoxColumn(); column.HeaderText = "Has UCE?"; column.Name = "ColumnHasUCE"; column.Resizable = DataGridViewTriState.True; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 78; return(column); case VaultGridColumn.ColumnTitle: column = new KryptonDataGridViewTextBoxColumn();// KryptonDataGridViewTextBoxColumn(); column.HeaderText = "Title"; column.Name = "ColumnTitle"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case VaultGridColumn.ColumnGenre: column = new KryptonDataGridViewTreeTextColumn(); column.HeaderText = "Genre"; column.Name = "ColumnGenre"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case VaultGridColumn.ColumnCoverArtFile: column = new KryptonDataGridViewTextBoxColumn(); column.HeaderText = "Cover Art"; column.Name = "ColumnCoverArtFile"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case VaultGridColumn.ColumnBezelArtFile: column = new KryptonDataGridViewTextBoxColumn(); column.HeaderText = "Bezel Art"; column.Name = "ColumnBezelArtFile"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case VaultGridColumn.ColumnUseInternalCore: column = new KryptonDataGridViewCheckBoxColumn(); column.HeaderText = "Use Internal Core"; column.Name = "ColumnUseInternalCore"; //((KryptonDataGridViewCheckBoxColumn)column). column.Resizable = DataGridViewTriState.True; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 78; return(column); case VaultGridColumn.ColumnEmulatorCoreFile: column = new KryptonDataGridViewTextBoxColumn(); column.HeaderText = "Emulator Core"; column.Name = "ColumnEmulatorCoreFile"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case VaultGridColumn.ColumnOverLayFile: column = new KryptonDataGridViewTextBoxColumn(); column.HeaderText = "Overlay?"; column.Name = "ColumnOverLayFile"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case VaultGridColumn.ColumnROMFile: column = new KryptonDataGridViewTextBoxColumn(); column.HeaderText = "ROM"; column.Name = "ColumnROMFile"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case VaultGridColumn.ColumnDescription: column = new KryptonDataGridViewTextBoxColumn(); column.HeaderText = "Description"; column.Name = "ColumnDescription"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case VaultGridColumn.ColumnResizeImages: column = new KryptonDataGridViewCheckBoxColumn(); column.HeaderText = "Resize Images?"; column.Name = "ColumnResizeImages"; column.Resizable = DataGridViewTriState.True; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 78; return(column); default: throw new Exception("Unknown Column Type !! TODO improve that !"); } }
/// <summary> /// Use this function if you do not add your columns at design time. /// </summary> /// <param name="colType"></param> /// <returns></returns> private DataGridViewColumn SetupColumn(SandBoxGridColumn colType) { DataGridViewColumn column = null; switch (colType) { case SandBoxGridColumn.ColumnCustomerID: column = new KryptonDataGridViewTextBoxColumn(); column.HeaderText = "Customer ID"; column.Name = "ColumnCustomerID"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case SandBoxGridColumn.ColumnCustomerName: column = new KryptonDataGridViewTreeTextColumn();// KryptonDataGridViewTextBoxColumn(); column.HeaderText = "Name"; column.Name = "ColumnCustomerName"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case SandBoxGridColumn.ColumnAddress: column = new KryptonDataGridViewTextBoxColumn(); column.HeaderText = "Address"; column.Name = "ColumnAddress"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case SandBoxGridColumn.ColumnCity: column = new KryptonDataGridViewTextBoxColumn(); column.HeaderText = "City"; column.Name = "ColumnCity"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case SandBoxGridColumn.ColumnCountry: column = new KryptonDataGridViewTextAndImageColumn(); column.HeaderText = "Country"; column.Name = "ColumnCountry"; column.Resizable = DataGridViewTriState.True; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 78; return(column); case SandBoxGridColumn.ColumnOrderDate: column = new KryptonDataGridViewDateTimePickerColumn(); ((KryptonDataGridViewDateTimePickerColumn)column).CalendarTodayDate = DateTime.Now; ((KryptonDataGridViewDateTimePickerColumn)column).Checked = false; ((KryptonDataGridViewDateTimePickerColumn)column).Format = DateTimePickerFormat.Short; column.HeaderText = "Order Date"; column.Name = "ColumnOrderDate"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case SandBoxGridColumn.ColumnProduct: column = new KryptonDataGridViewTextBoxColumn(); column.HeaderText = "Product"; column.Name = "ColumnProduct"; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case SandBoxGridColumn.ColumnPrice: column = new KryptonDataGridViewFormattingColumn(); column.Name = colType.ToString(); column.ValueType = typeof(decimal); //really important for formatting DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle(); dataGridViewCellStyle1.Format = "C2"; dataGridViewCellStyle1.NullValue = ""; column.DefaultCellStyle = dataGridViewCellStyle1; column.HeaderText = "Price"; column.Resizable = DataGridViewTriState.True; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.Width = 79; return(column); case SandBoxGridColumn.SatisfactionColumn: column = new KryptonDataGridViewPercentageColumn(); DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle(); dataGridViewCellStyle2.Format = "0%"; column.DefaultCellStyle = dataGridViewCellStyle2; column.HeaderText = "Satisfaction"; column.Name = colType.ToString(); column.SortMode = DataGridViewColumnSortMode.Programmatic; return(column); case SandBoxGridColumn.ColumnToken: column = new KryptonDataGridViewTokenColumn(); column.Name = colType.ToString(); column.ReadOnly = true; column.SortMode = DataGridViewColumnSortMode.Programmatic; column.HeaderText = "Tag"; return(column); default: throw new Exception("Unknown Column Type !! TODO improve that !"); } }