SVN r1167
SVN-Revision: r1167
This commit is contained in:
@@ -205,6 +205,10 @@ namespace Lskj.Control
|
||||
/// 扫码添加行
|
||||
/// </summary>
|
||||
public DataRow SweepCodeRow = null;
|
||||
/// <summary>
|
||||
/// 浏览器添加行是否成功
|
||||
/// </summary>
|
||||
public bool BrowserAddRow = false;
|
||||
#endregion
|
||||
|
||||
#region public set property
|
||||
@@ -789,9 +793,10 @@ namespace Lskj.Control
|
||||
{
|
||||
DataTable table = gcMain.GridControl.DataSourceTable();
|
||||
int rowNumber = table.Rows.Count;
|
||||
this.BrowserAddRow = false;
|
||||
//新增一行
|
||||
this.AddGridViewRecord();
|
||||
if (this.gcMain.GridView.FocusedRowHandle == rowNumber)
|
||||
if (this.gcMain.GridView.FocusedRowHandle == rowNumber&& BrowserAddRow)
|
||||
{
|
||||
//成功新增行,把网页返回的行赋值
|
||||
foreach (GridColumn col in gridColumns)
|
||||
@@ -1038,6 +1043,7 @@ namespace Lskj.Control
|
||||
bandedGridControlEx.Model = this.Model;
|
||||
bandedGridControlEx.SysModel = this.SysModel;
|
||||
bandedGridControlEx.Dock = DockStyle.Fill;
|
||||
bandedGridControlEx.TotalQuantity = this.SysModel.TotalQuantity;
|
||||
// 明确设置禁止自动调整列宽
|
||||
bandedGridControlEx.BandedView.OptionsView.ColumnAutoWidth = false;
|
||||
gcMain.CustomGroupBandEx = bandedGridControlEx;
|
||||
@@ -2055,6 +2061,7 @@ namespace Lskj.Control
|
||||
}
|
||||
}
|
||||
}
|
||||
this.BrowserAddRow = true;
|
||||
view.UpdateCurrentRow();
|
||||
view.ShowEditor();
|
||||
}
|
||||
@@ -3749,10 +3756,15 @@ namespace Lskj.Control
|
||||
this.gcMain.ModifyCond = this.SysModel.ModifyCond;
|
||||
//主键
|
||||
this.gcMain.MultiplePrimary = parmaryKey;
|
||||
//合计是否只显示行数
|
||||
this.gcMain.TotalQuantity = this.SysModel.TotalQuantity;
|
||||
// 常用工具
|
||||
this.InitializeCommonTool();
|
||||
if (SysModel.isLeftRightMode) this.pl_top_right.Visible = false;
|
||||
|
||||
this.gcMain.OnNewLine += new GridControlEx.ModuleAddLine(AddGridRows);
|
||||
|
||||
|
||||
//隐藏按钮,改变pl_top_right宽度,重新计算按钮坐标(显示比列放大的话,左侧条件可能会别遮住,需要减去宽度后重新算坐标)
|
||||
this.CalculateCoordinates();
|
||||
|
||||
@@ -5892,4 +5904,50 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增行,并替换指定字段值
|
||||
/// </summary>
|
||||
/// <param name="FieldName"></param>
|
||||
/// <param name="list"></param>
|
||||
public void AddGridRows(string FieldName, List<string> list)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(this.SysModel.MenuAddName))
|
||||
{
|
||||
DataTable dt = this.gcMain.GridControl.DataSource as DataTable;
|
||||
if (dt == null)
|
||||
{
|
||||
MessageUtil.Show("请查询后添加!");
|
||||
return;
|
||||
}
|
||||
if (!SysModel.CanEdit)
|
||||
{
|
||||
MessageUtil.Show("表格不可编辑,增加失败");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(dt.Column
|
||||
Reference in New Issue
Block a user