⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 topictabpage.cs

📁 定义社区节点
💻 CS
字号:
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

using System.Windows.Forms;

namespace feiyun0112.cnblogs.com.CSDNReader.Controls
{
    public partial class TopicTabPage :System.Windows.Forms.TabPage
    {
        public TopicTabPage()
        {
            InitializeComponent();
        }

        /// <summary> 
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (((TabControl)this.Parent) != null)
            {
                //当前帖子关闭时,显示其他帖子
                int index = ((TabControl)this.Parent).SelectedIndex;
                int intTotal = ((TabControl)this.Parent).TabCount;
                if (index >= 1)
                {
                    if (index == intTotal - 1)
                    {
                        index = index - 1;
                    }
                    else
                    {
                        index = index +1;
                    }
                }
                else
                {
                    index = 0;
                }
                ((TabControl)this.Parent).SelectedIndex = index;
            }

            TopicForm.Dispose();
            TopicForm = null;
            Topic.TabPage = null;
            _Topic = null;

            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }


        public TopicTabPage(IContainer container)
        {
            if (container != null)
            {
                container.Add(this);
            }

            InitializeComponent();
        }

        private Controls.frmTopic  _frmTopic;

        public Controls.frmTopic  TopicForm
        {
            get { return _frmTopic; }
            set { _frmTopic = value; }
        }
	

        private Model.Topic _Topic;

        public Model.Topic Topic
        {
            get { return _Topic; }
            set 
            {
                _Topic = value;
                if (TopicForm == null || TopicForm.IsDisposed)
                {
                    //将frmTopic作为TAB的一个控件
                    TopicForm = new frmTopic();
                    TopicForm.TopLevel = false;
                    this.Controls.Add(TopicForm);
                    TopicForm.Location = new System.Drawing.Point(0, 0);
                    TopicForm.Dock = DockStyle.Fill;
                    TopicForm.Size = new System.Drawing.Size(this.Width, this.Height);
                }
                TopicForm.Visible = true;

                TopicForm.Topic = value;
                
            }
        }

	
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -