filmov
tv
Simple Tutorial to integrate multiple Forms into Tab Pages #Winform #Integrate #TabPages #Form

Показать описание
Simple Tutorial to integrate multiple Forms into Tab Pages #Winform #Integrate #TabPages #Form
Please like the video if it helps you :)
You can scroll down further to find the instructions displayed in the Video
== Some background information on Winforms ==
Winform is using C# and in this video it is using Visual Studio 2015 but you should be able to use other version as well.
An application may be created by multiple people.
Each person are working on the development of the different forms. These forms are created as a separate project and each project contain the forms.
Each project will create a namespace where the forms reside in.
In order to integrate these form(s) from a separate project into a master form, we need to do the following
- Add these forms into the master form project
- include the namespace of the other project so that the master form can access the forms inside
When a form is first displayed on screen, it is known as form Loading. If you need to run any code before the form shows up,
you need to add the codes at the "Form1_Load" event handler. To create an event handler function, you cannot just type out the code for the function.
You need Visual Studio to create it for you. So to get visual studio to create the "Form1_Load" event handler function, you double click on any empty area of the form.
It will create the "Form1_Load" event handler function. You can then add in codes that needs to be run just before the form is displayed.
To add code to run when a button is clicked, you need add the codes at the "button_Click" event handler. Similar to the "Form1_Load" event handler,
you cannot manually type out this function. you need Visual studio to create for you. So you double click on the button to create the event handler function for that button. You can then add in codes to run when the button is clicked.
== Content of Video ==
This is a simple and short video to illustrate how you could integrate Forms from different projects into different Tab Pages (tabPage2) of a Tab control (tabControlMain) in a master form.
This is helpful if multiple people are doing developments on different forms and need to integrate them into 1 master form.
The Master form can then be used as the Dashboard with buttons to navigate to different pages (forms).
It uses the Tab control at the master form. The forms within other projects can be added into the Tab Control's different tab pages.
The video also illustrate how to hide the Tab Headers so that the multiple forms can be seen like normal pages on a Dashboard navigated by buttons.
(The codes for hiding of the Tab Header are taken from the reference link below)
== Instructions from Video ==
Add form to Project
- Right click on project at the solution explorer
- Select "Add" - "Existing Item"
- Select the Form (XXX.cs)
At master form Load, add form to Tab Page
- use the namespace
- create the form and configure as below
Form frmChild = new FormB();
//You can adjust size accordingly
//int width = 1000, height = 550;
//frmChild.Size = new Size(width, height);
frmChild.TopLevel = false;
frmChild.Dock = DockStyle.Fill;
frmChild.FormBorderStyle = FormBorderStyle.None;
frmChild.Visible = true;
//tabPage2 is the page you want to add the form
tabPage2.Controls.Add(frmChild);
Hide the Tab Pages header using properties
tabControlMain.Appearance = TabAppearance.FlatButtons;
tabControlMain.ItemSize = new Size(0, 1);
tabControlMain.SizeMode = TabSizeMode.Fixed;
Use button to display Tab Page
tabControlMain.SelectedTab = tabPage2;
Hope these inputs are helpful for you.
0:00 - Introduction to the Video
0:54 - Add form to project
01:46 - Examine namespace of added form and adding namespace to master form
03:25 - Create Form object to add to Tab Page during master form's Form Load event handler
05:31 - Create button handler and display the relevant pages when button is clicked
07:05 - Hide Tab Pages Header using the Tab Control properties
References:
The codes to hide the header of the Tab Control are found from the link below
Keywords:
#Winform
#Form
#Dashboard
#integrate
#VisualStudio
#VS2015
#CSharp
#Tab
#TabControl
#TabPage
#MultipleForms
#multipleProject
#namespace
#eventHandler
#FormLoad
#buttonClick
#buttonHandler
#short
#simple
#learn
#easy
#beginner
#explore
#tutorial
#basic
Please like the video if it helps you :)
You can scroll down further to find the instructions displayed in the Video
== Some background information on Winforms ==
Winform is using C# and in this video it is using Visual Studio 2015 but you should be able to use other version as well.
An application may be created by multiple people.
Each person are working on the development of the different forms. These forms are created as a separate project and each project contain the forms.
Each project will create a namespace where the forms reside in.
In order to integrate these form(s) from a separate project into a master form, we need to do the following
- Add these forms into the master form project
- include the namespace of the other project so that the master form can access the forms inside
When a form is first displayed on screen, it is known as form Loading. If you need to run any code before the form shows up,
you need to add the codes at the "Form1_Load" event handler. To create an event handler function, you cannot just type out the code for the function.
You need Visual Studio to create it for you. So to get visual studio to create the "Form1_Load" event handler function, you double click on any empty area of the form.
It will create the "Form1_Load" event handler function. You can then add in codes that needs to be run just before the form is displayed.
To add code to run when a button is clicked, you need add the codes at the "button_Click" event handler. Similar to the "Form1_Load" event handler,
you cannot manually type out this function. you need Visual studio to create for you. So you double click on the button to create the event handler function for that button. You can then add in codes to run when the button is clicked.
== Content of Video ==
This is a simple and short video to illustrate how you could integrate Forms from different projects into different Tab Pages (tabPage2) of a Tab control (tabControlMain) in a master form.
This is helpful if multiple people are doing developments on different forms and need to integrate them into 1 master form.
The Master form can then be used as the Dashboard with buttons to navigate to different pages (forms).
It uses the Tab control at the master form. The forms within other projects can be added into the Tab Control's different tab pages.
The video also illustrate how to hide the Tab Headers so that the multiple forms can be seen like normal pages on a Dashboard navigated by buttons.
(The codes for hiding of the Tab Header are taken from the reference link below)
== Instructions from Video ==
Add form to Project
- Right click on project at the solution explorer
- Select "Add" - "Existing Item"
- Select the Form (XXX.cs)
At master form Load, add form to Tab Page
- use the namespace
- create the form and configure as below
Form frmChild = new FormB();
//You can adjust size accordingly
//int width = 1000, height = 550;
//frmChild.Size = new Size(width, height);
frmChild.TopLevel = false;
frmChild.Dock = DockStyle.Fill;
frmChild.FormBorderStyle = FormBorderStyle.None;
frmChild.Visible = true;
//tabPage2 is the page you want to add the form
tabPage2.Controls.Add(frmChild);
Hide the Tab Pages header using properties
tabControlMain.Appearance = TabAppearance.FlatButtons;
tabControlMain.ItemSize = new Size(0, 1);
tabControlMain.SizeMode = TabSizeMode.Fixed;
Use button to display Tab Page
tabControlMain.SelectedTab = tabPage2;
Hope these inputs are helpful for you.
0:00 - Introduction to the Video
0:54 - Add form to project
01:46 - Examine namespace of added form and adding namespace to master form
03:25 - Create Form object to add to Tab Page during master form's Form Load event handler
05:31 - Create button handler and display the relevant pages when button is clicked
07:05 - Hide Tab Pages Header using the Tab Control properties
References:
The codes to hide the header of the Tab Control are found from the link below
Keywords:
#Winform
#Form
#Dashboard
#integrate
#VisualStudio
#VS2015
#CSharp
#Tab
#TabControl
#TabPage
#MultipleForms
#multipleProject
#namespace
#eventHandler
#FormLoad
#buttonClick
#buttonHandler
#short
#simple
#learn
#easy
#beginner
#explore
#tutorial
#basic