SVN-Revision: r814
This commit is contained in:
tdx
2025-07-01 03:27:34 +00:00
parent b42e4e2df0
commit 223d0cf844
3 changed files with 14 additions and 30 deletions
+6 -28
View File
@@ -862,6 +862,7 @@ namespace Lskj.Control
private void InitializeGridView()
{
this.gcMain.Model = this.Model;
this.gcMain.SysModel = this.SysModel;
Dictionary<object, Hashtable> dataCaches = Model != null ? Model.DataCaches : null;
//显示筛选行
if (this.SysModel.LoadFilter) this.gcMain.GridView.OptionsView.ShowAutoFilterRow = true;
@@ -871,6 +872,7 @@ namespace Lskj.Control
this.panelControl1.Controls.Clear();
this.gcMain = new TreeBandedGridControlEx() { Expansion = SysModel.TreeTableExpand };
this.gcMain.Model = this.Model;
this.gcMain.SysModel = this.SysModel;
this.gcMain.Dock = DockStyle.Fill;
if (this._gridColumns.Rows.Count == 0 && !string.IsNullOrWhiteSpace(SysModel.TreeKeyFieldName) && !string.IsNullOrWhiteSpace(SysModel.TreeParentFieldName))
{
@@ -891,6 +893,7 @@ namespace Lskj.Control
this.gcMain = new BandedGridControlEx();
(this.gcMain as BandedGridControlEx).moduleModel = this.SysModel;
this.gcMain.Model = this.Model;
this.gcMain.SysModel = this.SysModel;
this.gcMain.Dock = DockStyle.Fill;
this.panelControl1.Controls.Add(this.gcMain);
if (this.SysModel.LoadFilter) (this.gcMain as BandedGridControlEx).GridView.OptionsView.ShowAutoFilterRow = true;
@@ -902,6 +905,7 @@ namespace Lskj.Control
this.panelControl1.Controls.Clear();
this.gcMain = new TreeGridControlEx() { Expansion = SysModel.TreeTableExpand };
this.gcMain.Model = this.Model;
this.gcMain.SysModel = this.SysModel;
this.gcMain.Dock = DockStyle.Fill;
if (this._gridColumns.Rows.Count == 0 && !string.IsNullOrWhiteSpace(SysModel.TreeKeyFieldName) && !string.IsNullOrWhiteSpace(SysModel.TreeParentFieldName))
{
@@ -919,6 +923,7 @@ namespace Lskj.Control
BandedGridControlEx bandedGridControlEx = new BandedGridControlEx();
bandedGridControlEx.moduleModel = this.SysModel;
bandedGridControlEx.Model = this.Model;
bandedGridControlEx.SysModel = this.SysModel;
bandedGridControlEx.Dock = DockStyle.Fill;
// 明确设置禁止自动调整列宽
bandedGridControlEx.BandedView.OptionsView.ColumnAutoWidth = false;
@@ -5556,31 +5561,4 @@ namespace Lskj.Control
// 获取字体和最大宽度
Document document = richEdit.Document;
Font font = richEdit.Font;
int maxWidth = richEdit.ClientSize.Width - richEdit.Padding.Horizontal;
// 获取前3行文本
string[] lines = richEdit.Text.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
int lineCount = Math.Min(4, lines.Length);
string firstThreeLines = string.Join(Environment.NewLine, lines.Take(lineCount));
// 创建StringFormat
StringFormat format = new StringFormat(StringFormat.GenericTypographic);
format.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;
// 测量文本高度
using (Graphics g = richEdit.CreateGraphics())
{
SizeF textSize = g.MeasureString(
firstThreeLines,
font,
maxWidth,
format
);
return (int)Math.Ceiling(textSize.Height);
}
}
}
}