简体   繁体   中英

C# WinForms - How to create a Properties Page like Visual Studio Project Properties

I'm trying to create a form that operates like the Visual Studio Properties page, with a list of categories (like Application, Build, Build Events etc) in a column on the left and corresponding information on the right. I'm planning to use either panels or a tabcontrol (with the tab header hidden) for the right hand side.

However, I'm unsure how best to create the column of categories on the left. Is there a standard control that provides this functionality? Otherwise, I considered using a panel containing Buttons, or individual Panels, or a ListBox, but I don't think these would give the same look. Also, I don't want to write code if a suitable control already exists.

Ideally I would like to be able to easily disable all the categories, for example while editing a record on one page.

Having nested categories might be nice, but is not essential.

If the information on the right is not related to one another as you switch categories on the left, to create a good separation between categories I'd suggest you do the following:

  • Create a user control for each individual category
  • Split your form in two, the bar on the left and a panel on the right
  • The bar on the left, for the categories, can be a list of radio buttons, or links, or whatever you like. I'd suggest a TreeView since it easily support sub-categories.
  • As the user click on a category (by attaching a method to the corresponding even on the control used for the categories) you can remove the control from the panel, if any, and reset the control that corresponds to the selected category.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM