C#XtraTabControl封装研究中

using DevExpress.XtraTab;
using MDI;
using System;

namespace MyDll
{
    public partial class MyXtraTabControl : XtraTabControl
    {
        public MyXtraTabControl()
        {
            InitializeComponent();
        }
        private DevExpress.XtraTab.XtraTabPage CurrentPage = null;
        private void MyXtraTabControl_HotTrackedPageChanged(object sender, TabPageChangedEventArgs e)
        {
            try
            {
                CurrentPage = e.Page;

            }
            catch (System.Exception ex)
            {
                CurrentPage = null;
            }
        }

        private void MyXtraTabControl_DoubleClick(object sender, EventArgs e)
        {
            if (CurrentPage != null)
            {
                // CurrentPage.PageVisible = false;
                Class1.CloseOneTabPage(this);
            }
        }
        private void MyXtraTabControl_CloseButtonClick(object sender, EventArgs e)
        {
            Class1.CloseOneTabPage(this);

        }
    }
}
namespace MyDll
{
    partial class MyXtraTabControl
    {
        /// <summary> 
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary> 
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region 组件设计器生成的代码

        /// <summary> 
        /// 设计器支持所需的方法 - 不要
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
            this.SuspendLayout();
            // 
            // MyXtraTabControl
            // 
            this.ClosePageButtonShowMode = DevExpress.XtraTab.ClosePageButtonShowMode.InAllTabPageHeaders;
            this.Dock = System.Windows.Forms.DockStyle.Fill;
            this.HeaderAutoFill = DevExpress.Utils.DefaultBoolean.False;
            this.HeaderButtons = ((DevExpress.XtraTab.TabButtons)(((DevExpress.XtraTab.TabButtons.Prev | DevExpress.XtraTab.TabButtons.Next)
                        | DevExpress.XtraTab.TabButtons.Close)));
            this.HeaderButtonsShowMode = DevExpress.XtraTab.TabButtonShowMode.Always;
            this.Location = new System.Drawing.Point(0, 25);
            this.Name = "MainTabControl";
            this.ShowHeaderFocus = DevExpress.Utils.DefaultBoolean.True;
            this.ShowTabHeader = DevExpress.Utils.DefaultBoolean.True;
            this.Size = new System.Drawing.Size(1042, 496);
            this.TabIndex = 20;
            this.DoubleClick += new System.EventHandler(this.MyXtraTabControl_DoubleClick);
            this.CloseButtonClick += new System.EventHandler(this.MyXtraTabControl_CloseButtonClick);
            this.HotTrackedPageChanged += new DevExpress.XtraTab.TabPageChangedEventHandler(this.MyXtraTabControl_HotTrackedPageChanged);
            ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

    }
}

 

posted @ 2013-08-14 21:54  永远的菜鸟@me  阅读(603)  评论(0编辑  收藏  举报