Joe Mamma Posted July 6, 2005 Posted July 6, 2005 Ok, I am missing something here. . . I have a two components - Basic (a simple component with one string property 'TheString') Composite (a component with one property - a Basic component) when dropped on a form (Basic _basic; Composite _composite), Properties of both components are visible, with the Basic property of Composite rightly depicted as a collapsible property. When I change _basic.TheString using the property editor, the following code is written in the form's InitializeComponent method: this._basic.TheString = "Foobar"; but when I change _Composite.Basic.TheString in the property editor, I expected to see: this._composite.Basic.TheString = "Foobar"; but I didn't. I assume I am missing an attribute, but I cant figure it out. here is my code: basic.cs: using System; using System.ComponentModel; namespace TestComponent { public class Basic : System.ComponentModel.Component { private System.ComponentModel.Container components = null; private string _string; public string TheString { get{ return _string; } set{_string = value;} } public Basic(System.ComponentModel.IContainer container) { container.Add(this); InitializeComponent(); } public Basic() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } private void InitializeComponent() { components = new System.ComponentModel.Container(); } } } composite.cs using System; using System.ComponentModel; namespace TestComponent { public class Composite : System.ComponentModel.Component { private System.ComponentModel.Container components = null; private Basic _basic; public Basic Basic { get {return _basic;} } public Composite(System.ComponentModel.IContainer container) { container.Add(this); InitializeComponent(); _basic = new Basic(components); } public Composite() { InitializeComponent(); _basic = new Basic(components); } protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } private void InitializeComponent() { components = new System.ComponentModel.Container(); } } } Mainform.cs: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace TestComponent { public class Mainform : System.Windows.Forms.Form { private System.ComponentModel.IContainer components; private Basic _basic; private Composite _composite; public Mainform() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this._basic = new TestComponent.Basic(this.components); this._composite = new TestComponent.Composite(this.components); this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(248, 152); this.Name = "Form1"; this.Text = "Form1"; } [sTAThread] static void Main() { Application.Run(new Mainform()); } } } Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
Joe Mamma Posted July 6, 2005 Author Posted July 6, 2005 I found it : DesignerSerializationVisibilityAttribute Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.