Source/TabControlDesigner.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using System.Collections;
using System.Drawing;
using System.ComponentModel.Design;
using System.ComponentModel;

namespace DevComponents.DotNetBar
{
	/// <summary>
	/// Summary description for TabControlDesigner.
	/// </summary>
	public class TabControlDesigner:TabStripDesigner
	{
		public TabControlDesigner()
		{
		}

		protected override void CreateNewTab(object sender, EventArgs e)
		{
			IDesignerHost dh=(IDesignerHost)GetService(typeof(IDesignerHost));
			TabControl tabControl=this.Control as TabControl;
			if(tabControl==null || dh==null)
				return;

			IComponentChangeService change=this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
			if(change!=null)
				change.OnComponentChanging(this.Component,null);

			TabItem tab=dh.CreateComponent(typeof(TabItem)) as TabItem;
			tab.Text=tab.Name;

			TabControlPanel panel=dh.CreateComponent(typeof(TabControlPanel)) as TabControlPanel;
			tabControl.ApplyDefaultPanelStyle(panel);
			tab.AttachedControl=panel;
			panel.TabItem=tab;
			
			tabControl.Tabs.Add(tab);
			tabControl.Controls.Add(panel);
			panel.Dock=DockStyle.Fill;
			panel.SendToBack();
			
			tabControl.RecalcLayout();

			if(change!=null)
				change.OnComponentChanged(this.Component,null,null,null);

			if(change!=null)
			{
				change.OnComponentChanging(panel,null);
				change.OnComponentChanged(panel,null,null,null);
			}
		}

		public override bool CanParent(Control c)
		{
			if(c is TabControlPanel)
				return true;
			return false;
后面还有 70 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。