473,386 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

best way to proceed on Windows.Forms user interface?

Hello everyone,

I'm wondering if I could get some advice on the best way to build the user
interface depicted in this diagram:
http://www.senske.com/images/winforms_layout.jpg

The gray areas will be static throughout. However, I'd like the blue area
to change to a different interface depending on which of the buttons at left
is pressed. Should I design the interface for each of the buttons as a
separate custom user control, then swap the controls in and out depending on
which button is pressed?

Or, am I going about it entirely wrong and there's a better approach?

Thanks in advance for any insight.

Andre Ranieri

Mar 31 '06 #1
6 2185
Joe
Hello,

I would create a user control with a property like this:
enum ScreenMode {ContractInfo, Details, Leads, Services, AccountingAdj,
AccountingDefaults};

public ScreenMode ScreenMode
{
get
{
return // you current mode. probably stored in a variable
}
set
{
variable = value;
DoScreenModeChange();
}
}

Create a user control for each of the 6 screens you would need and just
switch them in the DoScreenModeChange() method.

HTH
-Joe
"Andre Ranieri" <An**********@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com...
Hello everyone,

I'm wondering if I could get some advice on the best way to build the user
interface depicted in this diagram:
http://www.senske.com/images/winforms_layout.jpg

The gray areas will be static throughout. However, I'd like the blue area
to change to a different interface depending on which of the buttons at
left
is pressed. Should I design the interface for each of the buttons as a
separate custom user control, then swap the controls in and out depending
on
which button is pressed?

Or, am I going about it entirely wrong and there's a better approach?

Thanks in advance for any insight.

Andre Ranieri

Mar 31 '06 #2
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
Mar 31 '06 #3
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

Mar 31 '06 #4
Maybe you also could give a look at composite ui application block...

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

Mar 31 '06 #5
Thanks for your help. I think this will work fine.

I ended up using user controls instead of panels for the solution because
each element will have a fair amount of back-end code for data binding, etc,
and I didn't want all the code packed up in one form class.

Andre Ranieri
Apr 1 '06 #6
User controls are also superior because you can design them separately,
in their own design spaces, then merely place them on the final form.
Designing all six panels in the same form is difficult. (I know: I've
tried it. :-( )

Apr 1 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marco Vasquez | last post by:
Hi everybody, I would really appreciate any help in implementing Web Popup windows using User Interface Process Application Block. Thanks in advance, Marco
3
by: Dilip | last post by:
Hi I have a windows forms user control that is hosted in IE. This control uses COM Interop to access some RTC related interfaces. The control does not display itself correctly because of this...
5
by: John Smith | last post by:
Hi folks, I'm embedding a Windows Forms User Control into an aspx web page. I've created the class library in C# and added the user control to it. If the control just has simple Windows Forms...
5
by: Keith | last post by:
Please help. I've been developing a windows forms user control to be hosted in IE/ASP.NET. The control is developed in .NET v1.1, and for now I'll need to keep it in that version. Recently I...
1
by: Gita George | last post by:
What is the best way to provide a user interface to a Windows service? Should I use DDE or remoting? How can I do that? Thanks.
2
by: Ryan Liu | last post by:
Hi, Can someone give me a hlep on inherited user control? I try to inherite windows forms user control, like ListView. From Visual studio 2003, I right click a folder and selct "Add...
1
by: Developer | last post by:
Hello All, I would like to know if there are any User Interface Guidelines for Microsoft Windows forms, which gives me a hint on how much should the spacing between the User controls be, how...
1
by: david | last post by:
When I read a white paper about web application, it said that they developed a component built as Windows forms user control, and embedded it inside a web form. So the web form page can fully use...
2
by: OSI Mik | last post by:
Hello, I try to make a user interface for a DB in VB.DOT 2005 with SQL server. I use auto generate Textbox and datagridview (with BindingSource, TableAdapter...) with manual add of ComboBox and I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.