From 802f200c004348defca5cefd047ad843c74abadd Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期四, 01 四月 2021 09:21:42 +0800 Subject: [PATCH] Merge branch 'temp-wxr' into WJC --- HDL_ON/UI/UI0-Stan/Form/Base/EditorCommonForm.cs | 36 +++++++++++++++++++++++++++++++++--- 1 files changed, 33 insertions(+), 3 deletions(-) diff --git a/HDL_ON/UI/UI0-Stan/Form/Base/EditorCommonForm.cs b/HDL_ON/UI/UI0-Stan/Form/Base/EditorCommonForm.cs index 31bdbe3..a592744 100644 --- a/HDL_ON/UI/UI0-Stan/Form/Base/EditorCommonForm.cs +++ b/HDL_ON/UI/UI0-Stan/Form/Base/EditorCommonForm.cs @@ -290,7 +290,7 @@ #region 鈻� 娣诲姞鍒楄〃娑堟伅鏄剧ず鎺т欢_______________ /// <summary> - /// 娣诲姞鍒楄〃娑堟伅鏄剧ず鎺т欢,杩斿洖鐨勬槸鏈�鍚庝竴涓帶浠剁殑搴曢儴鍧愭爣 + /// 娣诲姞鍒楄〃娑堟伅鏄剧ず鎺т欢,杩斿洖鐨勬槸鏈�鍚庝竴涓帶浠剁殑搴曢儴鍧愭爣(娌$湅鎳傝繖涓嚱鏁板墠,璇峰嬁浣跨敤) /// </summary> /// <param name="frameTable">妗屽竷瀹瑰櫒鎺т欢</param> /// <param name="i_msg">鏄剧ず鐨勬秷鎭�(鎹㈣璇蜂娇鐢ㄣ�恵0}銆戣繘琛屽垎鍓�)</param> @@ -303,12 +303,37 @@ /// <para>娉細闄や簡鏂板缓杩欎釜鍑芥暟鐨勫紑鍙戣�呬互澶栵紝閮戒笉寤鸿鎶婅繖涓�间笉璁剧疆涓簍rue</para> /// <para>璇存槑锛氫互鏈�闀跨殑鎺т欢鐨刋杞翠负鍩哄噯,鎵�鏈夋帶浠剁殑X杞撮兘鍙樻垚涓�鑷�</para> /// </param> + /// <param name="i_width">鏂囨湰瀹藉害,鐪熷疄鍊�,褰撲负-1鏃�,鍐呴儴鑷姩璁$畻</param> /// <returns></returns> public int AddListMsgControls(FrameLayout frameTable, string i_msg, int i_fontSize, uint i_fontColor, int i_height, - int i_yy, TextAlignment alignment = TextAlignment.Center, bool special = false) + int i_yy, TextAlignment alignment = TextAlignment.Center, bool special = false, int i_width = -1) { var listMsg = i_msg.Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); - int defultWidth = this.bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2; + int defultWidth = 0; + if (this.bodyFrameLayout != null) + { + defultWidth = i_width == -1 ? this.bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2 : i_width; + } + else + { + defultWidth = i_width == -1 ? frameTable.Width - HdlControlResourse.XXLeft * 2 : i_width; + } + + //濡傛灉鍙槸涓�琛岀殑鏃跺�� + bool isMoreLine = false; + if (listMsg.Length == 1) + { + var btnTemp = new ButtonCtrBase(); + btnTemp.TextSize = i_fontSize; + btnTemp.Text = i_msg; + int rowCount = btnTemp.GetRealRowCountByText(defultWidth); + //瀹冪殑楂樺害鐢辫鏁板喅瀹�(鐞嗚涓婂簲璇ラ兘鏄�1琛�,杩欓噷鍋氱壒娈婂鐞嗚�屽凡) + if (rowCount > 1) + { + i_height = i_height * rowCount; + isMoreLine = true; + } + } var listContr = new List<NormalViewControl>(); int minXX = 10086;//鎺т欢闆嗗悎鏈�灏忕殑X杞� @@ -322,6 +347,11 @@ btnMsg.TextColor = i_fontColor; btnMsg.TextSize = i_fontSize; btnMsg.Text = strMsg; + if (isMoreLine == true) + { + //鍙互鎹㈣ + btnMsg.IsMoreLines = isMoreLine; + } //鐗规畩澶勭悊 if (special == true && alignment == TextAlignment.Center) -- Gitblit v1.8.0