A community member has associated this post with a similar question:
Datagridview Formatting issue on loading
Only moderators can edit this content.
Datagridview Formatting issue on loading
I have used the following code on my customdatagridview , but found out that it is not working properly
public partial class Paymentdatagridview : DataGridView
{
public Paymentdatagridview()
{
// i have set enableheadervisualstyles to false
// make bold the headers
// Add the columns to your custom DataGridView
DataGridViewColumn column1 = new DataGridViewTextBoxColumn();
column1.Name = "Column1";
column1.HeaderText = "Particulars";
column1.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
column1.SortMode = DataGridViewColumnSortMode.Automatic;
this.Columns.Add(column1);
DataGridViewColumn column2 = new DataGridViewTextBoxColumn();
column2.Name = "Column2";
column2.HeaderText = "Amount";
column2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
column2.SortMode = DataGridViewColumnSortMode.Programmatic;
this.Columns.Add(column2);
this.AllowUserToAddRows = true;
this.RowHeadersVisible = false;
this.ColumnHeadersDefaultCellStyle.Font = new Font("Tahoma", 9.75F, FontStyle.Bold);
this.CellBorderStyle = DataGridViewCellBorderStyle.None;
InitializeComponent();
}
Above is the image when it is loaded , you can see that first row's color is different although i had tried to set the background color of the datagridview to change according to its parent by using following code
second problem is when i starts editing in it , this white colour eats up the following upcoming rows
another issue is I am trying to set the font to be bold for each cells but it is also not working for 1st row .