From f8283c8ebef3e0af8bd990c3e86cc9d010ba528e Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期二, 01 八月 2023 16:37:33 +0800 Subject: [PATCH] 2023年08月01日16:37:16 --- HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs | 140 +++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 137 insertions(+), 3 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs index cc6989e..80ea0ac 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs @@ -5,7 +5,8 @@ { 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; @@ -16,6 +17,7 @@ this.Height = Application.GetMinRealAverage(height); this.Radius = (uint)Application.GetRealHeight(cornerValue); this.BackgroundColor = MusicColor.ViewColor; + this.Gravity = Gravity.CenterHorizontal; } Button btnTop = new Button { @@ -75,15 +77,147 @@ public void AddView(FrameLayout layout) { - layout.AddChidren(this); this.AddChidren(btnTop); this.AddChidren(btnBottom); this.AddChidren(btnLeft); this.AddChidren(btnRight); this.AddChidren(btnOkbj); this.AddChidren(btnOk); - + layout.AddChidren(this); } + + /// <summary> + /// 涓� + /// </summary> + /// <param name="action"></param> + public void SetTopClickListener(Action<Button> action) + { + EventHandler<MouseEventArgs> UpClick = (sender, e) => + { + //btnTop.BackgroundColor = this.UpBackgroundColor; + btnTop.IsSelected = false; + action?.Invoke(btnTop); + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + }; + btnTop.MouseUpEventHandler += UpClick; + + + EventHandler<MouseEventArgs> DownClick = (sender, e) => + { + //鎸変笅鍘绘敼鍙樿儗鏅鑹� + btnTop.BackgroundColor = this.DownBackgroundColor; + }; + btnTop.MouseDownEventHandler += DownClick; + } + + /// <summary> + /// 涓� + /// </summary> + /// <param name="action"></param> + public void SetBottomClickListener(Action<Button> action) + { + EventHandler<MouseEventArgs> UpClick = (sender, e) => + { + //btnBottom.BackgroundColor = this.UpBackgroundColor; + btnBottom.IsSelected = false; + action?.Invoke(btnBottom); + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + }; + btnBottom.MouseUpEventHandler += UpClick; + + + EventHandler<MouseEventArgs> DownClick = (sender, e) => + { + //鎸変笅鍘绘敼鍙樿儗鏅鑹� + btnBottom.BackgroundColor = this.DownBackgroundColor; + }; + btnBottom.MouseDownEventHandler += DownClick; + } + /// <summary> + /// 宸� + /// </summary> + /// <param name="action"></param> + public void SetLeftClickListener(Action<Button> action) + { + EventHandler<MouseEventArgs> UpClick = (sender, e) => + { + //btnLeft.BackgroundColor = this.UpBackgroundColor; + btnLeft.IsSelected = false; + action?.Invoke(btnLeft); + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + }; + btnLeft.MouseUpEventHandler += UpClick; + + + EventHandler<MouseEventArgs> DownClick = (sender, e) => + { + //鎸変笅鍘绘敼鍙樿儗鏅鑹� + btnLeft.BackgroundColor = this.DownBackgroundColor; + }; + btnLeft.MouseDownEventHandler += DownClick; + } + /// <summary> + /// 鍙� + /// </summary> + /// <param name="action"></param> + public void SetRightClickListener(Action<Button> action) + { + EventHandler<MouseEventArgs> UpClick = (sender, e) => + { + //btnRight.BackgroundColor = this.UpBackgroundColor; + btnRight.IsSelected = false; + action?.Invoke(btnRight); + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + }; + btnRight.MouseUpEventHandler += UpClick; + + + EventHandler<MouseEventArgs> DownClick = (sender, e) => + { + //鎸変笅鍘绘敼鍙樿儗鏅鑹� + btnRight.BackgroundColor = this.DownBackgroundColor; + }; + btnRight.MouseDownEventHandler += DownClick; + } + + + + /// <summary> + /// ok + /// </summary> + /// <param name="action"></param> + public void SetOkClickListener(Action<Button> action) + { + EventHandler<MouseEventArgs> UpClick = (sender, e) => + { + btnOk.BackgroundColor = MusicColor.SelectedColor;// this.UpBackgroundColor; + action?.Invoke(btnOk); + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + }; + btnOk.MouseUpEventHandler += UpClick; + + + EventHandler<MouseEventArgs> DownClick = (sender, e) => + { + //鎸変笅鍘绘敼鍙樿儗鏅鑹� + btnOk.BackgroundColor = this.DownBackgroundColor; + }; + btnOk.MouseDownEventHandler += DownClick; + } + + public void SetClickUpBackgroundColor(uint backgroundColor) + { + this.UpBackgroundColor = backgroundColor; + + } + + public void SetClickDownBackgroundColor(uint backgroundColor) + { + this.DownBackgroundColor = backgroundColor; + } + + + } } -- Gitblit v1.8.0