Checkbox on column headercell of datagridview not able to align
I have a datagridview control which contain some columns named
Begin,End,OpenGl,OpenAP in the column header cell.
We are displaying text named Begin ,End on Column header cell but for
OpenGL and OpenAP we are dipalying checkbox not any text.I have done some
following code but it is not working.
objCheckBoxHeaderforOpenGL = new CustomControls.M3CheckBoxColumnHeader();
objCheckBoxHeaderforOpenAP = new
CustomControls.M3CheckBoxColumnHeader();
dgvFiscalPeriods.Columns["gcOpenGL"].HeaderCell =
objCheckBoxHeaderforOpenGL;
dgvFiscalPeriods.Columns["gcOpenAP"].HeaderCell =
objCheckBoxHeaderforOpenAP;
this.dgvFiscalPeriods.Columns["gcOpenGL"].HeaderCell.Style.Alignment
= DataGridViewContentAlignment.TopCenter;
this.dgvFiscalPeriods.Columns["gcOpenAP"].HeaderCell.Style.Alignment
= DataGridViewContentAlignment.TopCenter;
and it is working fine with this following code
this.dgvFiscalPeriods.Columns["gcBegin"].HeaderCell.Style.Alignment =
DataGridViewContentAlignment.TopCenter;
this.dgvFiscalPeriods.Columns["gcEnd"].HeaderCell.Style.Alignment
= DataGridViewContentAlignment.TopCenter;
How can i align any user control in datagrid view?
No comments:
Post a Comment