3 Replies - 5331 Views - Last Post: 01 July 2009 - 11:02 PM Rate Topic: -----

#1 chad_nz  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 24
  • Joined: 03-June 09

Dynamic GUI in Visual Studio, C#

Posted 01 July 2009 - 08:26 PM

Hi Everyone:

I'm making an application in order to manage an SQL Server Database through C#.

I'm designing the Administrator Windows form in which I'm allowing my administrator to perform different operations, e.g. add a new user, edit existing user, delete uset, etc.

Instead of selecting the option(combobox), click an apply button and then load a new Window form.

I want to create a Form that could show different embedded forms depending on the user's selection in within the same window.

I thought of a tabControl with as many tabPages as options but I can't seem to hide the tabPage Control Panel in order just to tab between then using code....

Is this possible? Any suggestions?

Many thanks! B)

Carlos

Is This A Good Question/Topic? 0
  • +

Replies To: Dynamic GUI in Visual Studio, C#

#2 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Dynamic GUI in Visual Studio, C#

Posted 01 July 2009 - 10:14 PM

I can think of at least one way. You could use panels. In each panel you will put the controls you want on the different forms on the panels. It would probably be best to design the panels on a blank form, the select everything and just copy it to your main form. When the administrator wants a specific panel, you should be able to set the Visible property of the panel you want to display to true and the others false. That should effectively switch panels giving the illusion that each panel is it's own separate form.

I'm not sure, but I think you can also just set the Enabled property of the panel to true to activate it and all of it's children and false to disable them.
Was This Post Helpful? 0
  • +
  • -

#3 chad_nz  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 24
  • Joined: 03-June 09

Re: Dynamic GUI in Visual Studio, C#

Posted 01 July 2009 - 10:54 PM

View PostSixOfEleven, on 1 Jul, 2009 - 09:14 PM, said:

I can think of at least one way. You could use panels. In each panel you will put the controls you want on the different forms on the panels. It would probably be best to design the panels on a blank form, the select everything and just copy it to your main form. When the administrator wants a specific panel, you should be able to set the Visible property of the panel you want to display to true and the others false. That should effectively switch panels giving the illusion that each panel is it's own separate form.

I'm not sure, but I think you can also just set the Enabled property of the panel to true to activate it and all of it's children and false to disable them.



SixOfEleven:

Cheers mate, It works like a charm!

Many thanks again!
Was This Post Helpful? 0
  • +
  • -

#4 janne_panne  Icon User is offline

  • WinRT Dev
  • member icon

Reputation: 429
  • View blog
  • Posts: 1,047
  • Joined: 09-June 09

Re: Dynamic GUI in Visual Studio, C#

Posted 01 July 2009 - 11:02 PM

Here is a code to create your own tabcontrol which hides the header when the program is ran but shows the header while the program is in design state, so it is easy to work with it in the VS designer.

using System;
using System.Windows.Forms;

public class WizardPages : TabControl
{
	protected override void WndProc(ref Message m)
	{
		// Hide tabs by trapping the TCM_ADJUSTRECT message
		if (m.Msg == 0x1328 && !DesignMode) 
		   m.Result = (IntPtr)1;
		else 
		   base.WndProc(ref m);
	}
}



Copied from:
http://www.eggheadca...abpages-he.aspx
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1