
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TeacherDemo
{
public partial class FrmMain : Form
{
public FrmMain()
{
InitializeComponent();
}
private void OpenNewForm(Form newFrm)
{
foreach (Control item in this.splitContainer.Panel2.Controls)
{
if (item is Form)
((Form)item).Close();
}
newFrm.TopLevel = false;
newFrm.Parent = this.splitContainer.Panel2;
newFrm.Dock = DockStyle.Fill;
newFrm.Show();
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnProductManage_Click(object sender, EventArgs e)
{
OpenNewForm(new FrmAddProduct());
}
}
}