Source/NavigationPanePanel.cs

(完整代码) 1KB

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>
	/// Represents Panel on Navigation Pane control.
	/// </summary>
	[ToolboxItem(false),Designer(typeof(Design.NavigationPanePanelDesigner))]
	public class NavigationPanePanel:PanelEx
	{
		private BaseItem m_ParentItem;
		private const string INFO_TEXT="Drop controls on this panel to associate them with current selection";
		public NavigationPanePanel()
		{
			
		}

		/// <summary>
		/// Gets or sets button associated with the pane on the panel when hosted on NavigationPane control.
		/// </summary>
		[Browsable(false),DevCoBrowsable(false)]
		public BaseItem ParentItem
		{
			get {return m_ParentItem;}
			set
			{
				m_ParentItem=value;
				if(m_ParentItem!=null && this.Parent is NavigationPane && m_ParentItem is ButtonItem)
				{
					if(((ButtonItem)m_ParentItem).Checked)
					{
						this.Visible=true;
						this.BringToFront();
					}
				}
			}
		}

		protected override void OnPaint(PaintEventArgs e)
		{
			base.OnPaint(e);
			if(this.DesignMode && this.Controls.Count==0 && this.Text=="")
			{
				Rectangle r=this.ClientRectangle;
				r.Inflate(-2,-2);
                eTextFormat sf = eTextFormat.Default | eTextFormat.HorizontalCenter | eTextFormat.VerticalCenter | eTextFormat.EndEllipsis;
				Font font=new Font(this.Font,FontStyle.Bold);
				TextDrawing.DrawString(e.Graphics,INFO_TEXT,font,ControlPaint.Dark(this.Style.BackColor1.Color),r,sf);
				font.Dispose();
			}
		}
	}
}

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

AI 解读 AI

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

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