For your center area, find a control in the tool box called "Panel" add a
panel for each page you want in there, and put controls on that panel. make
sure they are "children" of that panel. To do that, just click the control
you want to add, and drag a box for it inside of the panel.
Anyways, here is a almost complete example:
using System;
using System.Collections;
using System.Windows.Forms;
namespace YourProject
{
public class PanelData
{
private static Hashtable m_Table = null;
public static void RegisterPanel(Panel panel, Button button)
{
if(m_Table == null)
m_Table = new Hashtable();
m_Table.Add(panel, button);
}
public static void HidePanels()
{
foreach(DictionaryEntry de in m_Table)
{
Panel panel = (Panel) de.Key;
panel.Hide();
}
}
public static void DisplayPanel(Button button)
{
HidePanels();
foreach(DictionaryEntry de in m_Table)
{
Button b = (Button) de.Value;
if(b == button)
{
Panel panel = (Panel) de.Key;
panel.Show();
break;
}
}
}
}
}
Now in your main form:
On form load:
PanelData.RegisterPanel(CustomersButton, CustomersPanel);
PanelData.RegisterPanel(HelpButton, HelpPanel);
//ETC
On a button click do this
PanelData.DisplayPanel(thisButtonNameHere);
"Andre Ranieri" wrote:
Joe,
Thanks immensely for your feedback. I'm fairly new to WinForm user
controls; I hope you'll bear with me while I ask a followup question or two:
Do I understand correctly that I can create one "master" user control (I
assume it woul be blank) which is placed on the form, then six other ones
for the six respective buttons?
In the DoScreenModeChange(); method, roughly how would I go about replacing
the contents of the master control (or whichever is displayed) with the new
one?
Thanks again,
Andre Ranieri