Hi ,
I have a user control using custom class as property,
Custom Class,
public class myMarginBound : System.Drawing.Printing.Margins
{
public myMarginBound()
{
}
}
User control,
public class UserControl1 : System.Windows.Forms.UserControl
{
....................
public myMarginBound MBound
{
set
{
}
get
{
return new myMarginBound ();
}
}
}
Windows App,
Designer generate
this.userControl11.MBound =
((WindowsControlLibrary1.myMarginBound)(new
System.Drawing.Printing.Margins(100, 100, 100, 100)));
It throw invalidCastException at runtime,
Is it neccecery to write a custom CodeDomSerializer to generate
something like
this.userControl11.MBound = new myMarginBound()
?
Ben
Mark Olbert - 02 May 2006 02:57 GMT
Have you tried creating a TypeConverter for the class, and returning an InstanceDescriptor?
- Mark
Kongchau - 03 May 2006 14:00 GMT
Hi Mark,
It works, thanks a lot.
Ben