|
@@ -328,6 +328,7 @@ namespace OTSIncAReportGraph.Class
|
|
|
|
|
|
return ret_color;
|
|
return ret_color;
|
|
}
|
|
}
|
|
|
|
+ private static Dictionary<string, Color> colordic = new Dictionary<string, Color>();
|
|
public static Color GetColorBySTDTypeIDForBSEAndSorImage(string in_partcolor, int in_stdtypeid)
|
|
public static Color GetColorBySTDTypeIDForBSEAndSorImage(string in_partcolor, int in_stdtypeid)
|
|
{
|
|
{
|
|
Color ret_c = new Color();
|
|
Color ret_c = new Color();
|
|
@@ -343,11 +344,29 @@ namespace OTSIncAReportGraph.Class
|
|
//大于等于1000,并且小于10000时,使用用户标准库来分析夹杂物名称
|
|
//大于等于1000,并且小于10000时,使用用户标准库来分析夹杂物名称
|
|
if (!in_partcolor.Contains("#"))
|
|
if (!in_partcolor.Contains("#"))
|
|
{
|
|
{
|
|
- ret_c = DrawFunction.colorHx16toRGB("#" + in_partcolor);//接收必须是#000000的格式
|
|
|
|
|
|
+ in_partcolor = "#" + in_partcolor;
|
|
|
|
+ if (colordic.ContainsKey(in_partcolor))//using dictionary to speed up.
|
|
|
|
+ {
|
|
|
|
+ ret_c = colordic[ in_partcolor];
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ ret_c = DrawFunction.colorHx16toRGB(in_partcolor);//接收必须是#000000的格式
|
|
|
|
+ colordic.Add(in_partcolor, ret_c);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- ret_c = DrawFunction.colorHx16toRGB(in_partcolor);//接收必须是#000000的格式
|
|
|
|
|
|
+ if (colordic.ContainsKey(in_partcolor))//using dictionary to speed up.
|
|
|
|
+ {
|
|
|
|
+ ret_c = colordic[in_partcolor];
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ ret_c = DrawFunction.colorHx16toRGB(in_partcolor);//接收必须是#000000的格式
|
|
|
|
+ colordic.Add(in_partcolor, ret_c);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return ret_c;
|
|
return ret_c;
|
|
@@ -507,15 +526,17 @@ namespace OTSIncAReportGraph.Class
|
|
{
|
|
{
|
|
return null;//文件不存在
|
|
return null;//文件不存在
|
|
}
|
|
}
|
|
- FileStream fs = File.OpenRead(path); //OpenRead
|
|
|
|
- int filelength = 0;
|
|
|
|
- filelength = (int)fs.Length; //获得文件长度
|
|
|
|
- Byte[] image = new Byte[filelength]; //建立一个字节数组
|
|
|
|
- fs.Read(image, 0, filelength); //按字节流读取
|
|
|
|
- System.Drawing.Image result = System.Drawing.Image.FromStream(fs);
|
|
|
|
- fs.Close();
|
|
|
|
- Bitmap bit = new Bitmap(result);
|
|
|
|
- return bit;
|
|
|
|
|
|
+ //FileStream fs = File.OpenRead(path); //OpenRead
|
|
|
|
+ //int filelength = 0;
|
|
|
|
+ //filelength = (int)fs.Length; //获得文件长度
|
|
|
|
+ //Byte[] image = new Byte[filelength]; //建立一个字节数组
|
|
|
|
+ //fs.Read(image, 0, filelength); //按字节流读取
|
|
|
|
+ //System.Drawing.Image result = System.Drawing.Image.FromStream(fs);
|
|
|
|
+ //fs.Close();
|
|
|
|
+ //Bitmap bit = new Bitmap(result);
|
|
|
|
+ //return bit;
|
|
|
|
+ var bit = Bitmap.FromFile(path);
|
|
|
|
+ return (Bitmap)bit;
|
|
}
|
|
}
|
|
//图片转成二进制
|
|
//图片转成二进制
|
|
public static byte[] GetPictureData(string imagepath)
|
|
public static byte[] GetPictureData(string imagepath)
|