xtraTabControl1

using DevExpress.XtraTab;
using System;
using System.Windows.Forms;

namespace FrmMain
{
    using DevExpress.XtraBars.Helpers;

    public partial class FrmMain : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public FrmMain()
        {
            InitializeComponent();
        }

        private void xtraTabControl1_CloseButtonClick(object sender, EventArgs e)
        {
            DevExpress.XtraTab.ViewInfo.ClosePageButtonEventArgs eArg = (DevExpress.XtraTab.ViewInfo.ClosePageButtonEventArgs)e;
            string name = eArg.Page.Text;//得到关闭的选项卡的text
            foreach (XtraTabPage page in xtraTabControl1.TabPages)//遍历得到和关闭的选项卡一样的Text
            {
                if (page.Text == name)
                {
                    xtraTabControl1.TabPages.Remove(page);
                    page.Dispose();
                    return;
                }
            }
        }
        private void itemRuKuXinXi_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            string name = e.Link.Caption;
            //判断是否已创建过
            foreach (XtraTabPage page in xtraTabControl1.TabPages)
            {
                if (page.Text == name)
                {
                    xtraTabControl1.SelectedTabPage = page;//显示该页
                    return;
                }
            }
            //增加tabpage
            XtraTabPage xpage = new XtraTabPage();
            xpage.Name = name;
            xpage.Text = name;
            //向xtraTabControl1中添加窗体
            FrmRuKuXinXi frm = new FrmRuKuXinXi();
            frm.Visible = true;
            frm.Dock = DockStyle.Fill;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopLevel = false;//在这里一定要注意  负责是加载不出来的
            xpage.Controls.Add(frm);//添加要增加的控件
            xtraTabControl1.TabPages.Add(xpage);
            xtraTabControl1.SelectedTabPage = xpage;//显示该页
        }

        private void itemChuKuXinXi_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            string name = e.Link.Caption;
            //判断是否已创建过
            foreach (XtraTabPage page in xtraTabControl1.TabPages)
            {
                if (page.Text == name)
                {
                    xtraTabControl1.SelectedTabPage = page;//显示该页
                    return;
                }
            }
            //增加tabpage
            XtraTabPage xpage = new XtraTabPage();
            xpage.Name = name;
            xpage.Text = name;
            //向xtraTabControl1中添加窗体
            FrmChuKuXinXi frm = new FrmChuKuXinXi();
            frm.Visible = true;
            frm.Dock = DockStyle.Fill;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopLevel = false;//在这里一定要注意  负责是加载不出来的
            xpage.Controls.Add(frm);//添加要增加的控件
            xtraTabControl1.TabPages.Add(xpage);
            xtraTabControl1.SelectedTabPage = xpage;//显示该页
        }

        private void itemRuKuXinXiHuiZong_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            string name = e.Link.Caption;
            //判断是否已创建过
            foreach (XtraTabPage page in xtraTabControl1.TabPages)
            {
                if (page.Text == name)
                {
                    xtraTabControl1.SelectedTabPage = page;//显示该页
                    return;
                }
            }
            //增加tabpage
            XtraTabPage xpage = new XtraTabPage();
            xpage.Name = name;
            xpage.Text = name;
            //向xtraTabControl1中添加窗体
            FrmRuKuXinXiHuiZong frm = new FrmRuKuXinXiHuiZong();
            frm.Visible = true;
            frm.Dock = DockStyle.Fill;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopLevel = false;//在这里一定要注意  负责是加载不出来的
            xpage.Controls.Add(frm);//添加要增加的控件
            xtraTabControl1.TabPages.Add(xpage);
            xtraTabControl1.SelectedTabPage = xpage;//显示该页
        }

        private void itemShiLiaoJiChuXinXi_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            string name = e.Link.Caption;
            //判断是否已创建过
            foreach (XtraTabPage page in xtraTabControl1.TabPages)
            {
                if (page.Text == name)
                {
                    xtraTabControl1.SelectedTabPage = page;//显示该页
                    return;
                }
            }
            //增加tabpage
            XtraTabPage xpage = new XtraTabPage();
            xpage.Name = name;
            xpage.Text = name;
            //向xtraTabControl1中添加窗体
            FrmShiLiaoJiChuXinXi frm = new FrmShiLiaoJiChuXinXi();
            frm.Visible = true;
            frm.Dock = DockStyle.Fill;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopLevel = false;//在这里一定要注意  负责是加载不出来的
            xpage.Controls.Add(frm);//添加要增加的控件
            xtraTabControl1.TabPages.Add(xpage);
            xtraTabControl1.SelectedTabPage = xpage;//显示该页
        }

        private void itemCheLiangXinXiWeiHu_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            string name = e.Link.Caption;
            //判断是否已创建过
            foreach (XtraTabPage page in xtraTabControl1.TabPages)
            {
                if (page.Text == name)
                {
                    xtraTabControl1.SelectedTabPage = page;//显示该页
                    return;
                }
            }
            //增加tabpage
            XtraTabPage xpage = new XtraTabPage();
            xpage.Name = name;
            xpage.Text = name;
            //向xtraTabControl1中添加窗体
            FrmCheLiangXinXiWeiHu frm = new FrmCheLiangXinXiWeiHu();
            frm.Visible = true;
            frm.Dock = DockStyle.Fill;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopLevel = false;//在这里一定要注意  负责是加载不出来的
            xpage.Controls.Add(frm);//添加要增加的控件
            xtraTabControl1.TabPages.Add(xpage);
            xtraTabControl1.SelectedTabPage = xpage;//显示该页
        }

        private void itemFuKuanFangShiWeiHu_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            string name = e.Link.Caption;
            //判断是否已创建过
            foreach (XtraTabPage page in xtraTabControl1.TabPages)
            {
                if (page.Text == name)
                {
                    xtraTabControl1.SelectedTabPage = page;//显示该页
                    return;
                }
            }
            //增加tabpage
            XtraTabPage xpage = new XtraTabPage();
            xpage.Name = name;
            xpage.Text = name;
            //向xtraTabControl1中添加窗体
            FrmFuKuanFangShiWeiHu frm = new FrmFuKuanFangShiWeiHu();
            frm.Visible = true;
            frm.Dock = DockStyle.Fill;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopLevel = false;//在这里一定要注意  负责是加载不出来的
            xpage.Controls.Add(frm);//添加要增加的控件
            xtraTabControl1.TabPages.Add(xpage);
            xtraTabControl1.SelectedTabPage = xpage;//显示该页
        }

        private void itemKeHuXinXiWeiHu_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            string name = e.Link.Caption;
            //判断是否已创建过
            foreach (XtraTabPage page in xtraTabControl1.TabPages)
            {
                if (page.Text == name)
                {
                    xtraTabControl1.SelectedTabPage = page;//显示该页
                    return;
                }
            }
            //增加tabpage
            XtraTabPage xpage = new XtraTabPage();
            xpage.Name = name;
            xpage.Text = name;
            //向xtraTabControl1中添加窗体
            FrmKeHuXinXiWeiHu frm = new FrmKeHuXinXiWeiHu();
            frm.Visible = true;
            frm.Dock = DockStyle.Fill;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopLevel = false;//在这里一定要注意  负责是加载不出来的
            xpage.Controls.Add(frm);//添加要增加的控件
            xtraTabControl1.TabPages.Add(xpage);
            xtraTabControl1.SelectedTabPage = xpage;//显示该页
        }

        private void itemYuanLiaoDiWeiHu_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            string name = e.Link.Caption;
            //判断是否已创建过
            foreach (XtraTabPage page in xtraTabControl1.TabPages)
            {
                if (page.Text == name)
                {
                    xtraTabControl1.SelectedTabPage = page;//显示该页
                    return;
                }
            }
            //增加tabpage
            XtraTabPage xpage = new XtraTabPage();
            xpage.Name = name;
            xpage.Text = name;
            //向xtraTabControl1中添加窗体
            FrmYuanLiaoDiWeiHu frm = new FrmYuanLiaoDiWeiHu();
            frm.Visible = true;
            frm.Dock = DockStyle.Fill;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopLevel = false;//在这里一定要注意  负责是加载不出来的
            xpage.Controls.Add(frm);//添加要增加的控件
            xtraTabControl1.TabPages.Add(xpage);
            xtraTabControl1.SelectedTabPage = xpage;//显示该页
        }

        private void itemRenYuanXinXiWeiHu_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            string name = e.Link.Caption;
            //判断是否已创建过
            foreach (XtraTabPage page in xtraTabControl1.TabPages)
            {
                if (page.Text == name)
                {
                    xtraTabControl1.SelectedTabPage = page;//显示该页
                    return;
                }
            }
            //增加tabpage
            XtraTabPage xpage = new XtraTabPage();
            xpage.Name = name;
            xpage.Text = name;
            //向xtraTabControl1中添加窗体
            FrmRenYuanXinXiWeiHu frm = new FrmRenYuanXinXiWeiHu();
            frm.Visible = true;
            frm.Dock = DockStyle.Fill;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopLevel = false;//在这里一定要注意  负责是加载不出来的
            xpage.Controls.Add(frm);//添加要增加的控件
            xtraTabControl1.TabPages.Add(xpage);
            xtraTabControl1.SelectedTabPage = xpage;//显示该页
        }

        private void itemYongHuGuanLi_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            string name = e.Link.Caption;
            //判断是否已创建过
            foreach (XtraTabPage page in xtraTabControl1.TabPages)
            {
                if (page.Text == name)
                {
                    xtraTabControl1.SelectedTabPage = page;//显示该页
                    return;
                }
            }
            //增加tabpage
            XtraTabPage xpage = new XtraTabPage();
            xpage.Name = name;
            xpage.Text = name;
            //向xtraTabControl1中添加窗体
            FrmYongHuGuanLi frm = new FrmYongHuGuanLi();
            frm.Visible = true;
            frm.Dock = DockStyle.Fill;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopLevel = false;//在这里一定要注意  负责是加载不出来的
            xpage.Controls.Add(frm);//添加要增加的控件
            xtraTabControl1.TabPages.Add(xpage);
            xtraTabControl1.SelectedTabPage = xpage;//显示该页
        }

        private void itemXiuGaiMiMa_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            string name = e.Link.Caption;
            //判断是否已创建过
            foreach (XtraTabPage page in xtraTabControl1.TabPages)
            {
                if (page.Text == name)
                {
                    xtraTabControl1.SelectedTabPage = page;//显示该页
                    return;
                }
            }
            //增加tabpage
            XtraTabPage xpage = new XtraTabPage();
            xpage.Name = name;
            xpage.Text = name;
            //向xtraTabControl1中添加窗体
            FrmXiuGaiMiMa frm = new FrmXiuGaiMiMa();
            frm.Visible = true;
            frm.Dock = DockStyle.Fill;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopLevel = false;//在这里一定要注意  负责是加载不出来的
            xpage.Controls.Add(frm);//添加要增加的控件
            xtraTabControl1.TabPages.Add(xpage);
            xtraTabControl1.SelectedTabPage = xpage;//显示该页
        }

        private void itemCanShuSheZhi_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            string name = e.Link.Caption;
            //判断是否已创建过
            foreach (XtraTabPage page in xtraTabControl1.TabPages)
            {
                if (page.Text == name)
                {
                    xtraTabControl1.SelectedTabPage = page;//显示该页
                    return;
                }
            }
            //增加tabpage
            XtraTabPage xpage = new XtraTabPage();
            xpage.Name = name;
            xpage.Text = name;
            //向xtraTabControl1中添加窗体
            FrmCanShuSheZhi frm = new FrmCanShuSheZhi();
            frm.Visible = true;
            frm.Dock = DockStyle.Fill;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopLevel = false;//在这里一定要注意  负责是加载不出来的
            xpage.Controls.Add(frm);//添加要增加的控件
            xtraTabControl1.TabPages.Add(xpage);
            xtraTabControl1.SelectedTabPage = xpage;//显示该页
        }

        private void FrmMain_Load(object sender, EventArgs e)
        {
            WindowState = FormWindowState.Maximized;
            //// 启动更换皮肤控件
            //SkinHelper.InitSkinGallery(ribbonGalleryBarItem1);
            ////// 设置默认皮肤//DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Office 2010 Blue");
        }

    }
}

