.NET

.NET

Reply
Valued Contributor
70 Posts
1 Kudo
Registered: ‎02-03-2012
Post 1 of 5

Expand/collapse custom palette's group - how?

525 Views, 4 Replies
11-28-2012 07:26 AM

Hello!

 

I'm writing code that able user to show my custom palette.

Everything is working fine, but ... I want to make some of my groupbox to be expandable/collapsible, like here (3D visualization):

http://through-the-interface.typepad.com/.a/6a00d83452464869e20112796dc86628a4-pi

 

I think that using groupbox control is bad idea, so how can I make some container with my controls (label and textbox) and make this container expandable/collapsible?

 

Thanks.

 

Mentor
225 Posts
24 Kudos
Registered: ‎09-15-2011
Post 2 of 5

Re: Expand/collapse custom palette's group - how?

11-28-2012 08:44 AM in reply to: GrzesiekGP

Hi,

Standard Windows Forms does not have the expand/collapse control, the available GroupBox control is static, not collapsible. WPF has the Expander control that can expand/collapse its panel.

There are many code resources to build a collapsible panel in C# Windows Forms. I found some links (http://visualstudiogallery.msdn.microsoft.com/40b89fc7-80fa-4e95-b707-506084f51d6b, http://jfblier.wordpress.com/2011/02/16/window-form-expander/) are good. You can reuse the user control from this project to add to your custom palette. It's open license so you can modify to meet your need. Another option is to use commercial third-party libraries but they are heavy unnecessary with external reference DLLs. It's better to use lightweight custom user controls.

-Khoa

Valued Contributor
70 Posts
1 Kudo
Registered: ‎02-03-2012
Post 3 of 5

Re: Expand/collapse custom palette's group - how?

11-28-2012 09:04 AM in reply to: khoa.ho

I know that GroupBox is a static Window's control.

 

I didn't know how to name it, so I used "groupbox" and image which shows what I mean - there is lots of this collapsing panel in standard AutoCAD's palettes and I think that under 2007 there wasn't WPF yet.

 

Thanks.

Mentor
225 Posts
24 Kudos
Registered: ‎09-15-2011
Post 4 of 5

Re: Expand/collapse custom palette's group - how?

11-28-2012 09:45 AM in reply to: GrzesiekGP

AutoCAD uses C++ MFC controls in ObjectARX plug-ins to show those collapsible panels in palettes. The used C++ class is CMFCPropertyGridProperty (I guess so). The equivalent control in .NET is PropertyGrid that groups properties in collapsible trees. In Visual Studio Toolbox, look for PropertyGrid and drag it to the user control (that will be placed to the custom palette). The PropertyGrid stores custom properties in group hierarchy, and they can expand/collapse. But it may not allow to add controls like buttons (you can try).

-Khoa

Active Contributor
46 Posts
7 Kudos
Registered: ‎08-12-2008
Post 5 of 5

Re: Expand/collapse custom palette's group - how?

01-11-2015 08:31 PM in reply to: khoa.ho

This one looks pretty good. I haven't used it (yet): https://github.com/alexander-makarov/ExpandCollapsePanel

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!