|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Drawing.Drawing2D;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Controls.ChemicalWeighing.HslCurve
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 整个组件的代码辅助工具,提供了一个基础的类库方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
// Token: 0x02000034 RID: 52
|
|
|
|
|
public class HslHelper
|
|
|
|
|
{
|
|
|
|
|
// Token: 0x060004DF RID: 1247 RVA: 0x00032DB4 File Offset: 0x00030FB4
|
|
|
|
|
static HslHelper()
|
|
|
|
|
{
|
|
|
|
|
HslHelper.StringFormatCenter = new StringFormat();
|
|
|
|
|
HslHelper.StringFormatCenter.Alignment = StringAlignment.Center;
|
|
|
|
|
HslHelper.StringFormatCenter.LineAlignment = StringAlignment.Center;
|
|
|
|
|
HslHelper.StringFormatLeft = new StringFormat();
|
|
|
|
|
HslHelper.StringFormatLeft.LineAlignment = StringAlignment.Center;
|
|
|
|
|
HslHelper.StringFormatLeft.Alignment = StringAlignment.Near;
|
|
|
|
|
HslHelper.StringFormatRight = new StringFormat();
|
|
|
|
|
HslHelper.StringFormatRight.LineAlignment = StringAlignment.Center;
|
|
|
|
|
HslHelper.StringFormatRight.Alignment = StringAlignment.Far;
|
|
|
|
|
HslHelper.StringFormatTopCenter = new StringFormat();
|
|
|
|
|
HslHelper.StringFormatTopCenter.Alignment = StringAlignment.Center;
|
|
|
|
|
HslHelper.StringFormatTopCenter.LineAlignment = StringAlignment.Near;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 返回中间范围值数据,如果大于最大值,则返回最大值,如果小于最小值,则返回最小值
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="min">最小值</param>
|
|
|
|
|
/// <param name="value">实际值</param>
|
|
|
|
|
/// <param name="max">最大值</param>
|
|
|
|
|
/// <returns>中间值信息</returns>
|
|
|
|
|
// Token: 0x060004E0 RID: 1248 RVA: 0x00032E5C File Offset: 0x0003105C
|
|
|
|
|
public static int Middle(int min, int value, int max)
|
|
|
|
|
{
|
|
|
|
|
bool flag = value > max;
|
|
|
|
|
int result;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
result = max;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag2 = value < min;
|
|
|
|
|
if (flag2)
|
|
|
|
|
{
|
|
|
|
|
result = min;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 从一个矩形的图形中获取菱形的坐标数组
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="rect">矩形</param>
|
|
|
|
|
/// <returns>数组结果</returns>
|
|
|
|
|
// Token: 0x060004E1 RID: 1249 RVA: 0x00032E88 File Offset: 0x00031088
|
|
|
|
|
public static Point[] GetRhombusFromRectangle(Rectangle rect)
|
|
|
|
|
{
|
|
|
|
|
return new Point[]
|
|
|
|
|
{
|
|
|
|
|
new Point(rect.X, rect.Y + rect.Height / 2),
|
|
|
|
|
new Point(rect.X + rect.Width / 2, rect.Y + rect.Height - 1),
|
|
|
|
|
new Point(rect.X + rect.Width - 1, rect.Y + rect.Height / 2),
|
|
|
|
|
new Point(rect.X + rect.Width / 2, rect.Y),
|
|
|
|
|
new Point(rect.X, rect.Y + rect.Height / 2)
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 计算绘图时的相对偏移值
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="max">0-100分的最大值,就是指准备绘制的最大值</param>
|
|
|
|
|
/// <param name="min">0-100分的最小值,就是指准备绘制的最小值</param>
|
|
|
|
|
/// <param name="height">实际绘图区域的高度</param>
|
|
|
|
|
/// <param name="value">需要绘制数据的当前值</param>
|
|
|
|
|
/// <returns>相对于0的位置,还需要增加上面的偏值</returns>
|
|
|
|
|
// Token: 0x060004E2 RID: 1250 RVA: 0x00032F68 File Offset: 0x00031168
|
|
|
|
|
public static float ComputePaintLocationY(int max, int min, int height, int value)
|
|
|
|
|
{
|
|
|
|
|
bool flag = (float)(max - min) == 0f;
|
|
|
|
|
float result;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
result = (float)height;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = (float)height - (float)(value - min) * 1f / (float)(max - min) * (float)height;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 计算绘图Y轴时的相对偏移值
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="max">0-100分的最大值,就是指准备绘制的最大值</param>
|
|
|
|
|
/// <param name="min">0-100分的最小值,就是指准备绘制的最小值</param>
|
|
|
|
|
/// <param name="height">实际绘图区域的高度</param>
|
|
|
|
|
/// <param name="value">需要绘制数据的当前值</param>
|
|
|
|
|
/// <returns>相对于0的位置,还需要增加上面的偏值</returns>
|
|
|
|
|
// Token: 0x060004E3 RID: 1251 RVA: 0x00032FA8 File Offset: 0x000311A8
|
|
|
|
|
public static float ComputePaintLocationY(float max, float min, float height, float value)
|
|
|
|
|
{
|
|
|
|
|
bool flag = max - min == 0f;
|
|
|
|
|
float result;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
result = height;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
float num = max - min;
|
|
|
|
|
bool flag2 = num == 0f;
|
|
|
|
|
if (flag2)
|
|
|
|
|
{
|
|
|
|
|
num = 1f;
|
|
|
|
|
}
|
|
|
|
|
result = height - (value - min) / num * height;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 计算绘图X轴时的相对偏移值
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="max">0-100分的最大值,就是指准备绘制的最大值</param>
|
|
|
|
|
/// <param name="min">0-100分的最小值,就是指准备绘制的最小值</param>
|
|
|
|
|
/// <param name="width">实际绘图区域的宽度</param>
|
|
|
|
|
/// <param name="value">需要绘制数据的当前值</param>
|
|
|
|
|
/// <returns>相对于0的位置,还需要增加上面的偏值</returns>
|
|
|
|
|
// Token: 0x060004E4 RID: 1252 RVA: 0x00032FF0 File Offset: 0x000311F0
|
|
|
|
|
public static float ComputePaintLocationX(float max, float min, float width, float value)
|
|
|
|
|
{
|
|
|
|
|
bool flag = max - min == 0f;
|
|
|
|
|
float result;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
result = width;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
float num = max - min;
|
|
|
|
|
bool flag2 = num == 0f;
|
|
|
|
|
if (flag2)
|
|
|
|
|
{
|
|
|
|
|
num = 1f;
|
|
|
|
|
}
|
|
|
|
|
result = (value - min) / num * width;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据绘制的值计算原始的值信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="max">0-100分的最大值,就是指准备绘制的最大值</param>
|
|
|
|
|
/// <param name="min">0-100分的最小值,就是指准备绘制的最小值</param>
|
|
|
|
|
/// <param name="height">实际绘图区域的高度</param>
|
|
|
|
|
/// <param name="paint">实际绘制的位置信息</param>
|
|
|
|
|
/// <returns>实际的值信息</returns>
|
|
|
|
|
// Token: 0x060004E5 RID: 1253 RVA: 0x00033034 File Offset: 0x00031234
|
|
|
|
|
public static float ComputeValueFromPaintLocationY(float max, float min, float height, float paint)
|
|
|
|
|
{
|
|
|
|
|
bool flag = max - min == 0f;
|
|
|
|
|
float result;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
result = max;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
float num = max - min;
|
|
|
|
|
bool flag2 = num == 0f;
|
|
|
|
|
if (flag2)
|
|
|
|
|
{
|
|
|
|
|
num = 1f;
|
|
|
|
|
}
|
|
|
|
|
result = (height - paint) * num / height + min;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 计算绘图时的相对偏移值
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="referenceAxis">坐标轴信息</param>
|
|
|
|
|
/// <param name="height">实际绘图区域的高度</param>
|
|
|
|
|
/// <param name="value">需要绘制数据的当前值</param>
|
|
|
|
|
/// <returns>相对于0的位置,还需要增加上面的偏值</returns>
|
|
|
|
|
// Token: 0x060004E6 RID: 1254 RVA: 0x0003307C File Offset: 0x0003127C
|
|
|
|
|
public static float ComputePaintLocationY(ReferenceAxis referenceAxis, float height, float value)
|
|
|
|
|
{
|
|
|
|
|
return HslHelper.ComputePaintLocationY(referenceAxis.Max, referenceAxis.Min, height, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 绘制坐标系中的刻度线
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="g">绘图对象</param>
|
|
|
|
|
/// <param name="penLine">画坐标轴的画笔</param>
|
|
|
|
|
/// <param name="penDash"></param>
|
|
|
|
|
/// <param name="font"></param>
|
|
|
|
|
/// <param name="brush"></param>
|
|
|
|
|
/// <param name="sf"></param>
|
|
|
|
|
/// <param name="degree"></param>
|
|
|
|
|
/// <param name="max"></param>
|
|
|
|
|
/// <param name="min"></param>
|
|
|
|
|
/// <param name="width"></param>
|
|
|
|
|
/// <param name="height"></param>
|
|
|
|
|
/// <param name="left"></param>
|
|
|
|
|
/// <param name="right"></param>
|
|
|
|
|
/// <param name="up"></param>
|
|
|
|
|
/// <param name="down"></param>
|
|
|
|
|
// Token: 0x060004E7 RID: 1255 RVA: 0x000330A4 File Offset: 0x000312A4
|
|
|
|
|
public static void PaintCoordinateDivide(Graphics g, System.Drawing.Pen penLine, System.Drawing.Pen penDash, Font font, System.Drawing.Brush brush, StringFormat sf, int degree, int max, int min, int width, int height, int left = 60, int right = 8, int up = 8, int down = 8)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i <= degree; i++)
|
|
|
|
|
{
|
|
|
|
|
int value = (max - min) * i / degree + min;
|
|
|
|
|
int num = (int)HslHelper.ComputePaintLocationY(max, min, height - up - down, value) + up + 1;
|
|
|
|
|
g.DrawLine(penLine, left - 1, num, left - 4, num);
|
|
|
|
|
bool flag = i != 0;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
g.DrawLine(penDash, left, num, width - right, num);
|
|
|
|
|
}
|
|
|
|
|
g.DrawString(value.ToString(), font, brush, new Rectangle(-5, num - font.Height / 2, left, font.Height), sf);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据指定的方向绘制一个箭头
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="g"></param>
|
|
|
|
|
/// <param name="brush"></param>
|
|
|
|
|
/// <param name="point"></param>
|
|
|
|
|
/// <param name="size"></param>
|
|
|
|
|
/// <param name="direction"></param>
|
|
|
|
|
// Token: 0x060004E8 RID: 1256 RVA: 0x00033158 File Offset: 0x00031358
|
|
|
|
|
public static void PaintTriangle(Graphics g, System.Drawing.Brush brush, Point point, int size, GraphDirection direction)
|
|
|
|
|
{
|
|
|
|
|
Point[] array = new Point[4];
|
|
|
|
|
bool flag = direction == GraphDirection.Leftward;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
array[0] = new Point(point.X, point.Y - size);
|
|
|
|
|
array[1] = new Point(point.X, point.Y + size);
|
|
|
|
|
array[2] = new Point(point.X - 2 * size, point.Y);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag2 = direction == GraphDirection.Rightward;
|
|
|
|
|
if (flag2)
|
|
|
|
|
{
|
|
|
|
|
array[0] = new Point(point.X, point.Y - size);
|
|
|
|
|
array[1] = new Point(point.X, point.Y + size);
|
|
|
|
|
array[2] = new Point(point.X + 2 * size, point.Y);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag3 = direction == GraphDirection.Upward;
|
|
|
|
|
if (flag3)
|
|
|
|
|
{
|
|
|
|
|
array[0] = new Point(point.X - size, point.Y);
|
|
|
|
|
array[1] = new Point(point.X + size, point.Y);
|
|
|
|
|
array[2] = new Point(point.X, point.Y - 2 * size);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
array[0] = new Point(point.X - size, point.Y);
|
|
|
|
|
array[1] = new Point(point.X + size, point.Y);
|
|
|
|
|
array[2] = new Point(point.X, point.Y + 2 * size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
array[3] = array[0];
|
|
|
|
|
g.FillPolygon(brush, array);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 绘制向左或是向右的箭头,例如 << 或是 >>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="g">画刷资源</param>
|
|
|
|
|
/// <param name="pen">画笔资源</param>
|
|
|
|
|
/// <param name="rectangle">绘制的矩形</param>
|
|
|
|
|
/// <param name="direction">方向信息</param>
|
|
|
|
|
// Token: 0x060004E9 RID: 1257 RVA: 0x0003330C File Offset: 0x0003150C
|
|
|
|
|
public static void DrawLeftRight(Graphics g, System.Drawing.Pen pen, Rectangle rectangle, GraphDirection direction)
|
|
|
|
|
{
|
|
|
|
|
bool flag = direction == GraphDirection.Leftward;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
g.DrawLines(pen, new Point[]
|
|
|
|
|
{
|
|
|
|
|
new Point(rectangle.X + rectangle.Width / 2, rectangle.Y),
|
|
|
|
|
new Point(rectangle.X, rectangle.Y + rectangle.Height / 2),
|
|
|
|
|
new Point(rectangle.X + rectangle.Width / 2, rectangle.Y + rectangle.Height)
|
|
|
|
|
});
|
|
|
|
|
g.DrawLines(pen, new Point[]
|
|
|
|
|
{
|
|
|
|
|
new Point(rectangle.X + rectangle.Width, rectangle.Y),
|
|
|
|
|
new Point(rectangle.X + rectangle.Width / 2, rectangle.Y + rectangle.Height / 2),
|
|
|
|
|
new Point(rectangle.X + rectangle.Width, rectangle.Y + rectangle.Height)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag2 = direction == GraphDirection.Rightward;
|
|
|
|
|
if (flag2)
|
|
|
|
|
{
|
|
|
|
|
g.DrawLines(pen, new Point[]
|
|
|
|
|
{
|
|
|
|
|
new Point(rectangle.X, rectangle.Y),
|
|
|
|
|
new Point(rectangle.X + rectangle.Width / 2, rectangle.Y + rectangle.Height / 2),
|
|
|
|
|
new Point(rectangle.X, rectangle.Y + rectangle.Height)
|
|
|
|
|
});
|
|
|
|
|
g.DrawLines(pen, new Point[]
|
|
|
|
|
{
|
|
|
|
|
new Point(rectangle.X + rectangle.Width / 2, rectangle.Y),
|
|
|
|
|
new Point(rectangle.X + rectangle.Width, rectangle.Y + rectangle.Height / 2),
|
|
|
|
|
new Point(rectangle.X + rectangle.Width / 2, rectangle.Y + rectangle.Height)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据指定的方向绘制一个箭头
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="g"></param>
|
|
|
|
|
/// <param name="brush"></param>
|
|
|
|
|
/// <param name="point"></param>
|
|
|
|
|
/// <param name="size"></param>
|
|
|
|
|
/// <param name="direction"></param>
|
|
|
|
|
// Token: 0x060004EA RID: 1258 RVA: 0x00033548 File Offset: 0x00031748
|
|
|
|
|
public static void PaintTriangle(Graphics g, System.Drawing.Brush brush, PointF point, int size, GraphDirection direction)
|
|
|
|
|
{
|
|
|
|
|
PointF[] array = new PointF[4];
|
|
|
|
|
bool flag = direction == GraphDirection.Leftward;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
array[0] = new PointF(point.X, point.Y - (float)size);
|
|
|
|
|
array[1] = new PointF(point.X, point.Y + (float)size);
|
|
|
|
|
array[2] = new PointF(point.X - (float)(2 * size), point.Y);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag2 = direction == GraphDirection.Rightward;
|
|
|
|
|
if (flag2)
|
|
|
|
|
{
|
|
|
|
|
array[0] = new PointF(point.X, point.Y - (float)size);
|
|
|
|
|
array[1] = new PointF(point.X, point.Y + (float)size);
|
|
|
|
|
array[2] = new PointF(point.X + (float)(2 * size), point.Y);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag3 = direction == GraphDirection.Upward;
|
|
|
|
|
if (flag3)
|
|
|
|
|
{
|
|
|
|
|
array[0] = new PointF(point.X - (float)size, point.Y);
|
|
|
|
|
array[1] = new PointF(point.X + (float)size, point.Y);
|
|
|
|
|
array[2] = new PointF(point.X, point.Y - (float)(2 * size));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
array[0] = new PointF(point.X - (float)size, point.Y);
|
|
|
|
|
array[1] = new PointF(point.X + (float)size, point.Y);
|
|
|
|
|
array[2] = new PointF(point.X, point.Y + (float)(2 * size));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
array[3] = array[0];
|
|
|
|
|
g.FillPolygon(brush, array);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 一个通用的数组新增个数方法,会自动判断越界情况,越界的情况下,会自动的截断或是填充 ->
|
|
|
|
|
/// A common array of new methods, will automatically determine the cross-border situation, in the case of cross-border, will be automatically truncated or filled
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T">数据类型</typeparam>
|
|
|
|
|
/// <param name="array">原数据</param>
|
|
|
|
|
/// <param name="data">等待新增的数据</param>
|
|
|
|
|
/// <param name="max">原数据的最大值</param>
|
|
|
|
|
// Token: 0x060004EB RID: 1259 RVA: 0x00033708 File Offset: 0x00031908
|
|
|
|
|
public static void AddArrayData<T>(ref T[] array, T[] data, int max)
|
|
|
|
|
{
|
|
|
|
|
bool flag = data == null;
|
|
|
|
|
if (!flag)
|
|
|
|
|
{
|
|
|
|
|
bool flag2 = data.Length == 0;
|
|
|
|
|
if (!flag2)
|
|
|
|
|
{
|
|
|
|
|
bool flag3 = array.Length == max;
|
|
|
|
|
if (flag3)
|
|
|
|
|
{
|
|
|
|
|
Array.Copy(array, data.Length, array, 0, array.Length - data.Length);
|
|
|
|
|
Array.Copy(data, 0, array, array.Length - data.Length, data.Length);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag4 = array.Length + data.Length > max;
|
|
|
|
|
if (flag4)
|
|
|
|
|
{
|
|
|
|
|
T[] array2 = new T[max];
|
|
|
|
|
for (int i = 0; i < max - data.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
array2[i] = array[i + (array.Length - max + data.Length)];
|
|
|
|
|
}
|
|
|
|
|
for (int j = 0; j < data.Length; j++)
|
|
|
|
|
{
|
|
|
|
|
array2[array2.Length - data.Length + j] = data[j];
|
|
|
|
|
}
|
|
|
|
|
array = array2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
T[] array3 = new T[array.Length + data.Length];
|
|
|
|
|
for (int k = 0; k < array.Length; k++)
|
|
|
|
|
{
|
|
|
|
|
array3[k] = array[k];
|
|
|
|
|
}
|
|
|
|
|
for (int l = 0; l < data.Length; l++)
|
|
|
|
|
{
|
|
|
|
|
array3[array3.Length - data.Length + l] = data[l];
|
|
|
|
|
}
|
|
|
|
|
array = array3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 尺寸转换,计算旋转后的尺寸。
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="size"></param>
|
|
|
|
|
/// <param name="angle"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
// Token: 0x060004EC RID: 1260 RVA: 0x00033874 File Offset: 0x00031A74
|
|
|
|
|
public static SizeF ConvertSize(SizeF size, float angle)
|
|
|
|
|
{
|
|
|
|
|
System.Drawing.Drawing2D.Matrix matrix = new System.Drawing.Drawing2D.Matrix();
|
|
|
|
|
matrix.Rotate(angle);
|
|
|
|
|
PointF[] array = new PointF[4];
|
|
|
|
|
array[0].X = -size.Width / 2f;
|
|
|
|
|
array[0].Y = -size.Height / 2f;
|
|
|
|
|
array[1].X = -size.Width / 2f;
|
|
|
|
|
array[1].Y = size.Height / 2f;
|
|
|
|
|
array[2].X = size.Width / 2f;
|
|
|
|
|
array[2].Y = size.Height / 2f;
|
|
|
|
|
array[3].X = size.Width / 2f;
|
|
|
|
|
array[3].Y = -size.Height / 2f;
|
|
|
|
|
matrix.TransformPoints(array);
|
|
|
|
|
float num = float.MaxValue;
|
|
|
|
|
float num2 = float.MinValue;
|
|
|
|
|
float num3 = float.MaxValue;
|
|
|
|
|
float num4 = float.MinValue;
|
|
|
|
|
foreach (PointF pointF in array)
|
|
|
|
|
{
|
|
|
|
|
bool flag = pointF.X < num;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
num = pointF.X;
|
|
|
|
|
}
|
|
|
|
|
bool flag2 = pointF.X > num2;
|
|
|
|
|
if (flag2)
|
|
|
|
|
{
|
|
|
|
|
num2 = pointF.X;
|
|
|
|
|
}
|
|
|
|
|
bool flag3 = pointF.Y < num3;
|
|
|
|
|
if (flag3)
|
|
|
|
|
{
|
|
|
|
|
num3 = pointF.Y;
|
|
|
|
|
}
|
|
|
|
|
bool flag4 = pointF.Y > num4;
|
|
|
|
|
if (flag4)
|
|
|
|
|
{
|
|
|
|
|
num4 = pointF.Y;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
SizeF result = new SizeF(num2 - num, num4 - num3);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 绘制旋转文本
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="g"></param>
|
|
|
|
|
/// <param name="s"></param>
|
|
|
|
|
/// <param name="font"></param>
|
|
|
|
|
/// <param name="brush"></param>
|
|
|
|
|
/// <param name="point"></param>
|
|
|
|
|
/// <param name="format"></param>
|
|
|
|
|
/// <param name="angle"></param>
|
|
|
|
|
// Token: 0x060004ED RID: 1261 RVA: 0x00033A2C File Offset: 0x00031C2C
|
|
|
|
|
public static void DrawString(Graphics g, string s, Font font, System.Drawing.Brush brush, PointF point, StringFormat format, float angle)
|
|
|
|
|
{
|
|
|
|
|
System.Drawing.Drawing2D.Matrix transform = g.Transform;
|
|
|
|
|
System.Drawing.Drawing2D.Matrix transform2 = g.Transform;
|
|
|
|
|
transform2.RotateAt(angle, point);
|
|
|
|
|
g.Transform = transform2;
|
|
|
|
|
g.DrawString(s, font, brush, point, format);
|
|
|
|
|
g.Transform = transform;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Token: 0x060004EE RID: 1262 RVA: 0x00033A74 File Offset: 0x00031C74
|
|
|
|
|
private static int GetPow(int digit)
|
|
|
|
|
{
|
|
|
|
|
int num = 1;
|
|
|
|
|
for (int i = 0; i < digit; i++)
|
|
|
|
|
{
|
|
|
|
|
num *= 10;
|
|
|
|
|
}
|
|
|
|
|
return num;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 将int数组转换为double数组
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="values">int数组值</param>
|
|
|
|
|
/// <returns>结果值</returns>
|
|
|
|
|
// Token: 0x060004EF RID: 1263 RVA: 0x00033AA0 File Offset: 0x00031CA0
|
|
|
|
|
public static double[] TranlateArrayToDouble(int[] values)
|
|
|
|
|
{
|
|
|
|
|
bool flag = values == null;
|
|
|
|
|
double[] result;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
result = null;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
double[] array = new double[values.Length];
|
|
|
|
|
for (int i = 0; i < values.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
array[i] = (double)values[i];
|
|
|
|
|
}
|
|
|
|
|
result = array;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 将float数组转换为double数组值
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="values">float数组值</param>
|
|
|
|
|
/// <returns>结果值</returns>
|
|
|
|
|
// Token: 0x060004F0 RID: 1264 RVA: 0x00033AE8 File Offset: 0x00031CE8
|
|
|
|
|
public static double[] TranlateArrayToDouble(float[] values)
|
|
|
|
|
{
|
|
|
|
|
double[] array = new double[values.Length];
|
|
|
|
|
for (int i = 0; i < values.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
array[i] = (double)values[i];
|
|
|
|
|
}
|
|
|
|
|
return array;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获得数据的上限值,这个上限值是自动计算的。
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="values">数据值</param>
|
|
|
|
|
/// <returns>数据值</returns>
|
|
|
|
|
// Token: 0x060004F1 RID: 1265 RVA: 0x00033B20 File Offset: 0x00031D20
|
|
|
|
|
public static int CalculateMaxSectionFrom(double[] values)
|
|
|
|
|
{
|
|
|
|
|
double num = values.Max();
|
|
|
|
|
bool flag = num <= 5.0;
|
|
|
|
|
int result;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
result = 5;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag2 = num <= 9.0;
|
|
|
|
|
if (flag2)
|
|
|
|
|
{
|
|
|
|
|
result = 10;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int num2 = Convert.ToInt32(Math.Ceiling(num));
|
|
|
|
|
int digit = num2.ToString().Length - 2;
|
|
|
|
|
int num3 = int.Parse(num2.ToString().Substring(0, 2));
|
|
|
|
|
bool flag3 = num3 < 11;
|
|
|
|
|
if (flag3)
|
|
|
|
|
{
|
|
|
|
|
result = 12 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag4 = num3 < 13;
|
|
|
|
|
if (flag4)
|
|
|
|
|
{
|
|
|
|
|
result = 14 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag5 = num3 < 15;
|
|
|
|
|
if (flag5)
|
|
|
|
|
{
|
|
|
|
|
result = 16 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag6 = num3 < 17;
|
|
|
|
|
if (flag6)
|
|
|
|
|
{
|
|
|
|
|
result = 18 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag7 = num3 < 19;
|
|
|
|
|
if (flag7)
|
|
|
|
|
{
|
|
|
|
|
result = 20 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag8 = num3 < 21;
|
|
|
|
|
if (flag8)
|
|
|
|
|
{
|
|
|
|
|
result = 22 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag9 = num3 < 23;
|
|
|
|
|
if (flag9)
|
|
|
|
|
{
|
|
|
|
|
result = 24 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag10 = num3 < 25;
|
|
|
|
|
if (flag10)
|
|
|
|
|
{
|
|
|
|
|
result = 26 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag11 = num3 < 27;
|
|
|
|
|
if (flag11)
|
|
|
|
|
{
|
|
|
|
|
result = 28 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag12 = num3 < 29;
|
|
|
|
|
if (flag12)
|
|
|
|
|
{
|
|
|
|
|
result = 30 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag13 = num3 < 33;
|
|
|
|
|
if (flag13)
|
|
|
|
|
{
|
|
|
|
|
result = 34 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag14 = num3 < 40;
|
|
|
|
|
if (flag14)
|
|
|
|
|
{
|
|
|
|
|
result = 40 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag15 = num3 < 50;
|
|
|
|
|
if (flag15)
|
|
|
|
|
{
|
|
|
|
|
result = 50 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag16 = num3 < 60;
|
|
|
|
|
if (flag16)
|
|
|
|
|
{
|
|
|
|
|
result = 60 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag17 = num3 < 80;
|
|
|
|
|
if (flag17)
|
|
|
|
|
{
|
|
|
|
|
result = 80 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag18 = num3 < 95;
|
|
|
|
|
if (flag18)
|
|
|
|
|
{
|
|
|
|
|
result = 100 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = 100 * HslHelper.GetPow(digit);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc cref="M:HslControls.HslHelper.CalculateMaxSectionFrom(System.Double[])" />
|
|
|
|
|
// Token: 0x060004F2 RID: 1266 RVA: 0x00033D50 File Offset: 0x00031F50
|
|
|
|
|
public static int CalculateMaxSectionFrom(Dictionary<string, double[]> values)
|
|
|
|
|
{
|
|
|
|
|
return HslHelper.CalculateMaxSectionFrom((from m in values
|
|
|
|
|
select m.Value.Max()).ToArray<double>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取当前颜色更淡的颜色信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="color">颜色信息</param>
|
|
|
|
|
/// <returns>颜色</returns>
|
|
|
|
|
// Token: 0x060004F3 RID: 1267 RVA: 0x00033D94 File Offset: 0x00031F94
|
|
|
|
|
public static System.Drawing.Color GetColorLight(System.Drawing.Color color)
|
|
|
|
|
{
|
|
|
|
|
return HslHelper.GetColorLight(color, 40);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取当前颜色更深的颜色信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="color">颜色信息</param>
|
|
|
|
|
/// <returns>颜色</returns>
|
|
|
|
|
// Token: 0x060004F4 RID: 1268 RVA: 0x00033DB0 File Offset: 0x00031FB0
|
|
|
|
|
public static System.Drawing.Color GetColorDeep(System.Drawing.Color color)
|
|
|
|
|
{
|
|
|
|
|
return HslHelper.GetColorLight(color, -40);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取当前颜色更淡的颜色信息,需要指定系数0-100,0时是原来的原色,100时是纯白色
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="color">颜色信息</param>
|
|
|
|
|
/// <param name="scale">获取颜色的系数信息</param>
|
|
|
|
|
/// <returns>颜色</returns>
|
|
|
|
|
// Token: 0x060004F5 RID: 1269 RVA: 0x00033DCC File Offset: 0x00031FCC
|
|
|
|
|
public static System.Drawing.Color GetColorLight(System.Drawing.Color color, int scale)
|
|
|
|
|
{
|
|
|
|
|
bool flag = scale > 0;
|
|
|
|
|
System.Drawing.Color result;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
result = System.Drawing.Color.FromArgb((int)color.R + (int)(byte.MaxValue - color.R) * scale / 100, (int)color.G + (int)(byte.MaxValue - color.G) * scale / 100, (int)color.B + (int)(byte.MaxValue - color.B) * scale / 100);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = System.Drawing.Color.FromArgb((int)color.R + (int)color.R * scale / 100, (int)color.G + (int)color.G * scale / 100, (int)color.B + (int)color.B * scale / 100);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取颜色的偏移信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="color">颜色值</param>
|
|
|
|
|
/// <param name="offset">颜色偏移信息</param>
|
|
|
|
|
/// <returns>颜色值</returns>
|
|
|
|
|
// Token: 0x060004F6 RID: 1270 RVA: 0x00033E80 File Offset: 0x00032080
|
|
|
|
|
public static System.Drawing.Color GetColorOffset(System.Drawing.Color color, int offset)
|
|
|
|
|
{
|
|
|
|
|
int num = (int)color.R + offset;
|
|
|
|
|
bool flag = num < 0;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
num = 0;
|
|
|
|
|
}
|
|
|
|
|
bool flag2 = num > 255;
|
|
|
|
|
if (flag2)
|
|
|
|
|
{
|
|
|
|
|
num = 255;
|
|
|
|
|
}
|
|
|
|
|
int num2 = (int)color.G + offset;
|
|
|
|
|
bool flag3 = num2 < 0;
|
|
|
|
|
if (flag3)
|
|
|
|
|
{
|
|
|
|
|
num2 = 0;
|
|
|
|
|
}
|
|
|
|
|
bool flag4 = num2 > 255;
|
|
|
|
|
if (flag4)
|
|
|
|
|
{
|
|
|
|
|
num2 = 255;
|
|
|
|
|
}
|
|
|
|
|
int num3 = (int)color.B + offset;
|
|
|
|
|
bool flag5 = num3 < 0;
|
|
|
|
|
if (flag5)
|
|
|
|
|
{
|
|
|
|
|
num3 = 0;
|
|
|
|
|
}
|
|
|
|
|
bool flag6 = num3 > 255;
|
|
|
|
|
if (flag6)
|
|
|
|
|
{
|
|
|
|
|
num3 = 255;
|
|
|
|
|
}
|
|
|
|
|
return System.Drawing.Color.FromArgb(num, num2, num3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取当前颜色更淡的颜色信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="color">颜色信息</param>
|
|
|
|
|
/// <returns>颜色</returns>
|
|
|
|
|
// Token: 0x060004F7 RID: 1271 RVA: 0x00033F18 File Offset: 0x00032118
|
|
|
|
|
public static System.Drawing.Color GetColorLightFive(System.Drawing.Color color)
|
|
|
|
|
{
|
|
|
|
|
return HslHelper.GetColorLight(color, 50);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 从字符串表示的点位信息里解析出真正的点位信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="points">字符串的点位</param>
|
|
|
|
|
/// <param name="soureWidth">原来的长度信息</param>
|
|
|
|
|
/// <param name="sourceHeight">原来的高度信息</param>
|
|
|
|
|
/// <param name="width">实际的宽度信息</param>
|
|
|
|
|
/// <param name="height">实际的高度信息</param>
|
|
|
|
|
/// <param name="dx">x偏移量信息</param>
|
|
|
|
|
/// <param name="dy">y偏移量信息</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
// Token: 0x060004FA RID: 1274 RVA: 0x0003400C File Offset: 0x0003220C
|
|
|
|
|
public static PointF[] GetPointsFrom(string points, float soureWidth, float sourceHeight, float width, float height, float dx = 0f, float dy = 0f)
|
|
|
|
|
{
|
|
|
|
|
string[] array = points.Split(new char[]
|
|
|
|
|
{
|
|
|
|
|
' '
|
|
|
|
|
}, StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
PointF[] array2 = new PointF[array.Length];
|
|
|
|
|
for (int i = 0; i < array.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
int num = array[i].IndexOf(',');
|
|
|
|
|
float num2 = Convert.ToSingle(array[i].Substring(0, num));
|
|
|
|
|
float num3 = Convert.ToSingle(array[i].Substring(num + 1));
|
|
|
|
|
array2[i] = new PointF(width * (num2 + dx) / soureWidth, height * (num3 + dy) / sourceHeight);
|
|
|
|
|
}
|
|
|
|
|
return array2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据矩形及其各个定点的配置信息,获取圆角的路径信息,可以指定每个定点的圆角情况
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="rectangle"></param>
|
|
|
|
|
/// <param name="radius"></param>
|
|
|
|
|
/// <param name="topLeft"></param>
|
|
|
|
|
/// <param name="topRight"></param>
|
|
|
|
|
/// <param name="buttomRight"></param>
|
|
|
|
|
/// <param name="buttomLeft"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
// Token: 0x060004FB RID: 1275 RVA: 0x000340A0 File Offset: 0x000322A0
|
|
|
|
|
public static GraphicsPath GetRoundRectange(Rectangle rectangle, int radius, bool topLeft, bool topRight, bool buttomRight, bool buttomLeft)
|
|
|
|
|
{
|
|
|
|
|
GraphicsPath graphicsPath = new GraphicsPath();
|
|
|
|
|
Point pt = new Point(rectangle.X + (topLeft ? radius : 0), rectangle.Y);
|
|
|
|
|
Point pt2 = new Point(rectangle.X + rectangle.Width - 1 - (topRight ? radius : 0), rectangle.Y);
|
|
|
|
|
graphicsPath.AddLine(pt, pt2);
|
|
|
|
|
bool flag = topRight && radius > 0;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
graphicsPath.AddArc(rectangle.X + rectangle.Width - radius * 2 - 1, rectangle.Y, radius * 2, radius * 2, 270f, 90f);
|
|
|
|
|
}
|
|
|
|
|
Point pt3 = new Point(rectangle.X + rectangle.Width - 1, rectangle.Y + (topRight ? radius : 0));
|
|
|
|
|
Point pt4 = new Point(rectangle.X + rectangle.Width - 1, rectangle.Y + rectangle.Height - 1 - (buttomRight ? radius : 0));
|
|
|
|
|
graphicsPath.AddLine(pt3, pt4);
|
|
|
|
|
bool flag2 = buttomRight && radius > 0;
|
|
|
|
|
if (flag2)
|
|
|
|
|
{
|
|
|
|
|
graphicsPath.AddArc(rectangle.X + rectangle.Width - radius * 2 - 1, rectangle.Y + rectangle.Height - radius * 2 - 1, radius * 2, radius * 2, 0f, 90f);
|
|
|
|
|
}
|
|
|
|
|
Point pt5 = new Point(rectangle.X + rectangle.Width - 1 - (buttomRight ? radius : 0), rectangle.Y + rectangle.Height - 1);
|
|
|
|
|
Point pt6 = new Point(rectangle.X + (buttomLeft ? radius : 0), rectangle.Y + rectangle.Height - 1);
|
|
|
|
|
graphicsPath.AddLine(pt5, pt6);
|
|
|
|
|
bool flag3 = buttomLeft && radius > 0;
|
|
|
|
|
if (flag3)
|
|
|
|
|
{
|
|
|
|
|
graphicsPath.AddArc(rectangle.X, rectangle.Y + rectangle.Height - radius * 2 - 1, radius * 2, radius * 2, 90f, 90f);
|
|
|
|
|
}
|
|
|
|
|
Point pt7 = new Point(rectangle.X, rectangle.Y + rectangle.Height - 1 - (buttomLeft ? radius : 0));
|
|
|
|
|
Point pt8 = new Point(rectangle.X, rectangle.Y + (topLeft ? radius : 0));
|
|
|
|
|
graphicsPath.AddLine(pt7, pt8);
|
|
|
|
|
bool flag4 = topLeft && radius > 0;
|
|
|
|
|
if (flag4)
|
|
|
|
|
{
|
|
|
|
|
graphicsPath.AddArc(rectangle.X, rectangle.Y, radius * 2, radius * 2, 180f, 90f);
|
|
|
|
|
}
|
|
|
|
|
return graphicsPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Token: 0x060004FC RID: 1276 RVA: 0x00034330 File Offset: 0x00032530
|
|
|
|
|
private static string FloatMatchEvaluator(Match m)
|
|
|
|
|
{
|
|
|
|
|
bool flag = m.Value.Length == 5;
|
|
|
|
|
string result;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
result = m.Value.Substring(0, 3);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = m.Value.Substring(0, 2);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Token: 0x060004FD RID: 1277 RVA: 0x00034374 File Offset: 0x00032574
|
|
|
|
|
private static string RemoveEndWithZero(string value)
|
|
|
|
|
{
|
|
|
|
|
return Regex.Replace(value, "\\.[0]+$", "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Token: 0x060004FE RID: 1278 RVA: 0x00034398 File Offset: 0x00032598
|
|
|
|
|
public static float GetReferenceAxisMaxValue(float max)
|
|
|
|
|
{
|
|
|
|
|
bool flag = max >= 0f;
|
|
|
|
|
float result;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
int floatPow = HslHelper.GetFloatPow(max);
|
|
|
|
|
float num = (float)((double)max * Math.Pow(10.0, (double)(-(double)floatPow)));
|
|
|
|
|
bool flag2 = num == 0f;
|
|
|
|
|
if (flag2)
|
|
|
|
|
{
|
|
|
|
|
result = 1f;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag3 = num < 1.1f;
|
|
|
|
|
if (flag3)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(1.2000000476837158 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag4 = num < 1.3f;
|
|
|
|
|
if (flag4)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(1.399999976158142 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag5 = num < 1.5f;
|
|
|
|
|
if (flag5)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(1.600000023841858 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag6 = num < 1.7f;
|
|
|
|
|
if (flag6)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(1.7999999523162842 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag7 = num < 1.9f;
|
|
|
|
|
if (flag7)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(2.0 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag8 = num < 2.2f;
|
|
|
|
|
if (flag8)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(2.4000000953674316 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag9 = num < 2.4f;
|
|
|
|
|
if (flag9)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(2.5999999046325684 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag10 = num < 2.6f;
|
|
|
|
|
if (flag10)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(2.799999952316284 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag11 = num < 2.8f;
|
|
|
|
|
if (flag11)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(3.0 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag12 = num < 3.3f;
|
|
|
|
|
if (flag12)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(3.5 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag13 = num < 3.8f;
|
|
|
|
|
if (flag13)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(4.0 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag14 = num < 4.5f;
|
|
|
|
|
if (flag14)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(5.0 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag15 = num < 6.5f;
|
|
|
|
|
if (flag15)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(6.0 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag16 = num < 7.5f;
|
|
|
|
|
if (flag16)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(8.0 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag17 = num < 9.5f;
|
|
|
|
|
if (flag17)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(10.0 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(12.0 * Math.Pow(10.0, (double)floatPow));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int floatPow2 = HslHelper.GetFloatPow(-max);
|
|
|
|
|
float num2 = (float)((double)max * Math.Pow(10.0, (double)(-(double)floatPow2)));
|
|
|
|
|
bool flag18 = num2 < -8.5f;
|
|
|
|
|
if (flag18)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(-8.0 * Math.Pow(10.0, (double)floatPow2));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag19 = num2 < -6.5f;
|
|
|
|
|
if (flag19)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(-6.0 * Math.Pow(10.0, (double)floatPow2));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag20 = num2 < -4.5f;
|
|
|
|
|
if (flag20)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(-4.0 * Math.Pow(10.0, (double)floatPow2));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag21 = num2 < -3.5f;
|
|
|
|
|
if (flag21)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(-3.0 * Math.Pow(10.0, (double)floatPow2));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag22 = num2 < -2.2f;
|
|
|
|
|
if (flag22)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(-2.0 * Math.Pow(10.0, (double)floatPow2));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag23 = num2 < -1.9f;
|
|
|
|
|
if (flag23)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(-1.7999999523162842 * Math.Pow(10.0, (double)floatPow2));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag24 = num2 < -1.7f;
|
|
|
|
|
if (flag24)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(-1.600000023841858 * Math.Pow(10.0, (double)floatPow2));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag25 = num2 < -1.5f;
|
|
|
|
|
if (flag25)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(-1.399999976158142 * Math.Pow(10.0, (double)floatPow2));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag26 = num2 < -1.3f;
|
|
|
|
|
if (flag26)
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(-1.2000000476837158 * Math.Pow(10.0, (double)floatPow2));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = Convert.ToSingle(-1.0 * Math.Pow(10.0, (double)floatPow2));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Token: 0x060004FF RID: 1279 RVA: 0x00034948 File Offset: 0x00032B48
|
|
|
|
|
private static int GetFloatPow(float value)
|
|
|
|
|
{
|
|
|
|
|
bool flag = value >= 1f && value < 10f;
|
|
|
|
|
int result;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
result = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag2 = value >= 10f;
|
|
|
|
|
if (flag2)
|
|
|
|
|
{
|
|
|
|
|
result = HslHelper.GetFloatPow(value / 10f) + 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool flag3 = value > 0f && value < 1f;
|
|
|
|
|
if (flag3)
|
|
|
|
|
{
|
|
|
|
|
result = HslHelper.GetFloatPow(value * 10f) - 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取浮点数值的格式化文本信息,如果发生了异常,则返回错误消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="format">格式化信息</param>
|
|
|
|
|
/// <param name="value">值信息</param>
|
|
|
|
|
/// <param name="remainZero">是否保留0的信息</param>
|
|
|
|
|
/// <returns>等待显示的文本</returns>
|
|
|
|
|
// Token: 0x06000500 RID: 1280 RVA: 0x000349C0 File Offset: 0x00032BC0
|
|
|
|
|
public static string GetFormatString(string format, float value, bool remainZero = false)
|
|
|
|
|
{
|
|
|
|
|
string result;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string text = string.Format(format, value);
|
|
|
|
|
if (remainZero)
|
|
|
|
|
{
|
|
|
|
|
result = HslHelper.RemoveEndWithZero(text);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = HslHelper.RemoveEndWithZero(Regex.Replace(text, "[Ee][+-][0]+", new MatchEvaluator(HslHelper.FloatMatchEvaluator)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
result = "Wrong";
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 矩形中间的字符串对齐机制
|
|
|
|
|
/// </summary>
|
|
|
|
|
// Token: 0x17000181 RID: 385
|
|
|
|
|
// (get) Token: 0x06000501 RID: 1281 RVA: 0x00034A24 File Offset: 0x00032C24
|
|
|
|
|
// (set) Token: 0x06000502 RID: 1282 RVA: 0x00034A2B File Offset: 0x00032C2B
|
|
|
|
|
public static StringFormat StringFormatCenter { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 矩形的左侧中间的对齐机制
|
|
|
|
|
/// </summary>
|
|
|
|
|
// Token: 0x17000182 RID: 386
|
|
|
|
|
// (get) Token: 0x06000503 RID: 1283 RVA: 0x00034A33 File Offset: 0x00032C33
|
|
|
|
|
// (set) Token: 0x06000504 RID: 1284 RVA: 0x00034A3A File Offset: 0x00032C3A
|
|
|
|
|
public static StringFormat StringFormatLeft { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 矩形的右侧的中间对齐机制
|
|
|
|
|
/// </summary>
|
|
|
|
|
// Token: 0x17000183 RID: 387
|
|
|
|
|
// (get) Token: 0x06000505 RID: 1285 RVA: 0x00034A42 File Offset: 0x00032C42
|
|
|
|
|
// (set) Token: 0x06000506 RID: 1286 RVA: 0x00034A49 File Offset: 0x00032C49
|
|
|
|
|
public static StringFormat StringFormatRight { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 矩形的的默认的左上角对齐的机制
|
|
|
|
|
/// </summary>
|
|
|
|
|
// Token: 0x17000184 RID: 388
|
|
|
|
|
// (get) Token: 0x06000507 RID: 1287 RVA: 0x00034A51 File Offset: 0x00032C51
|
|
|
|
|
// (set) Token: 0x06000508 RID: 1288 RVA: 0x00034A58 File Offset: 0x00032C58
|
|
|
|
|
public static StringFormat StringFormatDefault { get; set; } = new StringFormat();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 矩形的下方中间的对齐的机制
|
|
|
|
|
/// </summary>
|
|
|
|
|
// Token: 0x17000185 RID: 389
|
|
|
|
|
// (get) Token: 0x06000509 RID: 1289 RVA: 0x00034A60 File Offset: 0x00032C60
|
|
|
|
|
// (set) Token: 0x0600050A RID: 1290 RVA: 0x00034A67 File Offset: 0x00032C67
|
|
|
|
|
public static StringFormat StringFormatTopCenter { get; set; }
|
|
|
|
|
}
|
|
|
|
|
}
|