开发者

Creating Options Menu with overlapping panels

I'm trying to create an options menu in a C# forms project, and I'm curious if there's a less ugly way to do this. I have a ListBox that has the different categories of options, and when you select a category, the options for that category appear in a panel on the right. Basically, something identical to the options menu in Visual Studio itself.

Obviously, different controls have to use the same real estate here, as every category has different options which need to be displayed in t开发者_JAVA百科he same area of my form. So when you select a category, the controls for every other category must become hidden.

I'm currently using a different Panel object for each category (13 currently), but designing each panel is a headache because i need to drag the other 12 panels out of the way each time I need to alter one. Is there a better way to do this? I'm open to any suggestions, whether its a complete change in the implementation, or even just a Visual Studio tip for working with 1 of 13 panels that all overlap.

If all else fails I could use a TabControl rendered horizontally, but I don't like how that looks.

Thanks in advance.


I can think of three alternate approaches:

  1. (Ok) Use a tab control that doesn't display the headers for the user.
  2. (Better) Create user controls for each option page, so you have different designer files for each.
  3. (Better yet?) Dynamically generate the UI based on some descriptive information, so there are no designer files to deal with at all.


Take a look at the UserControl class. You can design on it with the Forms Designer, than programatically place it to the right of your ListBox when items are selected. Create a different UserControl for each category of options that you have.


First you should know when you are in Design Mode that there is a drop down menu from the Properties Windows (View->Prpoerties Menu), that allows you to select a control. So you don't need to move other controls out of the way encesarily.

Second, I would make the options panel for each category it's own user or custom control. This way you can edit the panel itself seperately. Then you have the option of showing/hiding that custom control when it's category is selected, or even dynamically creating the control.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