using Shared; using System; using System.Collections.Generic; using System.Text; namespace HDL_ON.Stan { /// <summary> /// åšæˆä¸€ä¸ªåˆ—表型的FrameLayout(它与VerticalListControlåŒä¸€æ€§è´¨,但是它是FrameLayout,它会改å˜é«˜åº¦) /// </summary> public class FrameListControl : FrameLayoutBase { /// <summary> /// è¡Œä¹‹é—´çš„é—´è· /// </summary> public int rowSpace = 0; /// <summary> /// åšæˆä¸€ä¸ªåˆ—表型的FrameLayout(它与VerticalListControlåŒä¸€æ€§è´¨,但是它是FrameLayout,它会改å˜é«˜åº¦) /// </summary> /// <param name="i_rowSpace">行之间的间è·(这个值是与行控件绑定一起使用的)</param> public FrameListControl(int i_rowSpace = 0) { rowSpace = Application.GetRealHeight(i_rowSpace); } /// <summary> /// æ·»åŠ åæŽ§ä»¶ /// </summary> /// <param name="view"></param> public override void AddChidren(View view) { if (view is FrameRowControl || view is RowLayoutControl) { //FrameRowLayout控件的时候,直接扩大它的高度 var intBottom = this.GetLocationMostLastViewBottom(); if (intBottom != -1) { view.Y = intBottom; } base.AddChidren(view); if (rowSpace > 0) { view.Height += rowSpace; } } else { //éžFrameRowLayout控件的时候,è®¡ç®—çš„æ˜¯åæ ‡ var intBottom = this.GetLocationMostLastViewBottom(); if (intBottom != -1) { view.Y = intBottom + rowSpace; } base.AddChidren(view); } } /// <summary> /// 调整真实高度 /// </summary> /// <param name="bottomSpace">底部高度(éžçœŸå®žå€¼)</param> public void AdjustRealHeight(int bottomSpace = 0) { int bottomHeight = -1; for (int i = 0; i < this.ChildrenCount; i++) { var child = this.GetChildren(i); if (child.Bottom > bottomHeight) { bottomHeight = child.Bottom; } } if (bottomHeight != -1) { this.Height = bottomHeight + bottomSpace; } } /// <summary> /// 获å–åæ ‡åº•部最下é¢çš„é‚£ä¸ªæŽ§ä»¶çš„åº•éƒ¨åæ ‡ /// </summary> /// <returns></returns> private int GetLocationMostLastViewBottom() { int bottomHeight = -1; for (int i = 0; i < this.ChildrenCount; i++) { var child = this.GetChildren(i); if (child.Bottom > bottomHeight) { bottomHeight = child.Bottom; } } return bottomHeight; } } }