Gridcontrol控件选中多行数据自动弹出统计信息
Gridcontrol控件选中多行数值,右下角弹出统计信息这种效果要怎么实现同问,解决了没? 前段时间刚好实现了类似功能,代码如下
protected virtual void OrderGridView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
GridView view = (GridView)sender;
ToolTipControllerShowEventArgs args = toolTipController1.CreateShowArgs();
args.ToolTip = GetSelectedRows(view);
args.Title = "";
toolTipController1.ShowHint(args);
}
protected virtual string GetSelectedRows(GridView view)
{
List<selectCellvalue> selectdata = new List<selectCellvalue>();
string ret = "";
int rowIndex = -1;
if (view.OptionsSelection.MultiSelectMode == GridMultiSelectMode.CellSelect)
{
foreach (GridCell cell in view.GetSelectedCells())
{
decimal res;
if (decimal.TryParse(view.GetRowCellDisplayText(cell.RowHandle, cell.Column),out res))
{
selectdata.Add(new selectCellvalue()
{
key = 1,
value = Convert.ToDecimal(view.GetRowCellDisplayText(cell.RowHandle, cell.Column))
});
}
rowIndex = cell.RowHandle;
}
if (selectdata.Count > 0)
{
ret = $"总和:" + selectdata.Sum(x => x.value);
ret += $"{Environment.NewLine}最小值:" + selectdata.Min(x => x.value);
ret += $"{Environment.NewLine}最大值:" + selectdata.Max(x => x.value);
ret += $"{Environment.NewLine}平均值:" + Math.Round( selectdata.Average(x => x.value),2);
ret += $"{Environment.NewLine}个数:" + selectdata.Count;
}
}
return ret;
} 比其他線上娛樂城更容易贏錢,所以也就是為甚麼這麼多人會選擇線上老虎機的原因
页:
[1]