title: Extended DataGridView does not apply changes
body: <p>I extended a <code>DataGridView</code> but unfortunately, after using a template from Toolbox, it generates default parameters for me. It looks like it overrides my settings. What im doing wrong here?</p>
  
  <pre><code>class CustomDataGrid2 : DataGridView
  {
      public CustomDataGrid2() : base()
      {
          base.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
          base.ColumnHeadersHeight = 23;
          System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
          base.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
          base.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
          dataGridViewCellStyle1.Alignment = DataGridViewContentAlignment.MiddleLeft;
          dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.ControlDark;
          dataGridViewCellStyle1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
          dataGridViewCellStyle1.ForeColor = System.Drawing.Color.White;
          dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
          dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
          dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
          base.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
  
          base.EnableHeadersVisualStyles = false;
          base.Location = new System.Drawing.Point(112, 186);
          base.RowHeadersVisible = false;
          base.Size = new System.Drawing.Size(401, 150);
      }
  }
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>// 
  // customDataGrid21
  // 
  this.customDataGrid21.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
  this.customDataGrid21.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
  dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.ControlDark;
  dataGridViewCellStyle1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  dataGridViewCellStyle1.ForeColor = System.Drawing.Color.White;
  dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  this.customDataGrid21.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
  this.customDataGrid21.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  this.customDataGrid21.EnableHeadersVisualStyles = false;
  this.customDataGrid21.Location = new System.Drawing.Point(60, 138);
  this.customDataGrid21.Name = "customDataGrid1";
  this.customDataGrid21.RowHeadersVisible = false;
  this.customDataGrid21.Size = new System.Drawing.Size(401, 150);
  this.customDataGrid21.TabIndex = 3;
  </code></pre>
  
  <p>As you can see I set <code>DataGridViewColumnHeadersHeightSizeMode.DisableResizing</code> but it generated <code>AutoSize</code></p>
  
  <p>I also tried:<br></p>
  
  <pre><code>class CustomDataGrid4 : DataGridView
  {
      public CustomDataGrid4() : base()
      {
      }
  
      protected override void OnLayout(LayoutEventArgs e)
      {
          base.OnLayout(e);
  
          base.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
          base.ColumnHeadersHeight = 23;
  
      }
  }
  </code></pre>
  
  <p>Result:<br></p>
  
  <pre><code>// 
  // customDataGrid41
  // 
  this.customDataGrid41.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  this.customDataGrid41.Location = new System.Drawing.Point(96, 152);
  this.customDataGrid41.Name = "customDataGrid41";
  this.customDataGrid41.Size = new System.Drawing.Size(240, 150);
  this.customDataGrid41.TabIndex = 3;
  </code></pre>
  
  <p><br></p>
  
  <p>Solution:<br></p>
  
  <pre><code>class CustomDataGrid6 : DataGridView
  {
      private DataGridViewColumnHeadersHeightSizeMode m_ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
      private int m_columnHeadersHeight = 23;
  
      public new DataGridViewColumnHeadersHeightSizeMode ColumnHeadersHeightSizeMode
      {
          get =&gt; this.m_ColumnHeadersHeightSizeMode;
          set
          {
              this.m_ColumnHeadersHeightSizeMode = value;
              base.ColumnHeadersHeightSizeMode = this.m_ColumnHeadersHeightSizeMode;
          }
      }
  
      public int ColumnHeadersHeight
      {
          get =&gt; this.m_columnHeadersHeight;
          set
          {
              this.m_columnHeadersHeight = value;
              base.ColumnHeadersHeight = this.m_columnHeadersHeight;
          }
      }
  }
  </code></pre>