Source/Ribbon/SimpleElementLayout.cs
(开头部分) 10KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Drawing;
namespace DevComponents.DotNetBar
{
/// <summary>
/// Summary description for SimpleElementLayout.
/// </summary>
internal class SimpleElementLayout
{
internal static void LayoutSimpleElement(SimpleElementLayoutInfo info)
{
Size textSize=Size.Empty;
Font font=info.Font;
int height=0;
if(info.LayoutStyle.Font!=null)
font=info.LayoutStyle.Font;
// Calculate Text Width and Height
if(info.Element.FixedWidth==0)
{
if(info.Element.TextVisible)
{
string text=info.Element.Text;
if(text!="")
{
textSize=TextDrawing.MeasureString(info.Graphics,text,font);
//textSize=info.Graphics.MeasureString(text,font);
if (info.LayoutStyle != null && !info.LayoutStyle.TextShadowColor.IsEmpty && !info.LayoutStyle.TextShadowOffset.IsEmpty)
textSize.Height += info.LayoutStyle.TextShadowOffset.Y;
}
}
}
else
{
int availTextWidth=info.Element.FixedWidth-
ElementStyleLayout.HorizontalStyleWhiteSpace(info.LayoutStyle);
if(info.Element.ImageVisible)
availTextWidth-=info.Element.ImageLayoutSize.Width;
if(info.Element.TextVisible)
{
int elementHeight=font.Height;
if (info.LayoutStyle != null && !info.LayoutStyle.TextShadowColor.IsEmpty && !info.LayoutStyle.TextShadowOffset.IsEmpty)
elementHeight += info.LayoutStyle.TextShadowOffset.Y;
if(info.LayoutStyle.WordWrap)
{
elementHeight=info.LayoutStyle.MaximumHeight-info.LayoutStyle.MarginTop-
info.LayoutStyle.MarginBottom-info.LayoutStyle.PaddingTop-info.LayoutStyle.PaddingBottom;
if(availTextWidth>0)
{
if(elementHeight>0)
{
textSize=TextDrawing.MeasureString(info.Graphics,info.Element.Text,font,new Size(availTextWidth,elementHeight),info.LayoutStyle.TextFormat);
}
else
textSize=TextDrawing.MeasureString(info.Graphics,info.Element.Text,font,availTextWidth,info.LayoutStyle.TextFormat);
}
后面还有 292 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。