Finally got the custom designer working after reading this March's MSDN magazine article. now I can host the desinger surface, have the CodeCompileUnit generated from the CodeDomDesignerLoader and DesignSurface, and load the generated assembly correctly, but ONLY when there is no resource (like a background image) assigned for any of the controls on the DesignSurface. I can not figure out how to capture the serialized resource from the CodeDomDesignerLoader.
Included is the generated CS code, Look at the highlighted line below, the reference to the resource is generated, but how can I get the resources, so I can save it in a file, along with the generated CS file?
Thanks!
public class TestDashboard : System.Windows.Forms.UserControl
{
private System.Windows.Forms.Button button1;
public TestDashboard()
{
this.InitializeComponent();
}
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TestDashboard));
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button1.BackgroundImage")));
this.button1.Location = new System.Drawing.Point(24, 62);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(396, 214);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
//
// TestDashboard
//
this.Controls.Add(this.button1);
this.Name = "TestDashboard";
this.Size = new System.Drawing.Size(456, 324);
this.ResumeLayout(false);
}
}
nb