Options Form

hey ppl. i was wondering how to design an options form, for example the visual studio options form have a treeview docked to left, and when u select an option the content of the right panel changes, i think each treeviewItem useits own panel and when u select the threeveiw the panel changes, but this is very hard at design time, becasue if u have many options u need many panels, and i just want to know how usually the options forms are made becase its hard to set panels position and size when u work with many of them :P

mig16


Answer this question

Options Form

  • Greg E

    You could create each option view as a separate UserControl. That would allow you to edit them easily in the designer.
  • jdonald

     boban.s wrote:
    if (_control.GetType().ToString() == typeof(GroupBox).ToString())


    Boban, thanks for you helpfull reply, just a little note. You don't have to compare the Type names, you can just compare the type object:


    if( control.GetType() == typeof( GroupBox ) )
     


    Or even clearer:


    if( control is GroupBox )
     



  • Keith Chapman

    hi,

    Is your problem solved

    Thank you,
    Bhanu.



  • acido

    I have simular Options Form like MS but with pictures for every item. I have for every item a groupbox and only one of groupboxes is visable in runtime. I have method for hiding all groupboxes and a method for showing groupbox with groupbox name parameter to search for it. Location for groupboxess in design is diferent for all of them so in design i see all groupboxes headers. But in Runtime when i find the groupbox that should be visible i set the location equal to the groupbox that in design mode is in right location.

    private void HideAllGroupControls()

    {

    foreach (Control _control in this.Controls)

    {

    if (_control.GetType().ToString() == typeof(GroupBox).ToString())

    {

    _control.SuspendLayout();

    _control.Location = this.groupCommon.Location;

    _control.Visible = false;

    _control.Enabled = false;

    _control.ResumeLayout(false);

    }

    }

    }

    private void ShowGroupBox(string groupBoxName)

    {

    foreach (Control _control in this.Controls)

    {

    if (_control.GetType().ToString() == typeof(GroupBox).ToString())

    {

    if (_control.Name == groupBoxName)

    {

    this.SuspendLayout();

    _control.Visible = true;

    _control.Enabled = true;

    this.ResumeLayout(false);

    }

    }

    }

    }

    private void treeViewSettings_AfterSelect(object sender, TreeViewEventArgs e)

    {

    this.SuspendLayout();

    this.HideAllGroupControls();

    if (e.Node.Tag != null && e.Node.Tag.ToString().Length != 0)

    {

    this.ShowGroupBox(e.Node.Tag.ToString());

    }

    this.ResumeLayout();

    }

    I use Tag property of Treeview Item to store groupbox name that is related to that item.



  • C. Madsen

    You create all the pages as separated UserControls, so you can easy design them and your code won't be a mess.
    Now you add een TreeView control to your form and items to it as needed. Now when a user click and item in the TreeView, you just make the related page (UserControl) visable.

    This isn't to hard. But there is no out-of-box control or component for this.


  • Options Form