本文整理汇总了C#中System.Windows.Forms.DataGridViewCheckBoxColumn类的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewCheckBoxColumn类的具体用法?C# DataGridViewCheckBoxColumn怎么用?C# DataGridViewCheckBoxColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataGridViewCheckBoxColumn类属于System.Windows.Forms命名空间,在下文中一共展示了DataGridViewCheckBoxColumn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SquadForm
public SquadForm(DbConnect postgreConnect, DataSet globalDS, int squadID = -1)
{
InitializeComponent();
cbColumn = new DataGridViewCheckBoxColumn();
cbColumn.HeaderText = "Является сотрудником отряда";
cbColumn.DataPropertyName = "is_in_squad";
cbColumn.FillWeight = 40;
cbColumn.ReadOnly = false;
dataSet1 = globalDS;
postgreConnection = postgreConnect;
squadSelectBS.DataSource = dataSet1.Tables["squad"];
listBox1.DataSource = dataSet1.Tables["squad"];
listBox1.DisplayMember = "name";
listBox1.ValueMember = "id";
initEnd = true;
if (listBox1.SelectedValue != null)
ChangeSelectedSquad(int.Parse(listBox1.SelectedValue.ToString()));
else
DeactivateAllButtons();
SetButtonPermissions();
if (squadID != -1)
listBox1.SelectedValue = squadID;
bindingNavigator2.BindingSource = selectionsDataBS;
bindingNavigator1.BindingSource = employeesAddBS;
dataGridView1.DataSource = selectionsDataBS;
}
示例2: CreateDataGridViewCell
private void CreateDataGridViewCell(DataGridView dataGridView, string[] rows, string[] columns, bool readOnly)
{
dataGridView.Columns.Clear();
dataGridView.Rows.Clear();
DataGridViewColumnCollection matrixColumns = dataGridView.Columns;
matrixColumns.Add("nullColumn", "");
for (int j = 0; j < columns.Length; j++)
{
DataGridViewCheckBoxColumn checkColumn = new DataGridViewCheckBoxColumn();
checkColumn.Name = "testColumn";
checkColumn.HeaderText = columns[j];
checkColumn.TrueValue = true;
checkColumn.FalseValue = false;
checkColumn.FillWeight = 10;
checkColumn.ReadOnly = readOnly;
checkColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
matrixColumns.Add(checkColumn);
}
DataGridViewRowCollection matrixRows = dataGridView.Rows;
for (int i = 0; i < rows.Length; i++)
{
matrixRows.Add(rows[i]);
}
dataGridView.Columns[0].Frozen = true;
dataGridView.Columns[0].ReadOnly = true;
dataGridView.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
}
示例3: FrmInscripcion
public FrmInscripcion()
{
InitializeComponent();
ConfigureForm();
dataGridView1.AutoGenerateColumns = false;
dataGridView1.AutoSize = true;
dataGridView1.DataSource = bindingSource1;
DataGridViewColumn column = new DataGridViewTextBoxColumn();
column.DataPropertyName = "NOMBRE";
column.Name = "NOMBRE";
dataGridView1.Columns.Add(column);
column = new DataGridViewCheckBoxColumn();
column.DataPropertyName = "CARRERA";
column.Name = "CARRERA";
dataGridView1.Columns.Add(column);
column = new DataGridViewCheckBoxColumn();
column.DataPropertyName = "NIVEL";
column.Name = "NIVEL";
dataGridView1.Columns.Add(column);
DataGridViewButtonColumn column2 = new DataGridViewButtonColumn();
column2.DataPropertyName = "INSCRIBIR";
column2.Name = "INSCRIBIR";
column2.HeaderText = "INSCRIBIR";
column2.ToolTipText = "INSCRIBIR";
dataGridView1.Columns.Add(column2);
}
示例4: CargarTabla
public void CargarTabla()
{
// Format DataGridView
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.BackgroundColor = this.BackColor;
this.dataGridView1.RowHeadersWidth = 75;
String [] Semana = {"Lunes",
"Martes",
"Miercoles",
"Jueves",
"Viernes",
"Sabado"
};
// Add columns to DataGridView
foreach (String item in Semana)
{
DataGridViewCheckBoxColumn checkColumn = new DataGridViewCheckBoxColumn();
checkColumn.Name = "Columna_" + item;
checkColumn.HeaderText = item;
checkColumn.Width = 75;
checkColumn.ReadOnly = true;
checkColumn.FillWeight = 10; //if the datagridview is resized (on form resize) the checkbox won't take up too much; value is relative to the other columns' fill values
dataGridView1.Columns.Add(checkColumn);
}
// Add rows to DataGridView
for (int i = 7; i <= 32; i++)
{
TimeSpan t = TimeSpan.FromSeconds(25200 + ((i - 7)* 1800));
dataGridView1.Rows.Add();
dataGridView1.Rows[i - 7].HeaderCell.Value = t.ToString().Substring(0, 5) ;
}
// Sabados no se trabaja hasta las 10
for (int i = 0; i < 6; i++)
{
DataGridViewTextBoxCell TextBoxCell = new DataGridViewTextBoxCell();
dataGridView1[5, i] = TextBoxCell;
dataGridView1[5, i].Value = "";
dataGridView1[5, i].Style.BackColor = Color.Black;
dataGridView1[5, i].ReadOnly = true;
}
// Sabados no se trabaja desde las 5
for (int i = 16; i <= 25; i++)
{
DataGridViewTextBoxCell TextBoxCell = new DataGridViewTextBoxCell();
dataGridView1[5, i] = TextBoxCell;
dataGridView1[5, i].Value = "";
dataGridView1[5, i].Style.BackColor = Color.Black;
dataGridView1[5, i].ReadOnly = true;
}
}
示例5: button1_Click
private void button1_Click(object sender, EventArgs e)
{
//NavigateDirs nav = new NavigateDirs();
nav.WalkDirectoryTree(di, FileTypes.FileExtensions.mp3);
MusicFiles mList = nav.MusicFileList;
BindingSource bindingSource = new BindingSource();
foreach (MusicFile f in mList)
{
bindingSource.Add(f);
}
songGrid.AutoSize = true;
songGrid.AutoResizeColumns();
//Add checkbox Column
DataGridViewColumn column = new DataGridViewCheckBoxColumn();
column.DataPropertyName = "Copy";
column.Name = "Copy Song";
songGrid.Columns.Add(column);
songGrid.Columns["songFormat"].Visible = false;
songGrid.Columns["songLocation"].Visible = false;
songGrid.DataSource = bindingSource;
}
示例6: DtrForm
public DtrForm()
{
InitializeComponent();
this.CenterToScreen();
this.O_processCaller= new ProcessCaller(/*this*/);
this.O_paramReader = new ParamReader();
this.O_paramReader.readKbDatabase();
this.dataGridView1.MultiSelect = true;
this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
this.dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
this.dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
DataGridViewTextBoxColumn explainColumn = new DataGridViewTextBoxColumn();
explainColumn.HeaderText = "Info";
//explainColumn.ReadOnly = true;
explainColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
explainColumn.FillWeight = 75;
this.dataGridView1.Columns.Add(explainColumn);
this.dataGridView1.Rows.Add("First Line" + "\n" + "AAAA");
DataGridViewCheckBoxColumn chkToFix = new DataGridViewCheckBoxColumn();
chkToFix.HeaderText = "Fix ?";
chkToFix.Name = "chk";
chkToFix.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
chkToFix.FillWeight = 5;
chkToFix.ReadOnly = false;
this.dataGridView1.Columns.Insert(0, chkToFix);
this.dataGridView1.Rows[0].Cells[0].Value = true;
}
示例7: BuscarPedidos
private DataSet numMarca; //usado en funcion TModelos
#endregion Fields
#region Constructors
public BuscarPedidos()
{
InitializeComponent();
EN.ENPedidos enPedido = new EN.ENPedidos();
DataSet dsMarc = new DataSet();
dsMarc = enPedido.ObtenerListaMarcas();
numMarca = new DataSet();
numMarca = dsMarc;
DataGridViewButtonColumn buttons = new DataGridViewButtonColumn();
{
buttons.HeaderText = "Editar"; //texto de la columna
buttons.Text = "Editar"; //texto de cada boton, sale al introducir texto
buttons.UseColumnTextForButtonValue = true;
buttons.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
buttons.FlatStyle = FlatStyle.Standard;
buttons.CellTemplate.Style.BackColor = Color.Honeydew;
buttons.DisplayIndex = 0;
}
DataGridViewCheckBoxColumn boton = new DataGridViewCheckBoxColumn();
{
boton.HeaderText = "Eliminar";//texto de la columna
boton.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; //tamaño
boton.DisplayIndex = 0; //indice que ocupara en la tabla
}
TDataGridViewPedidos.Columns.Add(boton);
TDataGridViewPedidos.Columns.Add(buttons);
}
示例8: CheckboxColumn
private DataGridViewCheckBoxColumn CheckboxColumn(string columnName, string headerText)
{
DataGridViewCheckBoxColumn comboColumn = new DataGridViewCheckBoxColumn();
comboColumn.Name = columnName;
comboColumn.HeaderText = headerText;
return comboColumn;
}
示例9: agregarBotones
public DataGridView agregarBotones(DataGridView dataGridView, String tipo)
{
if (tipo == "SELECCIONAR")
{
DataGridViewCheckBoxColumn ColumnaSeleccionar = new DataGridViewCheckBoxColumn();
ColumnaSeleccionar.HeaderText = "SEL";
ColumnaSeleccionar.Name = "SELECCIONAR";
ColumnaSeleccionar.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
ColumnaSeleccionar.FlatStyle = FlatStyle.Standard;
ColumnaSeleccionar.DisplayIndex = dataGridView.Columns.Count;
ColumnaSeleccionar.CellTemplate.Style.BackColor = Color.Honeydew;
ColumnaSeleccionar.Width = 80;
if (dataGridView.Columns["SELECCIONAR"] == null)
{
dataGridView.Columns.Add(ColumnaSeleccionar);
}
else
{
dataGridView.Columns.Remove(dataGridView.Columns["Seleccionar"]);
dataGridView.Columns.Add(ColumnaSeleccionar);
}
}
return dataGridView;
}
示例10: frm_SelectStudent_Load
private void frm_SelectStudent_Load(object sender, EventArgs e)
{
ob = new class_Application();
s = "select user_id,user_name from user_access";
ds = ob.fill_data_set(s);
DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
dataGridView1.Columns.Add("user_id", "USER ID");
dataGridView1.Columns.Add("user_name", "USER NAME");
dataGridView1.Columns.Add(chk);
dataGridView1.Columns[2].HeaderText = "SELECT";
dataGridView1.Columns[2].Name = "select";
dataGridView1.RowHeadersVisible = false;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.Programmatic;
dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.Programmatic;
dataGridView1.Columns[2].SortMode = DataGridViewColumnSortMode.Programmatic;
dataGridView1.Rows.Add(ds.Tables[0].Rows.Count);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{ dataGridView1.Rows[i].Cells["user_id"].Value = ds.Tables[0].Rows[i]["user_id"];
dataGridView1.Rows[i].Cells["user_name"].Value = ds.Tables[0].Rows[i]["user_name"];
}
}
示例11: comboBox2_SelectedIndexChanged
//--selected index change exant for the test name combobox-->
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
DataRowView dr=(DataRowView)comboBox2.SelectedItem;
test_code=Convert.ToString(dr["test_code"]);
dataGridView1.Columns.Clear();
DataGridViewCheckBoxColumn ob1 = new DataGridViewCheckBoxColumn();
dataGridView1.Columns.Add("sub_code", "SUBJECT CODE");
dataGridView1.Columns.Add("sub_name", "SUBJECT NAME");
dataGridView1.Columns.Add(ob1);
dataGridView1.Columns[2].HeaderText = "QUESTION PRESENT";
dataGridView1.Columns[2].Name = "is_present";
dataGridView1.RowHeadersVisible = false;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.Programmatic;
dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.Programmatic;
dataGridView1.Columns[2].ReadOnly = true;
s = "select sub_code,sub_name from subject_master where exam_code='" + exam_code + "'";
DataSet ds = ob.fill_data_set(s);
dataGridView1.Rows.Add(ds.Tables[0].Rows.Count);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{ dataGridView1.Rows[i].Cells["sub_code"].Value = ds.Tables[0].Rows[i]["sub_code"];
dataGridView1.Rows[i].Cells["sub_name"].Value = ds.Tables[0].Rows[i]["sub_name"];
s = null;
s = "select iif ( count(*),1,0) from questions_master where exam_code='" + exam_code + "' and test_code='" + test_code + "' and sub_code='" + Convert.ToString(ds.Tables[0].Rows[i]["sub_code"]) + "';";
dataGridView1.Rows[i].Cells["is_present"].Value = Convert.ToInt32(ob.execute_scalar(s));
}
}
示例12: NewSportsFestivalGUI
internal NewSportsFestivalGUI(NewSportsFestivalController controller)
{
InitializeComponent();
this.StyleManager = metroStyleManager;
DataGridViewCheckBoxColumn checkboxColumn = new DataGridViewCheckBoxColumn();
checkboxColumn.HeaderText = "";
checkboxColumn.Name = competitionGridColumn0Name;
checkboxColumn.Width = 50;
DataGridViewTextBoxColumn competitionIdColumn = new DataGridViewTextBoxColumn();
competitionIdColumn.HeaderText = "Wettkampf-ID";
competitionIdColumn.Name = competitionGridColumn1Name;
competitionIdColumn.Visible = false;
DataGridViewTextBoxColumn competitionNameColumn = new DataGridViewTextBoxColumn();
competitionNameColumn.HeaderText = "Wettkampf";
competitionNameColumn.Name = competitionGridColumn2Name;
competitionNameColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
competitionNameColumn.ReadOnly = true;
competitionGrid.Columns.Add(checkboxColumn);
competitionGrid.Columns.Add(competitionIdColumn);
competitionGrid.Columns.Add(competitionNameColumn);
}
示例13: LoadListaVariaveis
public void LoadListaVariaveis(List<MaquinaInequacoesServiceReference.Variavel> variaveis)
{
dataGridView3.AutoGenerateColumns = false;
dataGridView3.DataSource = variaveis;
DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
chk.HeaderText = "X";
chk.Name = "chkVariaveis";
dataGridView3.Columns.Add(chk);
//dataGridView3.Columns.Add(CreateComboBoxOrdem());
DataGridViewColumn column = new DataGridViewTextBoxColumn();
column.DataPropertyName = "Nome";
column.Name = "Variavel";
dataGridView3.Columns.Add(column);
/*
DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();
cmb.HeaderText = "Ordem";
cmb.Name = "cmbOrdem";
cmb.MaxDropDownItems = 100;
for (int i = 0; i < 100; i++)
{
cmb.Items.Add(i);
}
dataGridView3.Columns.Add(cmb);
foreach (DataGridViewRow row in dataGridView3.Rows)
{
row.Cells[chk.Name].Value = false;
//(row.Cells[cmb.Name] as DataGridViewComboBoxCell).Value = 0;
}
*/
}
示例14: GestionPersonalBuscar
private DataSet numProvincia; // usado en funcion TComboBoxCiudades_Click
#endregion Fields
#region Constructors
public GestionPersonalBuscar()
{
InitializeComponent();
DataGridViewButtonColumn buttons = new DataGridViewButtonColumn();
{
buttons.HeaderText = "Editar"; //texto de la columna
buttons.Text = "Editar"; //texto de cada boton, sale al introducir texto
buttons.UseColumnTextForButtonValue = true;
buttons.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
buttons.FlatStyle = FlatStyle.Standard;
buttons.CellTemplate.Style.BackColor = Color.Honeydew;
buttons.DisplayIndex = 0;
}
DataGridViewCheckBoxColumn boton = new DataGridViewCheckBoxColumn();
{
boton.HeaderText = "Eliminar";//texto de la columna
boton.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; //tamaño
boton.DisplayIndex = 0; //indice que ocupara en la tabla
}
TDataGridViewPersonal.Columns.Add(boton);
TDataGridViewPersonal.Columns.Add(buttons);
}
示例15: AddCols
public void AddCols()
{
DgWorkers.AutoGenerateColumns = false;
var col1 = new DataGridViewTextBoxColumn();
var col2 = new DataGridViewTextBoxColumn();
var col3 = new DataGridViewTextBoxColumn();
var col4 = new DataGridViewCheckBoxColumn();
col1.HeaderText = "מספר עובד";
col1.DataPropertyName = "ID";
col1.Name = "WorkerNumber";
DgWorkers.Columns.Add(col1);
col2.HeaderText = "שם פרטי";
col2.DataPropertyName = "FirstName";
col2.Name = "FirstName";
DgWorkers.Columns.Add(col2);
col3.HeaderText = "שם משפחה";
col3.DataPropertyName = "LastName";
col3.Name = "LastName";
DgWorkers.Columns.Add(col3);
col4.HeaderText = "פעיל";
col4.DataPropertyName = "Active";
col4.Name = "Active";
DgWorkers.Columns.Add(col4);
}