Windows Develop Bookmark and Share   
 index > Windows Forms Designer > CustomControl with SplitContainer crashes VS2008 designer
 

CustomControl with SplitContainer crashes VS2008 designer

Hi. I have a custom control with SplitContainer within. My custom control has own designer where design mode is enabled for SplitContainer:
    [Designer(typeof(TestUserControlDesigner))]
    public partial class TestUserControl : UserControl
    {
        public TestUserControl()
        {
            InitializeComponent();
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public SplitContainer SplitContainer
        {
            get
            {
                return this.splitContainer1;
            }
        }
    }


    public class TestUserControlDesigner : ParentControlDesigner
    {
        public override void Initialize(IComponent component)
        {
            base.Initialize(component);

            TestUserControl testControl = component as TestUserControl;

            EnableDesignMode(testControl.SplitContainer, "SplitContainer");
        }
    }
I dragsome control in Panel1andclick in panel area soadded control to lose focus then Build Solution. Afterthatdesigner doesn't track changes anymore. Need toreopen form designer window to start working again.If control stay focused and soution is build all work fine. Problem exists not just for new added controls. In reopened form change location of some control, click in panel area and rebuild - crash again. But if I click on some other control after changes are made and build all is fine.

Thanks in advance.
firedog067  Sunday, March 29, 2009 4:20 PM
I resolvethe problem. I createtwo properties Panel1 and Panel2in my TestUserControlin order toexpose SplitContainer.Panel1 and SplitContainer.Panel2 properties. Then in designer class enable design mode for all of three properties andabove bug don't exists anymore. Hope this will be helpful forsomeone.
firedog067  Monday, March 30, 2009 3:35 PM
I resolvethe problem. I createtwo properties Panel1 and Panel2in my TestUserControlin order toexpose SplitContainer.Panel1 and SplitContainer.Panel2 properties. Then in designer class enable design mode for all of three properties andabove bug don't exists anymore. Hope this will be helpful forsomeone.
firedog067  Monday, March 30, 2009 3:35 PM

You can use google to search for other answers

Custom Search

More Threads

• Text property in Windows Forms Designer
• Create the Drop-Down List of Controls in a Properties Window like VS
• SplitContainer-Type compound controls
• How to trap keyboard event. like Esc and Delete etc.
• How to design a form on Blend and use it in a VB 2005 project?
• Not able to Override text property of label in derived class
• Cannot access a disposed object.
• How to get current project in design time
• Bulk Update in .NET
• Problem with designer generated code