Source/ItemContainer.cs

(开头部分) 9KB

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

using System;
using System.ComponentModel.Design;
using System.Drawing;
using System.ComponentModel;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using DevComponents.UI.ContentManager;

namespace DevComponents.DotNetBar
{
	/// <summary>
	/// Represents item container that arranges items horizontally or vertically.
	/// </summary>
	[ToolboxItem(false),DesignTimeVisible(false),Designer(typeof(ItemContainerDesigner))]
	public class ItemContainer:ImageItem , IDesignTimeProvider
	{
		#region Private Variables & Constructor
		private eOrientation m_LayoutOrientation=eOrientation.Horizontal;
		private Size m_EmptyDesignTimeSize=new Size(24,24);
		private bool m_SystemContainer=false;
		
		/// <summary>
		/// Creates new instance of the ItemContainer object.
		/// </summary>
		public ItemContainer()
		{
			m_IsContainer=true;
			this.AutoCollapseOnClick=true;
			this.AccessibleRole=System.Windows.Forms.AccessibleRole.Grouping;
		}
		#endregion

		#region Internal Implementation
		/// <summary>
		/// Must be overriden by class that is inheriting to provide the painting for the item.
		/// </summary>
		public override void Paint(ItemPaintArgs p)
		{
			ItemDisplay display=GetItemDisplay();
			display.Paint(this,p);

			if(this.DesignMode && !this.SystemContainer && p.DesignerSelection)
			{
				Graphics g=p.Graphics;
				Rectangle r=this.DisplayRectangle;
				using(Pen pen=new Pen(Color.FromArgb(120,Color.Red),1))
				{
					pen.DashStyle=DashStyle.Dash;
					Display.DrawRoundedRectangle(g,pen,r,3);
				}

				Image image=BarFunctions.LoadBitmap("SystemImages.AddMoreItemsContainer.png");
				g.DrawImageUnscaled(image,r.X+1,r.Y+1);
				return;
			}
		}

		/// <summary>
		/// Recalcualtes the size of the container. Assumes that DisplayRectangle.Location is set to the upper left location of this container.
后面还有 244 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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