时间: 2024-11-15 17:30:20

xtraTabControl1的相关文章

[转载]Winform开发框架之统计图表的实现

在前面的一些随笔中,介绍了不少我的Winform框架的特性,上篇随笔<Winform开发框架之通用高级查询模块>对其中的通用高级模块进了一个整理说明,本篇继续介绍Winform开发框架重要的一个特性之统计图表的实现.统计图表在很多项目都可能用到,集成到框架中,更方便大家对一些图表项目的设计理解以及功能的重用.在一般的传统的框架中,可以采用ZedGraph开源控件或者微软自带的MSChart进行图表设计,DevExpress控件套件有自己的图表控件,本篇主要介绍基于DevExpress控件的图表

XtraTabControl

添加using DevExpress.XtraTab; 双击listview增加相应的tabpage,禁止重复添加: private void listView_index_MouseDoubleClick(object sender, MouseEventArgs e) { if (listView_index.SelectedItems.Count > 0) { ListViewItem lvi = listView_index.SelectedItems[0];//得到选中的项 strin

DevExpress控件学习总结

1.Navigation & Layout 1.1 Bar Manager 如果想在窗体或用户控件(user control)上添加工具条(bars)或弹出菜单(popup menus),我们 需要把一个不可见的控件(component)BarManager(Navigation&Layout)拖放到这个窗体或用户控件上.这个控 件维护工具条在窗体上的布局,处理用户的行为(processes an end-user's actions),提供一些定制功能等等.这个控件维护 工具条.工具条项

xtraTabControl 如何遍历每个选项卡 z

XtraTabHitInfo hi = tabPositionControl.CalcHitInfo(new Point(e.X, e.Y)); if (hi.HitTest == XtraTabHitTest.PageHeader) {     // 这段话就是根据坐标(x, y)判断是否点击了Tab Header.这个e.X跟e.Y可以从MouseMove事件参数e里面来这你应该知道吧?   // 还可以通过XtraTabHitTest这个枚举值判断更多的情况. } private void

DevExpress_Winform_使用汇总

CheckTreeList 1.选中节点以不同颜色标示 Appearance.FocusedCel LookUpEdit 1.实现主细表显示和编辑 主表:tblMain,绑定到MyGridControl上 细表:tblDetail,绑定到MyLookUpEdit上 假设:两个表的数据已经获取,下面重点关注如何进行数据绑定 BindingSourse bsMain= new BindingSource(); bsMain.DataSource = tblMain; MyGridControl.Da

DevExpress.XtraReports.UI.XtraReport 动态报表

原文:DevExpress.XtraReports.UI.XtraReport 动态报表 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using DevExpress.XtraTab;usin

DevExpress控件学习总结(转)

DevExpress控件学习总结 1.Navigation & Layout 1.1 Bar Manager 如果想在窗体或用户控件(user control)上添加工具条(bars)或弹出菜单(popup menus),我们需要把一个不可见的控件(component)BarManager(Navigation&Layout)拖放到这个窗体或用户控件上.这个控件维护工具条在窗体上的布局,处理用户的行为(processes an end-user's actions),提供一些定制功能等等.

DevExpress控件学习总结(转)

1.Navigation & Layout 1.1 Bar Manager 如果想在窗体或用户控件(user control)上添加工具条(bars)或弹出菜单(popup menus),我们 需要把一个不可见的控件(component)BarManager(Navigation&Layout)拖放到这个窗体或用户控件上.这个控 件维护工具条在窗体上的布局,处理用户的行为(processes an end-user's actions),提供一些定制功能等等.这个控件维护 工具条.工具条项

DevExpress控件学习总结【转载】

1.Navigation & Layout 1.1 Bar Manager      如果想在窗体或用户控件(user control)上添加工具条(bars)或弹出菜单(popup menus),我们 需要把一个不可见的控件(component)BarManager(Navigation&Layout)拖放到这个窗体或用户控件上.这个控 件维护工具条在窗体上的布局,处理用户的行为(processes an end-user's actions),提供一些定制功能等等.这个控件维护 工具条