471,330 Members | 1,150 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

Design Time serialization

Ron
I have a custom control which has a custom designer. When I Enter the
control I am able to loop through all of the controls on the ParentForm and
set their TabIndex property from the designer. If I loop back through the
controls I see that their property is in fact reporting the correct
TabIndex(that I set from the designer)...However when I view the Forms
InitializeComponent code the TabIndex property still reports the original
value.

Is there anyway to force the controls to update the InitializeComponent code
for the Controls through a CustomDesigner by looping through the controls on
a given form?

internal class CustomTextboxDesigner : ControlDesigner
{
Form2 frm = new Form2();

public override void Initialize(IComponent comp)
{
base.Initialize(comp);
}

protected override void OnMouseEnter()
{
frm.Show();
Form parent = this.Control.Parent.FindForm();
int idx = 100;
foreach (Control ctrl in parent.Controls)
{
ctrl.TabIndex = idx;
idx++;
ctrl.Text = idx.ToString();
}
foreach (Control ctrl in parent.Controls)
{
frm.RTB.Text += ctrl.Name + " " + ctrl.TabIndex.ToString();
}
}

public override bool
CanBeParentedTo(System.ComponentModel.Design.IDesi gner parentDesigner)
{
return false;
}
}
}

the above code works but never serializes the values back to the form's
designer code.

Aug 15 '08 #1
0 796

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by malcolm | last post: by
2 posts views Thread by WebWacker | last post: by
1 post views Thread by danielhardman | last post: by
reply views Thread by Edward Diener | last post: by
reply views Thread by AP Farszha | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.