I am writing an inherited DataGridView
control which by default will have two columns. The DGV lives on a user control GeneralTabPanel
which inherits from MainTabPanel
which inherits from UserControl
. Reason is MainTabPanel
contains a virtual function that every inheriting panel must override.
The problem is whenever I look at the GeneralTabPanel
in the Designer and I hit Build, Visual Studio Express 2013 will generate two columns in the Designer and add them to the DGV.
SuperDataGridView
using System.Windows.Forms;
namespace AnyGameEngineEditor {
public class SuperDataGridView : DataGridView {
public SuperDataGridView () {
this.ColumnCount = 2;
}
}
}
GeneralTabPanel
namespace AnyGameEngineEditor {
public partial class GeneralTabPanel : MainTabPanel {
public GeneralTabPanel () {
InitializeComponent ();
}
}
}
MainTabPanel
using System.Windows.Forms;
namespace AnyGameEngineEditor {
public partial class MainTabPanel : UserControl {
public MainTabPanel () {
InitializeComponent ();
this.Dock = DockStyle.Fill;
}
}
}
This is as barebones as I can get to reproducing the issue on my machine with VS2013 Express. This is how to reproduce (I have not actually tested this on another machine):
- Make a new Windows Forms project.
- Copy these three files into the root folder.
- Open up
GeneralTabPanel
in the designer. - Open up the Designer .cs file for
GeneralTabPanel
. - Build the project.
- There should be two new
DataGridViewTextBoxCell
variables at the bottom of the .cs file. - Save the project and rebuild, two more variables should now be at the bottom.
- Repeat 5-7 until you're convinced something funny is going on.
What I found out is that if I comment out the Dock
line in MainTabPanel
, this doesn't occur.
So ultimately my question is why in the world is this happening?