Where can Custom Designer catches the Exception of Control
Hi,
I'm developing custom designer like below
http://msdn.microsoft.com/msdnmag/issues/06/03/DesignerHosting/default.aspx
and a custom control.
this custom control has only specific controls as child. the related code is below
[Designer(typeof(CanParentExDesigner))]
public class CanParentEx : Panel
{
protected override void OnControlAdded(ControlEventArgs e)
{
if (!e.Control.GetType().Equals(typeof(Button)))
{
throw new InvalidOperationException(e.Control.Name);
}
else
{
base.OnControlAdded(e);
}
}
}
public class CanParentExDesigner : System.Windows.Forms.Design.ParentControlDesigner
{
public override bool CanParent(Control control)
{
return control.GetType().Equals(typeof(Button));
}
}
If user add another control on the custom control, it will throw Exception.
I want to catch the exception on custom designer. but, I don't know where I have to catch it.
If anybody knows, please let me know.
thanks

