class SomeGrid : System.Windows.Forms.DataGrid
>> {
>> }
and dragged it from the toolbox onto a form. Here's the generated code:namespace SmartDeviceProject1 >>{ >> partial class Form1 >> { >> /// <summary> >> /// Required designer variable. >> /// </summary> >> private System.ComponentModel.IContainer components = null; >> private System.Windows.Forms.MainMenu mainMenu1; >> >> /// <summary> >> /// Clean up any resources being used. >> /// </summary> >> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> >> protected override void Dispose(bool disposing) >> { >> if (disposing && (components != null)) >> { >> components.Dispose(); >> } >> base.Dispose(disposing); >> } >> >> #region Windows Form Designer generated code >> >> /// <summary> >> /// Required method for Designer support - do not modify >> /// the contents of this method with the code editor. >> /// </summary> >> private void InitializeComponent() >> { >> this.mainMenu1 = new System.Windows.Forms.MainMenu(); >> this.someGrid1 = new SmartDeviceProject1.SomeGrid(); >> ((System.ComponentModel.ISupportInitialize)(this.someGrid1)).BeginInit(); >> this.SuspendLayout(); >> // >> // someGrid1 >> // >> this.someGrid1.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(128))))); >> this.someGrid1.Location = new System.Drawing.Point(28, 41); >> this.someGrid1.Name = "someGrid1"; >> this.someGrid1.Size = new System.Drawing.Size(174, 166); >> this.someGrid1.TabIndex = 1; >> // >> // Form1 >> // >> this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); >> this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; >> this.AutoScroll = true; >> this.ClientSize = new System.Drawing.Size(240, 268); >> this.Controls.Add(this.someGrid1); >> this.Menu = this.mainMenu1; >> this.Name = "Form1"; >> this.Text = "Form1"; >> ((System.ComponentModel.ISupportInitialize)(this.someGrid1)).EndInit(); >> this.ResumeLayout(false); >> >> } >> >> #endregion >> >> private SomeGrid someGrid1; >> } >>}Compiles fine...
class SomeGrid : System.Windows.Forms.DataGrid ,System.ComponentModel.ISupportInitialize { public void BeginInit(){} public void EndInit(){} }Unless something (like another thread) is trying to access the form during initialization (unlikely) this should work fine.