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/NumberFrameLayout.cs | 111 ++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 85 insertions(+), 26 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/NumberFrameLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/NumberFrameLayout.cs index b5dea73..2775a50 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/NumberFrameLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/NumberFrameLayout.cs @@ -8,7 +8,9 @@ public NumberFrameLayout() { } - + private uint UpBackgroundColor = MusicColor.WhiteColor; + private uint DownBackgroundColor = 0xff454635; + private Action<Button> action = null; public FrameLayout layout = new FrameLayout { @@ -48,9 +50,6 @@ TextAlignment = TextAlignment.Center, IsBold = true, }; - - - Button btn4 = new Button { Width = Application.GetRealWidth(78), @@ -134,9 +133,31 @@ IsBold = true, }; - ButtonFramLayout pdjiaFramLayout = new ButtonFramLayout(); + Button btn_jia = new Button + { + Width = Application.GetRealWidth(78), + Height = Application.GetRealHeight(84), + TextID = StringId.pindaojia, + TextSize = TextSize.Text20, + TextColor = MusicColor.TextColor, + TextAlignment = TextAlignment.Center, + IsBold = true, - ButtonFramLayout pdjianFramLayout = new ButtonFramLayout(); + + }; + + Button btn_jian = new Button + { + Width = Application.GetRealWidth(78), + Height = Application.GetRealHeight(84), + TextID = StringId.pindaojian, + TextSize = TextSize.Text20, + TextColor = MusicColor.TextColor, + TextAlignment = TextAlignment.Center, + IsBold = true, + + + }; /// <summary> /// 娣诲姞甯冨眬 @@ -156,8 +177,8 @@ layout.AddChidren(btn9); layout.AddChidren(btn0); layout.AddChidren(btn); - layout.AddChidren(pdjiaFramLayout); - layout.AddChidren(pdjianFramLayout); + layout.AddChidren(btn_jia); + layout.AddChidren(btn_jian); btn1.Y = Application.GetRealHeight(16); btn1.X = Application.GetRealWidth(16); @@ -165,14 +186,8 @@ btn2.X = btn1.Right; btn3.Y = Application.GetRealHeight(16); btn3.X = btn2.Right; - pdjiaFramLayout.AddImageView(); - pdjiaFramLayout.AddNameView(); - pdjiaFramLayout.Y = Application.GetRealHeight(16); - pdjiaFramLayout.GetImageButton().Height = Application.GetRealHeight(32); - pdjiaFramLayout.GetImageButton().Width = Application.GetRealWidth(32); - pdjiaFramLayout.GetImageButton().UnSelectedImagePath = "AksIcon/pindao1.png"; - pdjiaFramLayout.GetNameButton().TextID = StringId.pindaojia; - pdjiaFramLayout.X = btn3.Right; + btn_jia.Y = Application.GetRealHeight(16); + btn_jia.X = btn3.Right; btn4.Y = btn1.Bottom; btn4.X = Application.GetRealWidth(16); @@ -180,14 +195,8 @@ btn5.X = btn4.Right; btn6.Y = btn3.Bottom; btn6.X = btn5.Right; - pdjianFramLayout.AddImageView(); - pdjianFramLayout.AddNameView(); - pdjianFramLayout.Y = pdjiaFramLayout.Bottom; - pdjianFramLayout.GetImageButton().Height = Application.GetRealHeight(32); - pdjianFramLayout.GetImageButton().Width = Application.GetRealWidth(32); - pdjianFramLayout.GetImageButton().UnSelectedImagePath = "AksIcon/pindao2.png"; - pdjianFramLayout.GetNameButton().TextID = StringId.pindaojian; - pdjianFramLayout.X = btn6.Right; + btn_jian.Y = btn_jia.Bottom; + btn_jian.X = btn6.Right; btn7.Y = btn6.Bottom; btn7.X = Application.GetRealWidth(16); @@ -195,14 +204,64 @@ btn8.X = btn7.Right; btn9.Y = btn6.Bottom; btn9.X = btn8.Right; - btn.Y = pdjianFramLayout.Bottom; + btn.Y = btn_jian.Bottom; btn.X = btn9.Right; btn0.Y = btn8.Bottom; btn0.X = Application.GetRealWidth(16 + 78); + btn1.MouseDownEventHandler += (sen, e) => ClickListener(btn1); + + btn2.MouseDownEventHandler += (sen, e) => ClickListener(btn2); + + btn3.MouseDownEventHandler += (sen, e) => ClickListener(btn3); + + btn4.MouseDownEventHandler += (sen, e) => ClickListener(btn4); + + btn5.MouseDownEventHandler += (sen, e) => ClickListener(btn5); + + btn6.MouseDownEventHandler += (sen, e) => ClickListener(btn6); + + btn7.MouseDownEventHandler += (sen, e) => ClickListener(btn7); + + btn8.MouseDownEventHandler += (sen, e) => ClickListener(btn8); + + btn9.MouseDownEventHandler += (sen, e) => ClickListener(btn9); + + btn0.MouseDownEventHandler += (sen, e) => ClickListener(btn0); + + btn.MouseDownEventHandler += (sen, e) => ClickListener(btn); + + btn_jia.MouseDownEventHandler += (sen, e) => ClickListener(btn_jia); + + btn_jian.MouseDownEventHandler += (sen, e) => ClickListener(btn_jian); + + } - + + private void ClickListener(Button button) + { + if (button == null) + { + return; + } + button.BackgroundColor = DownBackgroundColor; + action?.Invoke(button); + button.MouseUpEventHandler += (sen, e) => + { + button.BackgroundColor = UpBackgroundColor; + }; + } + + + /// <summary> + /// 浜嬩欢鐩戝惉鏂规硶 + /// </summary> + /// <param name="action">鍥炶皟(鐐瑰嚮鎺т欢瀵硅薄</param> + public void SetClickListener(Action<Button> action) + { + this.action = action; + } } } -- Gitblit v1.8.0