1: myGraphicFileInfo.GetKpiImage(k.StatusGraphic, Convert.ToDouble(cellset.Cells[2].Value), and this is the source of this methode :
2:
3: using System;
4: using System.Collections;
5:
6: /// <summary>
7: /// Summary description for GraphicFileInfo
8: /// </summary>
9:
10: public class GraphicFileInfo {
11:
12: public GraphicFileInfo(){
13: InitializeGraphicFileInfo();
14: }
15:
16: /// <summary>
17: /// private class to manage the KPI Icon
18: /// </summary>
19:
20: private class GraphicFileInformation {
21:
22: public string FileName;
23: public int LastFileNumber;
24:
25: public GraphicFileInformation(string fileName, int LastFileNumber){
26: this.FileName = fileName;
27: this.LastFileNumber = LastFileNumber;
28: }
29: }
30:
31: private Hashtable graphicFiles;
32:
33: /// <summary>
34: /// Initiatlize the hashtable that contains the icons
35: /// </summary>
36:
37: private void InitializeGraphicFileInfo(){
38: graphicFiles = new Hashtable();
39: graphicFiles.Add("Standard Arrow", new GraphicFileInformation("Arrow_Beveled", 4));
40: graphicFiles.Add("XP Arrow", new GraphicFileInformation("Arrow_XP", 4));
41: graphicFiles.Add("Status Arrow - Ascending", new GraphicFileInformation("Arrow_Status_Asc", 4));
42: graphicFiles.Add("Status Arrow - Descending", new GraphicFileInformation("Arrow_Status_Desc", 4));
43: graphicFiles.Add("Traffic Light - Single", new GraphicFileInformation("Stoplight_Single", 2));
44: graphicFiles.Add("Traffic Light - Multiple", new GraphicFileInformation("Stoplight_Multiple", 2));
45: graphicFiles.Add("Road Signs", new GraphicFileInformation("Road", 2));
46: graphicFiles.Add("Gauge - Ascending", new GraphicFileInformation("Gauge_Asc", 4));
47: graphicFiles.Add("Gauge - Descending", new GraphicFileInformation("Gauge_Desc", 4));
48: graphicFiles.Add("Thermometer", new GraphicFileInformation("Therm", 2));
49: graphicFiles.Add("Cylinder", new GraphicFileInformation("Cylinder", 2));
50: graphicFiles.Add("Smiley Face", new GraphicFileInformation("Smiley", 2));
51: }
52:
53: /// <summary>
54: /// Return the icon to display
55: /// </summary>
56: /// <param name="graphicName">Name of the KPI Icon</param>
57: /// <param name="value">value of the KPI</param>
58: /// <returns>The Icon name to display</returns>
59:
60: public string GetKpiImage(string graphicName, double value){
61:
62: GraphicFileInformation graphicFile = (GraphicFileInformation)graphicFiles[graphicName];
63:
64: int fileNumber = (int)Math.Round(graphicFile.LastFileNumber * (value + 1.0) / 2.0);
65:
66: if (fileNumber < 0){
67: fileNumber = 0;
68: } else if (fileNumber > graphicFile.LastFileNumber){
69: fileNumber = graphicFile.LastFileNumber;
70: }
71:
72: string fileName = "Images/" + graphicFile.FileName + fileNumber + ".gif";
73: return fileName;
74: }
75: }