From 94e4e5b9fd3da964c44b7b14227d6fe2bbb426d7 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期四, 02 四月 2020 13:56:39 +0800
Subject: [PATCH] 2020-04-02-2

---
 ZigbeeApp/Shared/Phone/Device/CommonForm/ButtonLineForm.cs |   48 +++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/ButtonLineForm.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/ButtonLineForm.cs
index 34c6509..78e5035 100755
--- a/ZigbeeApp/Shared/Phone/Device/CommonForm/ButtonLineForm.cs
+++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/ButtonLineForm.cs
@@ -3,7 +3,7 @@
 
 namespace Shared.Phone.Device.CommonForm
 {
-    public class ButtonLineForm:FrameLayout
+    public class ButtonLineForm : FrameLayout
     {
         /// <summary>
         /// name
@@ -12,7 +12,7 @@
         /// <summary>
         /// line
         /// </summary>
-        public Line Line;
+        public Button Line;
         /// <summary>
         /// isSelected
         /// </summary>
@@ -46,14 +46,12 @@
         /// </summary>
         /// <param name="x"></param>
         /// <param name="y"></param>
-        /// <param name="width"></param>
-        /// <param name="height"></param>
-        public ButtonLineForm(int x, int y, int width, int height)
+        public ButtonLineForm(int x, int y)
         {
             X = Application.GetRealWidth(x);
             Y = Application.GetRealHeight(y);
-            Width = Application.GetRealWidth(width);
-            Height = Application.GetRealHeight(height);
+            Width = Application.GetRealWidth(100);
+            Height = Application.GetRealHeight(85);
         }
 
         /// <summary>
@@ -61,14 +59,27 @@
         /// </summary>
         public void Init()
         {
-            NameBtn = new SelectedStatuButton()
+            NameBtn = new Button()
             {
                 Width = Width,
-                Height = Height - 3
+                Height = Height - Application.GetRealHeight(6),
+                TextColor = ZigbeeColor.Current.GXCTextGrayColor4,
+                SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor,
+                TextSize = CommonFormResouce.TextSize,
+                TextAlignment = TextAlignment.CenterLeft
             };
             AddChidren(NameBtn);
 
-            Line = new Line(Height,Width/2,2);
+            Line = new Button
+            {
+                X = 0,
+                Y = Height - Application.GetRealHeight(6),
+                Width = 10,
+                Height = Application.GetRealHeight(6),
+                Radius = (uint)Application.GetRealHeight(6 / 2),
+                BackgroundColor = ZigbeeColor.Current.GXCButtonSelectedColor,
+                Visible = false
+            };
             AddChidren(Line);
         }
 
@@ -79,6 +90,18 @@
         public void SetTitle(string title)
         {
             NameBtn.Text = title;
+            RefreshWidth();
+        }
+
+        /// <summary>
+        /// RefreshWidth
+        /// </summary>
+        public void RefreshWidth()
+        {
+            NameBtn.Width = NameBtn.GetTextWidth() + Application.GetRealWidth(100);
+            Width = NameBtn.Width;
+            Line.X = NameBtn.GetTextWidth() / 4;
+            Line.Width= NameBtn.GetTextWidth() / 2;
         }
 
         /// <summary>
@@ -96,7 +119,10 @@
         /// <param name="statu"></param>
         public void SetStatu(bool statu)
         {
-            NameBtn.IsSelected = Line.IsSelected = statu;
+            NameBtn.IsSelected = Line.Visible = statu;
+            NameBtn.TextSize = statu ? CommonFormResouce.TextSize_Selected : CommonFormResouce.TextSize;
+            NameBtn.IsBold = statu;
+            RefreshWidth();
         }
     }
 }

--
Gitblit v1.8.0