We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SuspendLayout / ResumeLayout WinForms Designer Support

I was wondering if anyone knows the trick to having the Windows Forms Designer know that a control supports SuspendLayout/ResumeLayout in its InitializeComponents() method. Is there some attribute to use, or an interface to implement? I apologize for this being slightly off-topic, but I can''t find this information anywhere. Thanks, -Roy

2 Replies

RM Roy Muller December 10, 2004 12:29 PM UTC

I''ll try this question in the Windows Forms Forum.

DJ Daniel Jebaraj Syncfusion Team December 15, 2004 12:31 PM UTC

Hi Roy, Looking at the code (in Reflector) for the ControlCodeDomSerializer class, it appears that these calls get added in only when the control being serialized has child controls. If you wish to add them in for any other reason, you can derive from CodeDomSerializer to implement a CustomCodeDomSerialzer. This MSDN article has a sample and related information: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/custcodegen.asp
// code from ControlCodeDomSerializer 
  if (this.HasSitedNonReadonlyChildren((Control) value))
                  this.SerializeSuspendResume(manager, (CodeStatementCollection) obj1, value, "SuspendLayout");
                  this.SerializeSuspendResume(manager, (CodeStatementCollection) obj1, value, "ResumeLayout");
Best regards, Daniel

Live Chat Icon For mobile
Up arrow icon