Dictionary<int, int> Datas
{
get
{
Dictionary<int, int> d = new Dictionary<int, int>();
d.Add(1, 35);
d.Add(2, 45);
d.Add(3, 20);
return d;
}
}
<asp:Label ID="Label1" runat="server" style="margin: 3px;" Text="" Width="300" BorderWidth="1"></asp:Label><br /> <asp:Label ID="Label2" runat="server" style="margin: 3px;" Text="" Width="300" BorderWidth="1"></asp:Label><br /> <asp:Label ID="Label3" runat="server" style="margin: 3px;" Text="" Width="300" BorderWidth="1"></asp:Label><br />
protected void Page_Load(object sender, EventArgs e)
{
Data_Binding();
}
private void Data_Binding()
{
int totals = 100;
foreach (KeyValuePair<int, int> kvp in Datas)
{
double rate = kvp.Value / (double)totals;
double width = rate * 300;
switch (kvp.Key)
{
case 1:
this.Label1.Text = GradientImage(width, rate);
break;
case 2:
this.Label2.Text = GradientImage(width, rate);
break;
case 3:
this.Label3.Text = GradientImage(width, rate);
break;
}
}
}
private string GradientImage(double width, double rate)
{
return "<IMG height='21' src='images/bar.gif' width='" + width + "' align='absMiddle'> " + rate.ToString("p");
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有