Settings Dialog

  • Thread starter Thread starter jdecock
  • Start date Start date
J

jdecock

I'm fairly new to winforms and I'm having a hard time creating a
settings dialog. I'd like to have a list on the left side of the
dialog and show a different set of controls on the left based on what
is selected in the list. Kinda like this, if you're having a hard time
visualizing it:

http://img85.imageshack.us/my.php?image=settings7no.gif

I'm not sure what would be the best way to handle the right side of the
screen and I can't even come up with the proper terms to search with in
Google. My first thought would be to do a tabbed container with one
tab for each option in the list and then hide the tabs. The only
problem with that is I can't figure out how to hide the tabs.

Is this the best way to handle something like this? If not, any
suggestions on a better way to do it? If so, how do I go about hiding
the tabs. Thanks.
 
I'm fairly new to winforms and I'm having a hard time creating a
settings dialog. I'd like to have a list on the left side of the
dialog and show a different set of controls on the left based on what
is selected in the list. Kinda like this, if you're having a hard time
visualizing it:

http://img85.imageshack.us/my.php?image=settings7no.gif

I'm not sure what would be the best way to handle the right side of the
screen and I can't even come up with the proper terms to search with in
Google. My first thought would be to do a tabbed container with one
tab for each option in the list and then hide the tabs. The only
problem with that is I can't figure out how to hide the tabs.

Is this the best way to handle something like this? If not, any
suggestions on a better way to do it? If so, how do I go about hiding
the tabs. Thanks.
Try putting the different controls into a groupbox or panel control and
then hiding/showing different panels depending on what is selected in
the grid.

HTH
JB
 
John said:
Try putting the different controls into a groupbox or panel control and
then hiding/showing different panels depending on what is selected in
the grid.

Is there any way that I can design the different forms in different
places instead of trying to design them on top of each other? It gets
confusing trying to edit all the different forms when they're all
stacked.
 
Is there any way that I can design the different forms in different
places instead of trying to design them on top of each other? It gets
confusing trying to edit all the different forms when they're all
stacked.
You could create usercontrols and then use the usercontrols instead of
the panel/groupbox's.
I would not really recommend this though as it sounds like more work
than its worth.
You know you can bring to front and send to back as necessary.

JB
 
Is there any way that I can design the different forms in different
places instead of trying to design them on top of each other? It gets
confusing trying to edit all the different forms when they're all
stacked.

Hi Guys,

You can design each panel in a seperate form, if you want, then do a bit o'
trickery to get the form to appear within the settings dialog. Let's
assume in your settings dialog, you have a panel control
called 'viewPanel'.

///
private Form _currentView;
public void SetView ( Form newView )
{
if ( _currentView != null )
{
viewPanel.Controls.Remove( _currentView );

_currentView.Close();
_currentView.Dispose();
}

_currentView = newView;

if ( newView == null )
return;

_currentView.TopLevel = false;
_currentView.Location = new Point( 0, 0 );
_currentView.Size = viewPanel.Size;
_currentView.FormBorderStyle = FormBorderStyle.None;
viewPanel.Controls.Add( _currentView );
_currentView.Visible = true;
}
///

Now, when you need to change the view, just call SetView(...) passing an
instance to a form, that is the view for that particular section.

Note: this probably isn't an optimal solution, but it's a start. It could
totally be optimised by caching and initialising the views beforehand, and
simply selecting them from a dictionary when required... but you get the
idea.
 
Design each set of controls on a separate UserControl and then show/hide (or
add/remove) these as necessary in your settings dialog.

/claes
 
Back
Top