Source/AdvTree/Layout/NodeCellLayout.cs
(开头部分) 27KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Drawing;
using DevComponents.DotNetBar;
using System.Collections;
namespace DevComponents.AdvTree
{
namespace Layout
{
/// <summary>
/// Represents class for Node's cell layout.
/// </summary>
internal class CellLayout
{
public CellLayout()
{
}
/// <summary>
/// Offset cell bounds, check box bounds, image bounds and text bounds by specified offset.
/// </summary>
/// <param name="cell">Cell to offset.</param>
/// <param name="x">Horizontal offset in pixels.</param>
/// <param name="y">Vertical offset in pixels.</param>
public void Offset(Cell cell, int x, int y)
{
cell.SetBounds(new Rectangle(cell.BoundsRelative.X+x,cell.BoundsRelative.Y+y,cell.BoundsRelative.Width,cell.BoundsRelative.Height));
if(!cell.CheckBoxBoundsRelative.IsEmpty)
cell.SetCheckBoxBounds(new Rectangle(cell.CheckBoxBoundsRelative.X+x,cell.CheckBoxBoundsRelative.Y+y,cell.CheckBoxBoundsRelative.Width,cell.CheckBoxBoundsRelative.Height));
if(!cell.ImageBoundsRelative.IsEmpty)
cell.SetImageBounds(new Rectangle(cell.ImageBoundsRelative.X+x,cell.ImageBoundsRelative.Y+y,cell.ImageBoundsRelative.Width,cell.ImageBoundsRelative.Height));
if(!cell.TextContentBounds.IsEmpty)
cell.TextContentBounds=new Rectangle(cell.TextContentBounds.X+x,cell.TextContentBounds.Y+y,cell.TextContentBounds.Width,cell.TextContentBounds.Height);
}
public void LayoutSingleCell(LayoutCellInfo info)
{
Size textSize=Size.Empty;
Font font=info.Font;
int height=0;
if(info.LayoutStyle.Font!=null)
font=info.LayoutStyle.Font;
info.ContextCell.OnLayoutCell();
if (info.ContextCell.Images.LargestImageSize.IsEmpty && info.ContextCell.Images.ImageIndex >= 0)
info.ContextCell.Images.RefreshLargestImageSize();
if(info.ContextCell.HostedControl!=null)
{
Size controlSize=info.ContextCell.HostedControl.Size;
if(!info.ContextCell.HostedControlSize.IsEmpty)
controlSize = info.ContextCell.HostedControlSize;
if(info.CellWidth==0)
textSize=new Size(controlSize.Width,controlSize.Height);
else
{
int availTextWidth=info.CellWidth-
ElementStyleLayout.HorizontalStyleWhiteSpace(info.LayoutStyle);
textSize=new Size(availTextWidth,controlSize.Height);
后面还有 632 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。