How can I close an opened window when I call a new window? That means I want only 1 child window at the time. I don’t allow multi-window.
public partial class Main_Usr : Form
{
public Main_Usr()
{
InitializeComponent();
this.IsMdiContainer = true;
if (Program.IsFA) barSubItem_Ordre.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
Ordre_Liste f = new Ordre_Liste();
f.MdiParent = this;
f.Show();
}
private void barButtonItem_CreateOrdre_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
Program.AllerRetour = "Ordre Aller";
Ordre_Fiche f = new Ordre_Fiche();
f.MdiParent = this;
f.Show();
}
private void barButtonItem_OrdreListe_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
Ordre_Liste f = new Ordre_Liste();
f.MdiParent = this;
f.Show();
}
private void barButtonItem_CreateOrdRet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
Program.AllerRetour = "Ordre Retour";
Ordre_Fiche f = new Ordre_Fiche();
f.MdiParent = this;
f.Show();
}
}
There are different ways to implement pseudo masterpage:
EXAMPLE:
Main_Usrform.Modifiersof those controls to protected)Ordre_Listeform code and change it to inherit fromMain_Usrform, instead ofFormOrdre_Listeformvoila! you have ‘masterpage’
UPDATE (for 3rd option)
MasterUserControlHomeUserControland change it to inherit from yourMasterUserControl.HomeUserControldesigner and add custom content. Also you can modify parent controls, which hasprotectedmodifier.HomePageUserControlThere different ways to implement navigation between controls (aka pages). Simplest way – have menu on main form. Other way – define event ‘Navigate’ on master control, subscribe to that event on main form, and raise it from ‘pages’.