Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building C# .NET windows application with multiple views

Tags:

c#

.net

windows

I'm rewriting an old application and use this as a good opportunity to try out C# and .NET development (I usually do a lot of plug-in stuff in C).

The application is basically a timer collecting data. It has a start view with a button to start the measurement. During the measurement the app has five different views depending on what information the user wants to see.

What is the best practice to switch between the views? From start to running? Between the running views?

Ideas:

  • Use one form and hide and show controls
  • Use one start form and then a form with a TabControl
  • Use six separate forms
like image 358
Peter Olsson Avatar asked Aug 24 '08 16:08

Peter Olsson


1 Answers

Creating a bunch of overlaid panels is a design-time nightmare.

I would suggest using a tab control with each "view" on a separate tab, and then picking the correct tab at runtime. You can avoid showing the tab headers by putting something like this in your form's Load event:

tabControl1.Top = tabControl1.Top - tabControl1.ItemSize.Height;
tabControl1.Height = tabControl1.Height + tabControl1.ItemSize.Height;
tabControl1.Region = new Region(new RectangleF(tabPage1.Left, tabPage1.Top, tabPage1.Width, tabPage1.Height + tabControl1.ItemSize.Height));
like image 150
Chris Karcher Avatar answered Oct 28 '22 07:10

Chris Karcher