Inheritance: DataGridViewImageCell
Beispiel #1
0
        private void TrackerViewAddProgressColumns()
        {
            DataGridView dgv = TrackerView;

            if (dgv.Columns == null)
            {
                return;
            }

            const string colName = "Charge";
            var          col     = dgv.Columns[colName];

            if (col == null)
            {
                return;
            }
            int indxCharge = col.Index;

            DataGridViewProgressCell cell = FormHelper.GetDefaultProgressCell();

            cell.BarStyle = ProgressCellProgressStyle.Visible;
            var progressColumn = new DataGridViewProgressColumn(cell)
            {
                Name             = colName,
                SortMode         = DataGridViewColumnSortMode.Automatic,
                DataPropertyName = colName,
                CellTemplate     = cell,
                HeaderText       = col.HeaderText,
            };

            dgv.Columns.Remove(colName);
            dgv.Columns.Insert(indxCharge - 1, progressColumn);
        }
Beispiel #2
0
        private void CreateRow(DataGridViewRow row, Slot slot)
        {
            var btnDelete = new DataGridViewButtonCell {
                Value = "Delete"
            };
            var btnPause = new DataGridViewButtonCell {
                Value = GetStatus(slot)
            };
            var prgProgress = new DataGridViewProgressCell {
                Value = slot.percentage
            };

            //var cmbCategories = new DataGridViewComboBoxCell() { Value = slot.cat };

            //cmbCategories.DataSource = _jsr.Categories();
            //cmbCategories.ValueType = typeof (string);
            //cmbCategories.ReadOnly = false;

            prgProgress.SetProgressBarColor(Color.LimeGreen);

            row.CreateCells(dgvCurrent, slot.index, slot.nzo_id, Resources.MainForm_RefreshUI_Pause, slot.filename, slot.size, "progress",
                            slot.timeleft, slot.cat, slot.priority, slot.script, "delete");
            var dataGridViewColumn = dgvCurrent.Columns[Resources.MainForm_RefreshUI_delete];

            if (dataGridViewColumn != null)
            {
                row.Cells[dataGridViewColumn.Index] = btnDelete;
                dataGridViewColumn.AutoSizeMode     = DataGridViewAutoSizeColumnMode.ColumnHeader;
            }

            dataGridViewColumn = dgvCurrent.Columns[Resources.MainForm_RefreshUI_Pause];
            if (dataGridViewColumn != null)
            {
                row.Cells[dataGridViewColumn.Index] = btnPause;
                dataGridViewColumn.AutoSizeMode     = DataGridViewAutoSizeColumnMode.AllCells;
            }

            dataGridViewColumn = dgvCurrent.Columns["progress"];
            if (dataGridViewColumn != null)
            {
                row.Cells[dataGridViewColumn.Index] = prgProgress;
                dataGridViewColumn.AutoSizeMode     = DataGridViewAutoSizeColumnMode.AllCells;
            }

            dataGridViewColumn = dgvCurrent.Columns["Category"];
            if (dataGridViewColumn != null)
            {
                //row.Cells[dataGridViewColumn.Index] = cmbCategories;
                row.Cells[dataGridViewColumn.Index].Style.BackColor = GetColorByCategory(slot.cat);
            }

            if (slot.status.Equals("paused", StringComparison.InvariantCultureIgnoreCase))
            {
                row.DefaultCellStyle.BackColor = Color.LightGray;
            }
        }
 public DataGridViewProgressColumn( )
 {
     CellTemplate = new DataGridViewProgressCell( );
 }
 public DataGridViewProgressColumn()
 {
     CellTemplate = new DataGridViewProgressCell(); ;
 }