本文整理汇总了C#中System.Windows.Forms.DataGridViewCheckBoxColumn类的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewCheckBoxColumn类的具体用法?C# DataGridViewCheckBoxColumn怎么用?C# DataGridViewCheckBoxColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataGridViewCheckBoxColumn类属于System.Windows.Forms命名空间,在下文中一共展示了DataGridViewCheckBoxColumn类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:demty,项目名称:bd_company,代码行数:26,代码来源:SquadForm.cs
示例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;
}
开发者ID:LancelotOrz,项目名称:RequirementManagementSystem,代码行数:27,代码来源:OthersForm.cs
示例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);
}
开发者ID:antonianemi,项目名称:FULL,代码行数:30,代码来源:FrmInscripcion.cs
示例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;
}
}
开发者ID:ccantero,项目名称:gdatos_EnerLand,代码行数:60,代码来源:RegistrarAgendaForm.cs
示例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;
}
开发者ID:ergoe,项目名称:MusicWizard,代码行数:26,代码来源:Form1.cs
示例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;
}
开发者ID:efavry,项目名称:DirtyThingsRemover,代码行数:30,代码来源:DtrForm.cs
示例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);
}
开发者ID:angelguit,项目名称:dpaa-alquilercoches,代码行数:38,代码来源:BuscarPedidos.cs
示例8: CheckboxColumn
private DataGridViewCheckBoxColumn CheckboxColumn(string columnName, string headerText)
{
DataGridViewCheckBoxColumn comboColumn = new DataGridViewCheckBoxColumn();
comboColumn.Name = columnName;
comboColumn.HeaderText = headerText;
return comboColumn;
}
开发者ID:nateo,项目名称:BeanCounter,代码行数:7,代码来源:FrmMerchants.cs
示例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;
}
开发者ID:rrromano,项目名称:BSP,代码行数:25,代码来源:FuncionesGenerales.cs
示例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"];
}
}
开发者ID:souparno,项目名称:EducationMediasoftwares,代码行数:29,代码来源:frm_SelectStudent.cs
示例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));
}
}
开发者ID:souparno,项目名称:EducationMediasoftwares,代码行数:35,代码来源:frm_QuestionAddEdit.cs
示例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);
}
开发者ID:julianhendricks,项目名称:BKTMProjektSportfest,代码行数:26,代码来源:NewSportsFestivalGUI.cs
示例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;
}
*/
}
开发者ID:jonimoreira,项目名称:TestTFS,代码行数:34,代码来源:SimulacaoValidacaoLimitesVisoes.cs
示例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);
}
开发者ID:angelguit,项目名称:dpaa-alquilercoches,代码行数:31,代码来源:GestionPersonalBuscar.cs
示例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);
}
开发者ID:roi811,项目名称:Clinic1-1,代码行数:28,代码来源:F_Workers.cs
示例16: adviserForm_Load
//onload fill datagrid
private void adviserForm_Load(object sender, EventArgs e)
{
DataGridViewColumn column = new DataGridViewTextBoxColumn();
// Initialize and add a check box column.
column = new DataGridViewImageColumn();
// column.Image
column.DataPropertyName = "pictureArrByte";
column.Width = 80;
column.Name = "picture";
column.ReadOnly = false;
dataGridView.Columns.Add(column);
column = new DataGridViewTextBoxColumn();
column.DataPropertyName = "playerId";
column.Name = "Id";
dataGridView.Columns.Add(column);
column = new DataGridViewTextBoxColumn();
column.DataPropertyName = "firstName";
column.Name = "First Name";
dataGridView.Columns.Add(column);
column = new DataGridViewTextBoxColumn();
column.DataPropertyName = "lastName";
column.Name = "Last Name";
dataGridView.Columns.Add(column);
// Initialize and add a check box column.
DataGridViewCheckBoxColumn columnCheckBox = new DataGridViewCheckBoxColumn();
columnCheckBox.DataPropertyName = "Action";
columnCheckBox.Name = "Action";
columnCheckBox.ReadOnly = false;
dataGridView.Columns.Add(columnCheckBox);
//Fill data to form
Players[] list = server.getAdvisors(playerId);
dataGridView.AutoGenerateColumns = false;
dataGridView.AutoSize = false;
foreach (Players player in list)
{
if (player.pictureArrByte != null)
{
Rectangle compressionRectangle = new Rectangle(60, 60,
player.pictureArrByte.Width / 2, player.pictureArrByte.Height / 2);
using (Graphics g = Graphics.FromImage(player.pictureArrByte))
g.DrawImage(player.pictureArrByte, compressionRectangle);
}
}
dataGridView.DataSource = list;
//set the heigt for picture colum
foreach (DataGridViewRow row in dataGridView.Rows)
{
row.Height = 75;
}
}
开发者ID:MatanShulman,项目名称:TiacTacToe,代码行数:61,代码来源:adviserForm.cs
示例17: CheckedListBox
/*
public CheckedListBox ()
{
colString = new NSString("CheckedListBox");
}
*/
public override void SetupColumn ()
{
column = new DataGridViewCheckBoxColumn(colString);
column.DataCell.Editable = false;
tableView.AddColumn(column);
}
开发者ID:Clancey,项目名称:MonoMac.Windows.Form,代码行数:14,代码来源:CheckedListBox.cocoa.cs
示例18: SetupDataGridViewColumns
private void SetupDataGridViewColumns()
{
using (var col = new DataGridViewTextBoxColumn())
{
col.DataPropertyName = "Name";
col.HeaderText = "Name";
dgvNameEntries.Columns.Add(col);
col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
using (var col = new DataGridViewComboBoxColumn())
{
col.DataPropertyName = "NamePosition";
col.HeaderText = "Name Position";
col.DataSource = Enum.GetValues(typeof(NamePosition));
col.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
dgvNameEntries.Columns.Add(col);
}
using (var col = new DataGridViewCheckBoxColumn())
{
col.DataPropertyName = "IsFemale";
col.HeaderText = "Is Female";
col.FalseValue = false;
col.TrueValue = true;
col.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;
dgvNameEntries.Columns.Add(col);
}
}
开发者ID:EterniaLogic,项目名称:Pulsar4x,代码行数:27,代码来源:CommanderNameThemesDialog.cs
示例19: CreateColumn
public static DataGridViewColumn CreateColumn( DataGridViewColumnType columnType, String columnName, String columnText)
{
DataGridViewColumn col = null;
switch (columnType)
{
case DataGridViewColumnType.MULTICOMBOBOX:
col = new DataGridViewMultiColumnComboBoxColumn();
break;
case DataGridViewColumnType.COMBOBOX:
col = new DataGridViewComboBoxColumn();
break;
case DataGridViewColumnType.TIME:
col = new DataGridViewTimeColumn();
break;
case DataGridViewColumnType.DATE:
col = new DataGridViewDateTimeColumn();
break;
case DataGridViewColumnType.CHECKBOX:
col = new DataGridViewCheckBoxColumn();
break;
case DataGridViewColumnType.NUMBER:
default:
col = new DataGridViewTextBoxColumn();
break;
}
col.DataPropertyName = columnName;
col.Name = columnName;
col.HeaderText = columnText;
return col;
}
开发者ID:anthanhcong,项目名称:atc-demand-instruction-form,代码行数:30,代码来源:DataGridViewHelper.cs
示例20: CreateCell
private void CreateCell(string[] rows, string[] columns)
{
DataGridViewColumnCollection matrixColumns = matrixDataGridView.Columns;
matrixColumns.Add("nullColumn", "Traceability Matrix");
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;
matrixColumns.Add(checkColumn);
}
DataGridViewRowCollection matrixRows = matrixDataGridView.Rows;
for (int i = 0; i < rows.Length; i++)
{
matrixRows.Add(rows[i]);
}
matrixDataGridView.Columns[0].Frozen = true;
matrixDataGridView.Columns[0].ReadOnly = true;
bool flag = false;
for (int i = 0; i < rows.Length; i++)
{
for (int j = 0; j < columns.Length; j++)
{
DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)matrixDataGridView.Rows[i].Cells[1 + j];
chk.Selected = flag;
flag = !flag;
}
}
}
开发者ID:LancelotOrz,项目名称:RequirementManagementSystem,代码行数:33,代码来源:TraceabilityMatrixForm.cs
注:本文中的System.Windows.Forms.DataGridViewCheckBoxColumn类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论