|
@@ -2440,11 +2440,11 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
// 将原图转换为RGB格式,并绘制到新的Bitmap上
|
|
|
graphics.DrawImage(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height));
|
|
|
-
|
|
|
+ Color color = FromHex("#00FF00");
|
|
|
// 设置线条颜色和宽度
|
|
|
- Pen pen = new Pen(Color.Black, LineWidth);
|
|
|
+ Pen pen = new Pen(color, LineWidth);
|
|
|
Font font = new Font("Arial", 20, GraphicsUnit.Pixel);
|
|
|
- Brush brush = new SolidBrush(Color.Black);
|
|
|
+ Brush brush = new SolidBrush(color);
|
|
|
StringFormat stringFormat = new StringFormat();
|
|
|
stringFormat.Alignment = StringAlignment.Center; // 居中对齐
|
|
|
stringFormat.LineAlignment = StringAlignment.Center; // 居中对齐行
|
|
@@ -2457,7 +2457,7 @@ namespace OTSIncAReportGrids
|
|
|
point.Y = bitmap.Height - 80;
|
|
|
|
|
|
|
|
|
- graphics.DrawString(a_str, font, new SolidBrush(Color.Black), point);
|
|
|
+ graphics.DrawString(a_str, font, new SolidBrush(color), point);
|
|
|
graphics.DrawLine(pen, bitmap.Width - LineLength - 20, bitmap.Height - 40, bitmap.Width - 20, bitmap.Height - 40);
|
|
|
graphics.DrawLine(pen, bitmap.Width - LineLength - 20, bitmap.Height - 40, bitmap.Width - LineLength - 20, bitmap.Height - 50);
|
|
|
graphics.DrawLine(pen, bitmap.Width - 20, bitmap.Height - 40, bitmap.Width - 20, bitmap.Height - 50);
|
|
@@ -2466,6 +2466,16 @@ namespace OTSIncAReportGrids
|
|
|
}
|
|
|
return rgbBitmap;
|
|
|
}
|
|
|
+
|
|
|
+ private static Color FromHex(string hex)
|
|
|
+ {
|
|
|
+ hex = hex.Replace("#", ""); // 移除 # 前缀
|
|
|
+ byte a = 255; // 默认Alpha值为255(不透明)
|
|
|
+ byte r = Convert.ToByte(hex.Substring(0, 2), 16);
|
|
|
+ byte g = Convert.ToByte(hex.Substring(2, 2), 16);
|
|
|
+ byte b = Convert.ToByte(hex.Substring(4, 2), 16);
|
|
|
+ return Color.FromArgb(a, r, g, b);
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
/// 判断当前图片应该使用多大标尺
|
|
|
/// </summary>
|
|
@@ -2475,17 +2485,17 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
int value = 0;
|
|
|
a_value = a_value / 2;
|
|
|
- for (int i = 100; i < 2000; i += 50)
|
|
|
+ for (int i = 10; i < 5000; i += 5)
|
|
|
{
|
|
|
if (a_value < i)
|
|
|
{
|
|
|
- value = i - 50;
|
|
|
+ value = i - 5;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if (value == 0)
|
|
|
{
|
|
|
- value = 2000;
|
|
|
+ value = 5000;
|
|
|
}
|
|
|
return value;
|
|
|
|