Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6710447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:01:27+00:00 2026-05-26T08:01:27+00:00

I have designed a custom panel which can expand or collapse form at run

  • 0

I have designed a custom panel which can expand or collapse form at run time.
enter image description here

When I change its height from custom designed task, it does not update it.
enter image description here

Code of my control class:

using System;
using System.Windows.Forms;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms.Design;

[Designer(typeof(MyControlDesigner))]
 public partial class ExpandCollapsePanel : UserControl
    {    
        private bool flag = false;
        private Size size;
        public int usrVerticalSize;

        public ExpandCollapsePanel()
        {
            InitializeComponent();

        }       
        [DefaultValueAttribute(true)]
        public int SetVerticalSize
        {
            get
            {
                return usrVerticalSize;
            }
            set
            {
                usrVerticalSize = value;
            }
        }

Code of taskpanedesign class:

namespace ExpandCollapseFormLibrary
{
    class CustomDialogue : ControlDesigner
    {
        private DesignerActionListCollection actionLists;
        public override DesignerActionListCollection ActionLists
        {
            get
            {
                if (actionLists == null)
                {
                    actionLists = new DesignerActionListCollection();
                    actionLists.Add(new MyActionListItem(this));
                }
                return actionLists;
            }
        }
    }
    internal class MyActionListItem : DesignerActionList
    {
        public MyActionListItem(ControlDesigner owner) : base(owner.Component)
        {
        }
        public override DesignerActionItemCollection GetSortedActionItems()
        {
            var items = new DesignerActionItemCollection();
            //items.Add(new DesignerActionTextItem("Hello world", "Misc"));
            items.Add(new DesignerActionPropertyItem("Checked", "Vertical Drop Down Size"));
            return items;
        }

        public int Checked
        {
            get { return ((ExpandCollapsePanel)base.Component).SetVerticalSize; }
            set { ((ExpandCollapsePanel)base.Component).SetVerticalSize = value; }
        }

    }    
}

When I change the value the Form1(where drag and dropped) designed class keep it permanently.
enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:01:27+00:00Added an answer on May 26, 2026 at 8:01 am

    the SetVerticalSize property value of your custom pane’s is really changed, but the problem is that the designer host does not know about it at all. To notify the designer host about your custom pane changing you should implement something like this (I suggest you read the IComponentChangeService MSDN article for more details):

        int usrVerticalSize;
        [DefaultValue(true)]
        public int SetVerticalSize {
            get { return usrVerticalSize; }
            set {
                FireChanging(); //changing notification 
                try {
                    usrVerticalSize = value;
                }
                finally { FireChanged(); } //changed notification 
            }
        }
        void FireChanging() {
            IComponentChangeService service = GetComponentChangeService();
            if(service != null)
                service.OnComponentChanging(this, null);
        }
        void FireChanged() {
            IComponentChangeService service = GetComponentChangeService();
            if(service != null)
                service.OnComponentChanged(this, null, null, null);
        }
        IComponentChangeService GetComponentChangeService() {
            return GetService(typeof(IComponentChangeService)) as IComponentChangeService;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As part of a CMS, I have created a custom VirtualPathProvider which is designed
I have created the custom control which is just a panel that I will
I have designed a custom section handler before but I'm faced with a problem
I have a wpf app that needs to communicate(exchange data) with a custom designed
I have designed this gui in netBeans which has a canvas , a couple
I have designed one sign-up form,in this form after getting all necessary values I
i have a set of web pages specifically designed to run on iPhones (using
I have designed a custom calendar using html and jQuery. I want to highlight
I'm working on the development of a C++ API which uses custom-designed plugins to
I have created a non-visual component in C# which is designed as a placeholder

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.