From e498e61b5a77c6ba55e761cdb90071096183b9c5 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 01 二月 2021 16:07:00 +0800 Subject: [PATCH] Update .gitignore --- HDL_ON/UI/UI0-Stan/Controls/CompoundControls/BatteryPersentControl.cs | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 97 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI0-Stan/Controls/CompoundControls/BatteryPersentControl.cs b/HDL_ON/UI/UI0-Stan/Controls/CompoundControls/BatteryPersentControl.cs new file mode 100755 index 0000000..bf88dae --- /dev/null +++ b/HDL_ON/UI/UI0-Stan/Controls/CompoundControls/BatteryPersentControl.cs @@ -0,0 +1,97 @@ +锘縰sing Shared; +using HDL_ON.UI.CSS; +using System; +using System.Collections.Generic; +using System.Text; + +namespace HDL_ON.Stan +{ + /// <summary> + /// 鐢垫睜鐧惧垎姣旀帶浠� + /// </summary> + public class BatteryPersentControl : NormalFrameLayout + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 鐢垫睜鐧惧垎姣旀樉绀虹殑鍊� + /// </summary> + private NormalViewControl btnBatteryView = null; + /// <summary> + /// 杩涘害鏉� + /// </summary> + private NormalViewControl btnProgress = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢垫睜鐧惧垎姣旀帶浠� + /// </summary> + public BatteryPersentControl() + { + //浠ュ浘鐗囩殑璁$畻鏂规硶璁$畻楂樺害 + this.Height = this.GetPictrueRealSize(25); + this.Width = this.GetPictrueRealSize(24) + Application.GetRealWidth(30 + 4); + } + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + public void InitControl() + { + var btnIcon = new IconViewControl(24); + btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/Battery.png"; + this.AddChidren(btnIcon); + + //鐢垫睜鐧惧垎姣� + this.btnBatteryView = new NormalViewControl(30, 16, true); + btnBatteryView.X = btnIcon.Right + Application.GetRealWidth(4); + btnBatteryView.Y = btnIcon.Y + (btnIcon.Height - Application.GetRealHeight(16)) / 2; + btnBatteryView.TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel; + btnBatteryView.TextColor = CSS_Color.PromptingColor1; + this.AddChidren(btnBatteryView); + + //杩涘害鏉℃帶浠� + this.btnProgress = new NormalViewControl(this.GetPictrueRealSize(15), this.GetPictrueRealSize(8), false); + btnProgress.X = this.GetPictrueRealSize(4); + btnProgress.Gravity = Gravity.CenterVertical; + btnProgress.BackgroundColor = CSS_Color.PromptingColor1; + this.AddChidren(btnProgress); + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鐧惧垎姣斿�� + /// </summary> + /// <param name="i_value"></param> + public void SetValue(decimal i_value) + { + int myWidth = (int)((i_value / 100) * this.GetPictrueRealSize(15)); + this.btnBatteryView.Text = i_value + "%"; + this.btnProgress.Width = myWidth; + if (i_value <= 20) + { + if (this.btnProgress.BackgroundColor == CSS_Color.PromptingColor1) + { + //鍙樼孩鑹� + this.btnProgress.BackgroundColor = 0xfff62f48; + } + } + else + { + if (this.btnProgress.BackgroundColor == 0xfff62f48) + { + //鍙樼孩鑹� + this.btnProgress.BackgroundColor = CSS_Color.PromptingColor1; + } + } + } + + #endregion + } +} -- Gitblit v1.8.0