SVN-Revision: r690
This commit is contained in:
cyf
2025-06-09 01:24:56 +00:00
parent d2f527a7a1
commit 826bfd4865
7 changed files with 130 additions and 42 deletions
+36 -20
View File
@@ -41,6 +41,8 @@ using Lskj.WebErp.Core.BLL.Abstract;
using Lskj.Data.Api.BLL;
using DevExpress.XtraGrid.Views.Base;
using System.Threading.Tasks;
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
namespace Lskj.Control
{
@@ -428,7 +430,7 @@ namespace Lskj.Control
/// <summary>
/// 上方提示框
/// </summary>
public LabelRemarkEdit PromptBox = null;
public LabelRichEdit PromptBox = null;
/// <summary>
/// 上方高度
/// </summary>
@@ -5373,31 +5375,24 @@ namespace Lskj.Control
//不能搜索,并且传入提示值
this.pl_top_fix_search.Visible = false;
this.pl_top_right.Visible = false;
this.TipsPanel.Visible = true;
//提示内容有值的情况下,隐藏右侧按钮
if (string.IsNullOrWhiteSpace(text))
{
this.pl_top_right.Visible = true;
}
else
{
this.pl_top_right.Visible = false;
}
if (!CreatePromptBox)
{
this.TopHeight = this.pl_top.Height;
//代码的方式创建,直接拖的控件会提示线程问题
this.TipsPanel.Controls.Clear();
this.PromptBox = new LabelRemarkEdit();
this.PromptBox = new LabelRichEdit();
this.PromptBox.Dock = DockStyle.Fill;
this.PromptBox.Padding = new Padding(3, 5, 0, 0);
this.PromptBox.FontSize = ForceSize;
this.PromptBox.Padding = new Padding(3, 5, 0, 8);
this.PromptBox.FontSize = ForceSize;//ForceSize;
this.PromptBox.LabelText = "";
this.PromptBox.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.PromptBox.TextEdit.BackColor = Color.FromArgb(173, 216, 230);
this.TipsPanel.BackColor = Color.FromArgb(173, 216, 230);
//this.PromptBox.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
//this.PromptBox.TextEdit.BackColor = Color.FromArgb(173, 216, 230);
//this.TipsPanel.BackColor = Color.FromArgb(173, 216, 230);
if (!string.IsNullOrWhiteSpace(ForceColor))
{
this.PromptBox.TextEdit.ForeColor = ColorTranslator.FromHtml(ForceColor);
@@ -5408,9 +5403,26 @@ namespace Lskj.Control
CreatePromptBox = true;
}
PromptBox.EditText = text;
// 获取文档对象
Document document = this.PromptBox.TextEdit.Document;
document.BeginUpdate();
try
{
// 获取段落属性并设置行间距
ParagraphProperties pp = document.BeginUpdateParagraphs(document.Range);
// 设置行间距为1.2倍
pp.LineSpacingType = ParagraphLineSpacing.Multiple;
pp.LineSpacingMultiplier = 1.2f;
document.EndUpdateParagraphs(pp);
}
finally
{
document.EndUpdate();
}
int textHeight = this.GetFirstThreeLinesHeight(PromptBox.TextEdit)+4;
//前4行高度
int textHeight = (int)Math.Round(this.GetFirstThreeLinesHeight(PromptBox.TextEdit)*1.2) +20;
if (textHeight > this.TopHeight)
{
this.pl_top.Height = textHeight;
@@ -5422,6 +5434,10 @@ namespace Lskj.Control
}
}
public int GetFirstThreeLinesHeight(MemoEdit memoEdit)
public int GetFirstThreeLinesHeight(RichEditControl richEdit)
{
if (string.IsNullOrEmpty(memoEdit.Te
if (string.IsNullOrEmpty(richEdit.Text)) return 0;
// 获取字体和最大宽度
Document document = richEdit.Document;