From 9cc8fd11b13813adbdd3c6c31554e5c0bebf4026 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期五, 21 八月 2020 19:53:49 +0800 Subject: [PATCH] 发布到商店的版本 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs | 98 +++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 86 insertions(+), 12 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs index eba0af0..f14f176 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs @@ -12,6 +12,10 @@ #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> + /// 杩涘害鍊兼敼鍙�,濡傛灉瑕佽缃垵濮嬭繘搴﹀��,姝ゅ彉閲忚鍦ㄨ缃垵濮嬭繘搴﹀�间箣鍓嶈繘琛岃缃�(绗竴涓弬鏁�0:婊戝姩鐨勬椂鍊�,1:鎵嬫寚寮硅捣鐨勬椂鍊�) + /// </summary> + public Action<int, int> ProgressChangedEvent = null; + /// <summary> /// 杩涘害鏉″彲鐢ㄦ椂鐨勮儗鏅壊 /// </summary> private uint ProgressBarEnableColor = 0; @@ -60,18 +64,48 @@ } } + private int m_SeekBarPadding = Application.GetRealWidth(20); /// <summary> - /// 杩涘害鍊兼敼鍙�,濡傛灉瑕佽缃垵濮嬭繘搴﹀��,姝ゅ彉閲忚鍦ㄨ缃垵濮嬭繘搴﹀�间箣鍓嶈繘琛岃缃�(绗竴涓弬鏁�0:婊戝姩鐨勬椂鍊�,1:鎵嬫寚寮硅捣鐨勬椂鍊�) + /// 杩涘害鏉′笌宸﹀彸涓よ竟鐨勮竟妗嗙殑杈硅窛(閲嶅啓搴曞眰灞炴��) /// </summary> - public Action<int, int> ProgressChangedEvent = null; + public new int SeekBarPadding + { + set + { + m_SeekBarPadding = value; + base.SeekBarPadding = value; + } + } + + private int m_MaxValue = 0; /// <summary> - /// 杩涘害鏉′簨浠剁殑瑙﹀彂鏃堕棿闂撮殧(榛樿娌℃湁闂撮殧,鍗曚綅涓烘绉�) + /// 杩涘害鏉℃渶澶у��(閲嶅啓搴曞眰灞炴��) /// </summary> - public int EventWaitTime = -1; + public new int MaxValue + { + set + { + m_MaxValue = value; + base.MaxValue = value; + } + } + + private int m_MinValue = 0; /// <summary> - /// 鍓嶅洖鏃堕棿 + /// 杩涘害鏉℃渶灏忓��(閲嶅啓搴曞眰灞炴��) /// </summary> - private DateTime oldTime = DateTime.Now; + public new int MinValue + { + set + { + m_MinValue = value; + base.MinValue = value; + } + } + /// <summary> + /// 涓婃柟鏄剧ず鐨勬枃鏈� + /// </summary> + private NormalViewControl btnTopView = null; #endregion @@ -119,12 +153,6 @@ this.OnProgressChangedEvent -= this.MyProgressChangedEvent; return; } - //鏃堕棿闂撮殧 - if (EventWaitTime != -1) - { - if ((DateTime.Now - oldTime).TotalMilliseconds < EventWaitTime) { return; } - oldTime = DateTime.Now; - } this.ProgressChangedEvent(0, value); } @@ -147,6 +175,52 @@ #endregion + #region 鈻� 鑷畾涔変笂鏂规樉绀烘枃鏈琠________________ + + /// <summary> + /// 鍦ㄤ笂鏂规樉绀鸿嚜瀹氫箟鏂囨湰 + /// </summary> + /// <param name="i_width">瀹藉害(鐪熷疄鍊�)</param> + /// <param name="textSize">鏂囧瓧澶у皬</param> + /// <param name="textColor">鏂囧瓧棰滆壊</param> + public void ShowCustomTextView(int i_width, int textSize, uint textColor) + { + if (this.btnTopView != null) { return; } + + int contrHeight = Application.GetRealHeight(60); + this.btnTopView = new NormalViewControl(i_width, contrHeight, false); + btnTopView.TextColor = textColor; + btnTopView.TextSize = textSize; + btnTopView.TextAlignment = TextAlignment.Center; + btnTopView.Y = this.Y - contrHeight + Application.GetRealHeight(20); + //鍒濆鍖栨椂,X杞村彲浠ヤ笉鐢ㄧ悊浼� + + this.Parent.AddChidren(btnTopView); + } + + /// <summary> + /// 璁剧疆鑷畾涔夋枃鏈俊鎭� + /// </summary> + /// <param name="i_text"></param> + public void SetCustomText(string i_text) + { + if (this.btnTopView == null) { return; } + + this.btnTopView.Text = i_text; + //婊戞潯鏈�宸﹁竟鐨勮窛绂� + int XX = this.X + this.m_SeekBarPadding; + //褰撳墠婊戞潯鎵�鍦ㄧ殑澶ц嚧鐧惧垎姣� + decimal persent = (decimal)(this.Progress - this.m_MinValue) / (this.m_MaxValue - this.m_MinValue); + //褰撳墠婊戞潯鎵�鍦ㄧ殑澶ц嚧浣嶇疆 + XX += (int)((this.Width - this.m_SeekBarPadding * 2) * persent); + //鍥犱负瑕佸眳涓�,鎵�浠ュ噺鎺夎嚜瀹氫箟鎺т欢鐨勫搴︾殑涓�鑸� + XX = XX - this.btnTopView.Width / 2; + + this.btnTopView.X = XX; + } + + #endregion + #region 鈻� 涓�鑸柟娉昣__________________________ /// <summary> -- Gitblit v1.8.0