sqlserver2005的KPI展示控件开发详解
2008-11-24 10:10:40 来源:WEB开发网DataGridViewStatusColumn定义
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace KPIDisplayer
{
internal class DataGridViewStatusColumn : DataGridViewImageColumn
{
public DataGridViewStatusColumn()
{
CellTemplate = new DataGridViewStatusCell();
}
}
}
step2.定义一个DataGridViewTrendColumn(从DataGridViewImageCell继承)和DataGridViewStatusColumn(从DataGridViewImageColumn继承),用于显示走向指示器。
DataGridViewTrendCell定义
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.ComponentModel;
using System.Reflection;
namespace KPIDisplayer
{
internal class DataGridViewTrendCell : DataGridViewImageCell
{
public DataGridViewTrendCell()
{
}
protected override object GetFormattedValue(object value, int rowIndex, ref DataGridViewCellStyle cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context)
{
string trendgraph = value.ToString().Split(',')[0];
double trend = Double.Parse(value.ToString().Split(',')[1]);
if (trendgraph== TrendGraph.StandardArrow)
{
if (trend == -1)
{
return Properties.Resources.Arrow_XP0;
}
else if (trend == -0.5)
{
return Properties.Resources.Arrow_XP1;
}
else if (trend == 0)
{
return Properties.Resources.Arrow_XP2;
}
else if (trend == 0.5)
{
return Properties.Resources.Arrow_XP3;
}
else if (trend == 1)
{
return Properties.Resources.Arrow_XP4;
}
else
{
return Properties.Resources.empty;
}
}
else if (trendgraph == TrendGraph.StatusArrowAscending)
{
if (trend == -1)
{
return Properties.Resources.Arrow_Status_Asc0;
}
else if (trend == -0.5)
{
return Properties.Resources.Arrow_Status_Asc1;
}
else if (trend == 0)
{
return Properties.Resources.Arrow_Status_Asc2;
}
else if (trend == 0.5)
{
return Properties.Resources.Arrow_Status_Asc3;
}
else if (trend == 1)
{
return Properties.Resources.Arrow_Status_Asc4;
}
else
{
return Properties.Resources.empty;
}
}
else if (trendgraph == TrendGraph.StatusArrowDescending)
{
if (trend == -1)
{
return Properties.Resources.Arrow_Status_Desc0;
}
else if (trend == -0.5)
{
return Properties.Resources.Arrow_Status_Desc1;
}
else if (trend == 0)
{
return Properties.Resources.Arrow_Status_Desc2;
}
else if (trend == 0.5)
{
return Properties.Resources.Arrow_Status_Desc3;
}
else if (trend == 1)
{
return Properties.Resources.Arrow_Status_Desc4;
}
else
{
return Properties.Resources.empty;
}
}
else if (trendgraph == TrendGraph.SmileyFace)
{
if (trend == -1)
{
return Properties.Resources.Smiley0;
}
else if (trend == 0)
{
return Properties.Resources.Smiley1;
}
else if (trend == 1)
{
return Properties.Resources.Smiley2;
}
else
{
return Properties.Resources.empty;
}
}
else
{
return Properties.Resources.empty;
}
}
}
}
- ››sqlserver安装和简单的使用
- ››SqlServer触发器、存储过程和函数
- ››SQLServer建立交叉表查询
- ››SqlServer强制断开数据库连接的方法
- ››SQLServer 2005 海量数据解决方案
- ››SQLServer 2008数据库查看死锁、堵塞的SQL语句
- ››SqlServer 插入多条数据
- ››SQLServer 2008 R2导出的SQL文件中没有数据
- ››SQLSERVER通过游标查询两个数据表共有字段名组合成...
- ››sqlserver2008实现拼音首字母和随机n位数的生成
- ››SQLServer与Java数据类型对应表
- ››sqlserver的日常检查脚本归结
更多精彩
赞助商链接