From 3dcbd186c42c598c0c08d1cd37034cf2baa09e54 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 30 十二月 2019 15:47:51 +0800 Subject: [PATCH] 合并了代码 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs | 39 ++++++++++----------------------------- 1 files changed, 10 insertions(+), 29 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs index 7c86b24..52af78a 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs @@ -235,38 +235,19 @@ } /// <summary> - /// 鏍规嵁鏂囨湰,璁$畻瀹冨疄闄呯殑瀹藉害(杩斿洖鐨勬槸鐪熷疄鍊�) + /// 鏍规嵁鏂囨湰,璁$畻瀹冨疄闄呯殑瀹藉害 /// </summary> - /// <param name="textSize">瀛椾綋澶у皬,鐪佺暐鏃朵娇鐢ㄥ綋鍓嶆帶浠剁殑瀛椾綋澶у皬</param> - /// <param name="i_text">闇�瑕佽绠楃殑鏂囨湰淇℃伅,鐪佺暐鏃朵娇鐢ㄥ綋鍓嶆帶浠剁殑鏂囨湰</param> /// <returns></returns> - public int GetRealWidthByText(float textSize, string i_text = null) + public int GetRealWidthByText() { - if (i_text == null) - { - i_text = this.Text; - } - if (textSize == -1) - { - textSize = this.TextSize; - } - - int byteLength = 0; - for (int i = 0; i < i_text.Length; i++) - { - byteLength += Encoding.UTF8.GetBytes(i_text[i].ToString()).Length; - //int length = Encoding.UTF8.GetBytes(i_text[i].ToString()).Length; - //if (length == 1) - //{ - // //鑻辨枃 - // byteLength += length; - // continue; - //} - ////涓枃(鏆傛椂鐢ㄤ腑鏂囧搴�) - //byteLength += Encoding.GetEncoding("gb2312").GetBytes(i_text[i].ToString()).Length; - } - int realWidth = byteLength * (int)textSize; - return Application.GetRealWidth(realWidth + 20); +#if Android + //闇�瑕佸鍔犱竴涓宸�� + return this.GetTextWidth() + Application.GetRealWidth(12); +#endif +#if iOS + //闇�瑕佸鍔犱竴涓宸�� + return this.GetTextWidth() + Application.GetRealWidth(25); +#endif } #endregion -- Gitblit v1.8.0