From 5ec581e5d37b108fc9d59e89afd8e94e21b32080 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期二, 17 十月 2023 17:33:36 +0800 Subject: [PATCH] 2023年10月17日17:33:33 --- HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs | 191 +++++++++++++++++++++++++++++++++-------------- 1 files changed, 133 insertions(+), 58 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs index aaec10b..dba07fc 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs @@ -6,90 +6,129 @@ { public class MenuFramLayout : BaseFramLayout { - private uint UpBackgroundColor = 0x00000000; - private uint DownBackgroundColor = 0xff454635; public const int widthFrameLayout = 180; public const int heightFrameLayout = 180; public const int cornerValue = 90; public MenuFramLayout(int width = widthFrameLayout, int height = heightFrameLayout) { - this.Width = Application.GetMinRealAverage(width); - this.Height = Application.GetMinRealAverage(height); - this.Radius = (uint)Application.GetRealHeight(cornerValue); + this.Width = Application.GetRealWidth(width); + this.Height = Application.GetRealWidth(height); + this.Radius = (uint)Application.GetRealWidth(cornerValue); this.BackgroundColor = MusicColor.ViewColor; this.Gravity = Gravity.CenterHorizontal; } Button btnTop = new Button { - Y = Application.GetMinRealAverage(16), - X = Application.GetMinRealAverage(78), - Width = Application.GetRealWidth(24), - Height = Application.GetRealHeight(20), + Y = Application.GetRealWidth(16), + X = Application.GetRealWidth(78), + Width = Application.GetRealWidth(24),//楂樺害鍜屽楂樹笉涓�鏍�,浠ュ搴︿负缁村害璁$畻,鍚﹀垯鍙樺舰 + Height = Application.GetRealWidth(20), UnSelectedImagePath = "AksIcon/shang.png", - Name= "涓�", + SelectedImagePath = "AksIcon/shang_selected.png", + Name = "涓�", + }; + + Button btnTopClick = new Button + { + X = Application.GetRealWidth(52), + Width = Application.GetRealWidth(76), + Height = Application.GetRealHeight(40), }; Button btnBottom = new Button { - Y = Application.GetMinRealAverage(144), - X = Application.GetMinRealAverage(78), + Y = Application.GetRealWidth(144), + X = Application.GetRealWidth(78), Width = Application.GetRealWidth(24), - Height = Application.GetRealHeight(20), + Height = Application.GetRealWidth(20), UnSelectedImagePath = "AksIcon/xia.png", + SelectedImagePath = "AksIcon/xia_selected.png", Name = "涓�", + }; + Button btnBottomClick = new Button + { + Y = Application.GetRealWidth(128), + X = Application.GetRealWidth(52), + Width = Application.GetRealWidth(76), + Height = Application.GetRealHeight(52), }; Button btnLeft = new Button { - Y = Application.GetMinRealAverage(78), - X = Application.GetMinRealAverage(16), + Y = Application.GetRealWidth(78), + X = Application.GetRealWidth(16), Width = Application.GetRealWidth(20), - Height = Application.GetRealHeight(24), + Height = Application.GetRealWidth(24), UnSelectedImagePath = "AksIcon/zuo.png", + SelectedImagePath = "AksIcon/zuo_selected.png", Name = "宸�", + + }; + + Button btnLeftClick = new Button + { + Y = Application.GetRealWidth(52), + Width = Application.GetRealWidth(52), + Height = Application.GetRealHeight(76), }; Button btnRight = new Button { - Y = Application.GetMinRealAverage(78), - X = Application.GetMinRealAverage(144), + Y = Application.GetRealWidth(78), + X = Application.GetRealWidth(144), Width = Application.GetRealWidth(20), - Height = Application.GetRealHeight(24), + Height = Application.GetRealWidth(24), UnSelectedImagePath = "AksIcon/you.png", + SelectedImagePath = "AksIcon/you_selected.png", Name = "鍙�", + + }; + + Button btnRightClick = new Button + { + X = Application.GetRealWidth(128), + Y = Application.GetRealWidth(52), + Width = Application.GetRealWidth(52), + Height = Application.GetRealHeight(76), }; Button btnOkbj = new Button { - Y = Application.GetMinRealAverage(52), - X = Application.GetMinRealAverage(52), - Width = Application.GetMinRealAverage(76), - Height = Application.GetMinRealAverage(76), - Radius = (uint)Application.GetRealHeight(38), + Gravity = Gravity.Center, + Width = Application.GetRealWidth(76), + Height = Application.GetRealWidth(76), + Radius = (uint)Application.GetRealWidth(38), BackgroundColor = MusicColor.WhiteColor, }; Button btnOk = new Button { - Y = Application.GetMinRealAverage(76), - X = Application.GetMinRealAverage(76), - Width = Application.GetMinRealAverage(28), - Height = Application.GetMinRealAverage(28), - Radius = (uint)Application.GetRealHeight(14), - BackgroundColor = MusicColor.SelectedColor, - Name= "纭畾" + Gravity = Gravity.Center, + Width = Application.GetRealWidth(28), + Height = Application.GetRealWidth(28), + Radius = (uint)Application.GetRealWidth(14), + BackgroundColor = 0xff1B2D4D, + SelectedBackgroundColor = MusicColor.SelectedColor, + Name = "纭畾" }; public void AddView(FrameLayout layout) { this.AddChidren(btnTop); + this.AddChidren(btnTopClick); this.AddChidren(btnBottom); + this.AddChidren(btnBottomClick); this.AddChidren(btnLeft); + this.AddChidren(btnLeftClick); this.AddChidren(btnRight); + this.AddChidren(btnRightClick); this.AddChidren(btnOkbj); this.AddChidren(btnOk); + + layout.AddChidren(this); + //btnBottom.Y = btnOkbj.Bottom + Application.GetRealWidth(16); } @@ -101,23 +140,32 @@ { EventHandler<MouseEventArgs> UpClick = (sender, e) => { - //btnTop.BackgroundColor = this.UpBackgroundColor; - btnTop.IsSelected = false; KeypadEntity keypadEntity = new KeypadEntity(); keypadEntity.name = btnTop.Name; keypadEntity.keypad = "key_up"; action?.Invoke(keypadEntity); + btnTop.IsSelected = false; //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� }; btnTop.MouseUpEventHandler += UpClick; + btnTopClick.MouseUpEventHandler += UpClick; EventHandler<MouseEventArgs> DownClick = (sender, e) => { //鎸変笅鍘绘敼鍙樿儗鏅鑹� - btnTop.BackgroundColor = this.DownBackgroundColor; + btnTop.IsSelected = true; }; btnTop.MouseDownEventHandler += DownClick; + btnTopClick.MouseDownEventHandler += DownClick; + + EventHandler<MouseEventArgs> OutsideClick = (sender, e) => + { + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + btnTop.IsSelected = false; + }; + btnTop.MouseUpOutsideEventHandler += OutsideClick; + btnTopClick.MouseUpOutsideEventHandler += OutsideClick; } /// <summary> @@ -128,23 +176,36 @@ { EventHandler<MouseEventArgs> UpClick = (sender, e) => { - //btnBottom.BackgroundColor = this.UpBackgroundColor; - btnBottom.IsSelected = false; KeypadEntity keypadEntity = new KeypadEntity(); keypadEntity.name = btnBottom.Name; keypadEntity.keypad = "key_down"; action?.Invoke(keypadEntity); + btnBottom.IsSelected = false; //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� }; btnBottom.MouseUpEventHandler += UpClick; + btnBottomClick.MouseUpEventHandler += UpClick; EventHandler<MouseEventArgs> DownClick = (sender, e) => { + btnBottom.IsSelected = true; + //鎸変笅鍘绘敼鍙樿儗鏅鑹� - btnBottom.BackgroundColor = this.DownBackgroundColor; }; btnBottom.MouseDownEventHandler += DownClick; + btnBottomClick.MouseDownEventHandler += DownClick; + + + EventHandler<MouseEventArgs> OutsideClick = (sender, e) => + { + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + btnBottom.IsSelected = false; + }; + btnBottom.MouseUpOutsideEventHandler += OutsideClick; + btnBottomClick.MouseUpOutsideEventHandler += OutsideClick; + + } /// <summary> /// 宸� @@ -154,23 +215,33 @@ { EventHandler<MouseEventArgs> UpClick = (sender, e) => { - //btnLeft.BackgroundColor = this.UpBackgroundColor; - btnLeft.IsSelected = false; KeypadEntity keypadEntity = new KeypadEntity(); keypadEntity.name = btnLeft.Name; keypadEntity.keypad = "key_left"; action?.Invoke(keypadEntity); + btnLeft.IsSelected = false; //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� }; btnLeft.MouseUpEventHandler += UpClick; + btnLeftClick.MouseUpEventHandler += UpClick; EventHandler<MouseEventArgs> DownClick = (sender, e) => { + btnLeft.IsSelected = true; //鎸変笅鍘绘敼鍙樿儗鏅鑹� - btnLeft.BackgroundColor = this.DownBackgroundColor; }; btnLeft.MouseDownEventHandler += DownClick; + btnLeftClick.MouseDownEventHandler += DownClick; + + EventHandler<MouseEventArgs> OutsideClick = (sender, e) => + { + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + btnLeft.IsSelected = false; + }; + btnLeft.MouseUpOutsideEventHandler += OutsideClick; + btnLeftClick.MouseUpOutsideEventHandler += OutsideClick; + } /// <summary> /// 鍙� @@ -180,23 +251,33 @@ { EventHandler<MouseEventArgs> UpClick = (sender, e) => { - //btnRight.BackgroundColor = this.UpBackgroundColor; - btnRight.IsSelected = false; KeypadEntity keypadEntity = new KeypadEntity(); keypadEntity.name = btnRight.Name; keypadEntity.keypad = "key_right"; action?.Invoke(keypadEntity); + btnRight.IsSelected = false; //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� }; btnRight.MouseUpEventHandler += UpClick; + btnRightClick.MouseUpEventHandler += UpClick; EventHandler<MouseEventArgs> DownClick = (sender, e) => { //鎸変笅鍘绘敼鍙樿儗鏅鑹� - btnRight.BackgroundColor = this.DownBackgroundColor; + btnRight.IsSelected = true; + }; btnRight.MouseDownEventHandler += DownClick; + btnRightClick.MouseDownEventHandler += DownClick; + + EventHandler<MouseEventArgs> OutsideClick = (sender, e) => + { + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + btnRight.IsSelected = false; + }; + btnRight.MouseUpOutsideEventHandler += OutsideClick; + btnRightClick.MouseUpOutsideEventHandler += OutsideClick; } @@ -209,11 +290,11 @@ { EventHandler<MouseEventArgs> UpClick = (sender, e) => { - btnOk.BackgroundColor = MusicColor.SelectedColor;// this.UpBackgroundColor; KeypadEntity keypadEntity = new KeypadEntity(); keypadEntity.name = btnOk.Name; keypadEntity.keypad = "key_ok"; action?.Invoke(keypadEntity); + btnOk.IsSelected = false; //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� }; btnOk.MouseUpEventHandler += UpClick; @@ -221,24 +302,18 @@ EventHandler<MouseEventArgs> DownClick = (sender, e) => { + btnOk.IsSelected = true; //鎸変笅鍘绘敼鍙樿儗鏅鑹� - btnOk.BackgroundColor = this.DownBackgroundColor; }; btnOk.MouseDownEventHandler += DownClick; + + EventHandler<MouseEventArgs> OutsideClick = (sender, e) => + { + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + btnOk.IsSelected = false; + }; + btnOk.MouseUpOutsideEventHandler += OutsideClick; } - - public void SetClickUpBackgroundColor(uint backgroundColor) - { - this.UpBackgroundColor = backgroundColor; - - } - - public void SetClickDownBackgroundColor(uint backgroundColor) - { - this.DownBackgroundColor = backgroundColor; - } - - } } -- Gitblit v1.8.0