Source/ElementStyleLayout.cs

(开头部分) 8KB

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

using System;
using System.Drawing;
using System.Collections;

#if AdvTree
namespace DevComponents.Tree
#elif DOTNETBAR
namespace DevComponents.DotNetBar
#endif
{
	/// <summary>
	/// Represents the layout for the element style.
	/// </summary>
	internal class ElementStyleLayout
	{
		public ElementStyleLayout()
		{
		}

		/// <summary>
		/// Calculates size of an style element.
		/// </summary>
		/// <param name="style">Style to calculate size for.</param>
		/// <param name="defaultFont">Default font that will be used by style if style does not uses it's own font.</param>
		/// <returns>Size of the style element. At this time only Height memeber will be calculated.</returns>
		public static void CalculateStyleSize(ElementStyle style, Font defaultFont)
		{
			int height=defaultFont.Height;
            ElementStyle s = ElementStyleDisplay.GetElementStyle(style);
			if(s.Font!=null)
				height=s.Font.Height;
			
			if(s.PaintTopBorder)
			{
				height+=s.BorderTopWidth;
			}

			if(s.PaintBottomBorder)
			{
				height+=s.BorderBottomWidth;
			}
			
			height+=(s.MarginTop+style.MarginBottom);
			height+=(s.PaddingTop+s.PaddingBottom);
			
			style.SetSize(new Size(0,height));
		}

		/// <summary>
		/// Returns the total white space for a style. Whitespace is the space between the edge of the element and inner content of the element.
		/// </summary>
		/// <param name="es">Style to return white space for</param>
		/// <returns></returns>
		public static int HorizontalStyleWhiteSpace(ElementStyle es)
		{
			return LeftWhiteSpace(es)+RightWhiteSpace(es);
		}

		/// <summary>
		/// Returns the total white space for a style. Whitespace is the space between the edge of the element and inner content of the element.
后面还有 193 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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