We have developed our own custom designer. We have a custom control that
uses this designer. We have everything working, except.........
How do we get the IDE to recognize a drag and drop from the toolbox such
that it generates code to add the control to the container's controls
collection?
Fo example, if I add a tabcontrol to a form, add 2 tabpages to it and then
drag a textbox onto the first tabpage, I see the following generated code:
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.TabControl1 = New System.Windows.Forms.TabControl
Me.TabPage1 = New System.Windows.Forms.TabPage
Me.TabPage2 = New System.Windows.Forms.TabPage
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TabControl1.SuspendLayout()
Me.TabPage1.SuspendLayout()
Me.SuspendLayout()
'
'TabControl1
'
Me.TabControl1.Controls.Add(Me.TabPage1)
Me.TabControl1.Controls.Add(Me.TabPage2)
Me.TabControl1.Location = New System.Drawing.Point(72, 104)
Me.TabControl1.Name = "TabControl1"
Me.TabControl1.SelectedIndex = 0
Me.TabControl1.TabIndex = 0
'
'TabPage1
'
Me.TabPage1.Controls.Add(Me.TextBox1)
Me.TabPage1.Location = New System.Drawing.Point(4, 22)
Me.TabPage1.Name = "TabPage1"
Me.TabPage1.Size = New System.Drawing.Size(192, 74)
Me.TabPage1.TabIndex = 0
Me.TabPage1.Text = "TabPage1"
'
'TabPage2
'
Me.TabPage2.Location = New System.Drawing.Point(4, 22)
Me.TabPage2.Name = "TabPage2"
Me.TabPage2.Size = New System.Drawing.Size(192, 74)
Me.TabPage2.TabIndex = 1
Me.TabPage2.Text = "TabPage2"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(56, 24)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = "TextBox1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.TabControl1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.TabControl1.ResumeLayout(False)
Me.TabPage1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
What in the designer generated this
Me.TabPage1.Controls.Add(Me.TextBox1)
code?
Greg Robinson
Custom Data Systems, Inc.
www.cds-am.net
joeycalisay - 13 Apr 2005 01:52 GMT
Do you mean you have created your own forms designer? All those code gens
are created by ControlCodeDomSerializer which is default used by controls,
including forms.

Signature
Joey Calisay
http://spaces.msn.com/members/joeycalisay/
> We have developed our own custom designer. We have a custom control that
> uses this designer. We have everything working, except.........
[quoted text clipped - 125 lines]
>
> www.cds-am.net
Mujdat Dinc - 19 Apr 2005 12:02 GMT
Hi,
To do this derive your control from parentcontrol designer.
ParentControlDesigner receives dropdown message it selfs and and
Deserialize toolbox item from Drop Message And calls Toolboxitem
createcomponentscore function and then adds the return components to its
controls array then during serialization Controls propery has
SerializationVisibilty attriibute "Content" then renders the control as you
want to. Or make your designer recieve the drag & message and make these by
your self..
> We have developed our own custom designer. We have a custom control that
> uses this designer. We have everything working, except.........
[quoted text clipped - 125 lines]
>
> www.cds-am.net