SVN r457
SVN-Revision: r457
This commit is contained in:
@@ -948,8 +948,12 @@ namespace Lskj.Control
|
||||
}
|
||||
|
||||
|
||||
if (e.RowHandle == bandedGridView.FocusedRowHandle)
|
||||
// 仅当单元格没有被选中时,才设置行选中颜色,否则保持默认的选中色
|
||||
if (e.RowHandle == bandedGridView.FocusedRowHandle &&
|
||||
!bandedGridView.IsCellSelected(e.RowHandle, e.Column))
|
||||
{
|
||||
e.Appearance.BackColor = ColorTranslator.FromHtml("#9feb6a");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:重写绘制序号列</para>
|
||||
@@ -1720,7 +1724,7 @@ namespace Lskj.Control
|
||||
{
|
||||
GridColumn col = GridView.VisibleColumns[_colNumber];
|
||||
GridColumnModel model = col.Tag as GridColumnModel;
|
||||
if (model.CanCopy || ((GridView.OptionsBehavior.Editable) && (GridView.VisibleColumns[_colNumber].OptionsColumn.AllowEdit)))
|
||||
if (DateTime.TryParse(col.FieldName,out _)||(model.CanCopy || ((GridView.OptionsBehavior.Editable) && (GridView.VisibleColumns[_colNumber].OptionsColumn.AllowEdit))))
|
||||
{
|
||||
// 返回ID类型特殊处理
|
||||
string cellValue = _arrayStr2[j];
|
||||
@@ -2721,48 +2725,56 @@ namespace Lskj.Control
|
||||
GridCell[] cells = this.bandedGridView.GetSelectedCells();
|
||||
int[] rows = this.bandedGridView.GetSelectedRows();
|
||||
|
||||
this.pl_buttom.Visible = cells.Length > 1 && rows.Length > 1;
|
||||
// 只判断单元格数目,允许同行多单元格选中
|
||||
this.pl_buttom.Visible = cells.Length > 1;
|
||||
|
||||
if (this.pl_buttom.Visible)
|
||||
{
|
||||
|
||||
// 分别计算求和、平均值、最大值、最小值、计数
|
||||
double sum = 0, avg = 0, max = 0, min = 0;
|
||||
double sum = 0, avg = 0, max = double.MinValue, min = double.MaxValue;
|
||||
int count = 0;
|
||||
|
||||
foreach (GridCell cell in cells)
|
||||
{
|
||||
double cellNumber = 0;
|
||||
string cellValue = this.bandedGridView.GetRowCellValue(cell.RowHandle, cell.Column) + "";
|
||||
if (double.TryParse(cellValue, out cellNumber))
|
||||
string cellValue = this.bandedGridView.GetRowCellValue(cell.RowHandle, cell.Column)?.ToString();
|
||||
if (double.TryParse(cellValue, out double cellNumber))
|
||||
{
|
||||
cellNumber = Convert.ToDouble(cellValue);
|
||||
|
||||
if (max < cellNumber)
|
||||
max = cellNumber;
|
||||
if (min == 0 || min > cellNumber)
|
||||
min = cellNumber;
|
||||
max = Math.Max(max, cellNumber);
|
||||
min = Math.Min(min, cellNumber);
|
||||
|
||||
count++;
|
||||
sum += cellNumber;
|
||||
}
|
||||
}
|
||||
avg = count == 0 || count == 0 ? 0 : sum / count;
|
||||
this.lblTotal.Text = string.Format(ResourceKeys.GridTotalDisplayText, count, Math.Round(sum, 2), Math.Round(avg, 2), Math.Round(max, 2), Math.Round(min, 2));
|
||||
|
||||
avg = count == 0 ? 0 : sum / count;
|
||||
|
||||
this.lblTotal.Text = string.Format(ResourceKeys.GridTotalDisplayText,
|
||||
count,
|
||||
Math.Round(sum, 2),
|
||||
Math.Round(avg, 2),
|
||||
Math.Round(max, 2),
|
||||
Math.Round(min, 2));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex, Model.ModuleCode);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
this.SelectedRows = this.bandedGridView.GetSelectedRows();
|
||||
if (bandedGridView.OptionsSelection.MultiSelect == true && bandedGridView.OptionsSelection.MultiSelectMode == GridMultiSelectMode.CheckBoxRowSelect && bandedGridView.OptionsSelection.EnableAppearanceFocusedCell == false) this.bandedGridView.UpdateSummary();
|
||||
|
||||
this.SelectedRows = this.bandedGridView.GetSelectedRows();
|
||||
|
||||
if (bandedGridView.OptionsSelection.MultiSelect == true &&
|
||||
bandedGridView.OptionsSelection.MultiSelectMode == GridMultiSelectMode.CheckBoxRowSelect &&
|
||||
bandedGridView.OptionsSelection.EnableAppearanceFocusedCell == false)
|
||||
{
|
||||
this.bandedGridView.UpdateSummary();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:计算列关联字段</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
|
||||
Reference in New Issue
Block a user