Xtra窗口中实现多个Tab页的切换
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraBars;
using DevExpress.XtraTabbedMdi;
namespace FAnimation.BaseData
{
public partial class MainTest : DevExpress.XtraEditors.XtraForm
{
public MainTest()
{
InitializeComponent();
}
//初始化两个窗体,点击菜单按钮,显示窗体
FrmUsr_functioninfo fUsr_functioninfo ;
FrmMenu_FormInfo fMenu_FormInfo;
FrmCST_Customers fCST_Customers ;
private void MainTest_Load(object sender, EventArgs e)
{
BarManager barManager = new BarManager();
barManager.Form = this;
// Create a bar with a New button.
barManager.BeginUpdate();
Bar bar = new Bar(barManager, "My Bar");
bar.DockStyle = BarDockStyle.Left ;
barManager.MainMenu = bar;
BarItem barItem1 = new BarButtonItem(barManager, "功能管理");
barItem1.ItemClick += new ItemClickEventHandler(barItem1_ItemClick);
bar.ItemLinks.Add(barItem1);
BarItem barItem2 = new BarButtonItem(barManager, "画面管理");
barItem2.ItemClick += new ItemClickEventHandler(barItem2_ItemClick);
bar.ItemLinks.Add(barItem2);
BarItem barItem3 = new BarButtonItem(barManager, "顾客信息");
barItem3.ItemClick += new ItemClickEventHandler(barItem3_ItemClick);
bar.ItemLinks.Add(barItem3);
barManager.EndUpdate();
}
void barItem1_ItemClick(object sender, ItemClickEventArgs e)
{
if (xtraTabbedMdiManager1.Pages[fUsr_functioninfo]==null )
{
fUsr_functioninfo = new FrmUsr_functioninfo();
fUsr_functioninfo.MdiParent = this;
fUsr_functioninfo.Show();
}
xtraTabbedMdiManager1.SelectedPage = xtraTabbedMdiManager1.Pages[fUsr_functioninfo];
}
void barItem2_ItemClick(object sender, ItemClickEventArgs e)
{
if (xtraTabbedMdiManager1.Pages[fMenu_FormInfo]==null)
{
fMenu_FormInfo = new FrmMenu_FormInfo();
fMenu_FormInfo.MdiParent = this;
fMenu_FormInfo.Show();
}
xtraTabbedMdiManager1.SelectedPage = xtraTabbedMdiManager1.Pages[fMenu_FormInfo];
}
void barItem3_ItemClick(object sender, ItemClickEventArgs e)
{
if (xtraTabbedMdiManager1.Pages[fCST_Customers] == null)
{
fCST_Customers = new FrmCST_Customers();
fCST_Customers.MdiParent = this;
fCST_Customers.Show();
}
xtraTabbedMdiManager1.SelectedPage = xtraTabbedMdiManager1.Pages[fCST_Customers];
}
}
}