From 36540bdc906f402f4c55cc7460b6facfd344a793 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期五, 04 八月 2023 14:55:14 +0800 Subject: [PATCH] 2023年08月04日14:55:04 --- HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs | 148 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 140 insertions(+), 8 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs index be71892..443c3e0 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs @@ -33,15 +33,13 @@ /// </summary> /// <param name="width">瀹瑰櫒瀹藉害</param> /// <param name="height">瀹瑰櫒楂樺害</param> - ///<param name="rowNumber">涓�琛屽嚑涓厓绱�</param> ///<param name="rowNumber">鍦嗚鍊�</param> - public CornerFramLayout(int width, int height, int rowNumber = 0, int radius = 0) + public CornerFramLayout(int width, int height, int radius = 0) { this.BackgroundColor = MusicColor.WhiteColor; this.Width = Application.GetRealWidth(width); this.Height = Application.GetRealHeight(height); this.Radius = (uint)Application.GetRealHeight(radius); - this.mRowNumber = rowNumber; } @@ -95,14 +93,15 @@ /// <summary> /// 鍔ㄦ�佸姞杞芥寜閿晫闈� - /// (娉ㄦ剰:mRowNumber!=0) /// </summary> - public void LoadButtonPage() + /// <param name="mRowNumber">涓�琛屽灏戜釜鍏冪礌</param> + public void LoadButtonPage(int mRowNumber) { - if (this.mRowNumber == 0) + if (mRowNumber == 0) { return; } + this.mRowNumber = mRowNumber; int line = 0; int xCount = 0; for (int i = 1; i <= this.mList.Count; i++) @@ -219,16 +218,117 @@ } } + /// <summary> + ///鍔ㄦ�佸姞杞芥暟瀛楁寜閿晫闈� + /// </summary> + public void LoadNumberButtonPage() + { + int currnetheightValue = 0; + int currnetWidthValue = 0; + int heightMaxValue = 84; + int widthMaxValue = 78; + //鑾峰彇鐩稿涓�涓含搴﹀�� + int heightDimensionValue = this.Height - Application.GetRealHeight(this.topMargin) - Application.GetRealHeight(this.bottomMargin) - Application.GetRealHeight(heightMaxValue / 2); + int widthDimensionValue = this.Width - Application.GetRealWidth(this.leftMargin) - Application.GetRealWidth(this.rightMargin) - Application.GetRealHeight(widthMaxValue / 2); + for (int i = 1; i <= this.GetNumberTextList().Count; i++) + { + var d = this.GetNumberTextList()[i - 1]; + Button button = new Button + { + Y = Application.GetRealHeight(this.topMargin) + Application.GetRealHeight(currnetheightValue), + X = Application.GetRealWidth(this.leftMargin) + Application.GetRealWidth(currnetWidthValue), + Width = Application.GetRealWidth(widthMaxValue), + Height = Application.GetRealHeight(heightMaxValue), + Text = d, + TextSize = TextSize.Text20, + TextColor = MusicColor.TextColor, + TextAlignment = TextAlignment.Center, + IsBold = true, + Tag = d, + BackgroundColor = MusicColor.WhiteColor, + SelectedBackgroundColor = 0xff454635, + }; + this.AddChidren(button); + + currnetWidthValue += widthMaxValue; + if (widthDimensionValue < Application.GetRealWidth(currnetWidthValue)) + { + currnetheightValue += heightMaxValue; + currnetWidthValue = 0; + } + button.MouseDownEventHandler += (sen, e) => + { + if (button.Tag == null || string.IsNullOrEmpty(button.Tag.ToString())) + { + return; + } + button.IsSelected = true; + selectAction?.Invoke(button.Tag.ToString()); + }; + button.MouseUpEventHandler += (sen, e) => + { + button.IsSelected = false; + }; + + //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) + //{ + // selectAction?.Invoke((int)buttonFram.Tag); + //} + } + } /// <summary> /// 鍔ㄦ�佸姞杞藉浘鐗囩晫闈� /// </summary> public void LoadImagePage() { - if (this.mRowNumber == 0) + int currnetheightValue = 0; + int currnetWidthValue = 0; + int heightMaxValue = ImageFramlayout.heightFrameLayout; + int widthMaxValue = ImageFramlayout.widthFrameLayout; + //鑾峰彇鐩稿涓�涓含搴﹀�� + int heightDimensionValue = this.Height - Application.GetRealHeight(this.topMargin) - Application.GetRealHeight(this.bottomMargin) - Application.GetRealHeight(heightMaxValue / 2); + int widthDimensionValue = this.Width - Application.GetRealWidth(this.leftMargin) - Application.GetRealWidth(this.rightMargin) - Application.GetRealHeight(widthMaxValue / 2); + for (int i = 1; i <= this.mList.Count; i++) + { + var d = this.mList[i - 1]; + ImageFramlayout imageFram = new ImageFramlayout(); + imageFram.AddView(this); + imageFram.Tag = d; + imageFram.Y = Application.GetRealHeight(this.topMargin) + Application.GetRealHeight(currnetheightValue); + imageFram.X = Application.GetRealWidth(currnetWidthValue); + imageFram.btnName.Text = d; + currnetWidthValue += (widthMaxValue + 8);//8鏄殧闂村�� + if (widthDimensionValue < Application.GetRealWidth(currnetWidthValue)) + { + currnetheightValue += (heightMaxValue + 20);//20鏄殧闂村�� + currnetWidthValue = 0; + } + + imageFram.SetClickListener((fl) => + { + if (imageFram.Tag != null) + { + selectAction?.Invoke(imageFram.Tag.ToString()); + } + }); + //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) + //{ + // selectAction?.Invoke((int)imageFram.Tag); + //} + } + } + /// <summary> + /// 鍔ㄦ�佸姞杞藉浘鐗囩晫闈� + /// </summary> + /// <param name="mRowNumber">涓�琛屽灏戜釜鍏冪礌</param> + public void LoadImagePage(int mRowNumber) + { + if (mRowNumber == 0) { return; } + this.mRowNumber = mRowNumber; int line = 0; int xCount = 0; for (int i = 1; i <= this.mList.Count; i++) @@ -281,6 +381,10 @@ /// <returns></returns> private bool IsLastColumn(int index) { + if (this.mRowNumber == 0 || this.mList == null || this.mList.Count == 0) + { + return false; + } int lineCount = this.mList.Count / this.mRowNumber;//寰楀嚭琛屾暟 int number = this.mList.Count % this.mRowNumber; if (number != 0) @@ -300,7 +404,6 @@ } return false; - } /// <summary> /// 鏈�鍚庡彸杈归偅涓�涓� @@ -309,6 +412,10 @@ /// <returns></returns> private bool IsLastRight(int value) { + if (this.mRowNumber == 0) + { + return false; + } if (value % this.mRowNumber == 0) { return true; @@ -352,5 +459,30 @@ button.Width = width; } + + + + public List<string> GetNumberTextList() + { + return new List<string> + { + "1", + "2", + "3", + Language.StringByID(StringId.pindaojia), + "4", + "5", + "6", + Language.StringByID(StringId.pindaojian), + "7", + "8", + "9", + "-/--", + "",//杩欎釜鏄负浜嗗崰浣嶇疆 + "0" + + }; + + } } } -- Gitblit v1.8.0