|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing.Drawing2D;
|
|
|
|
|
using System.Drawing.Text;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Controls.ChemicalWeighing
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Agv小车控件
|
|
|
|
|
/// </summary>
|
|
|
|
|
// Token: 0x02000004 RID: 4
|
|
|
|
|
[Description("Agv 小车控件")]
|
|
|
|
|
public class HslAgvCar : UserControl
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 实例化一个默认的对象
|
|
|
|
|
/// </summary>
|
|
|
|
|
// Token: 0x0600000C RID: 12 RVA: 0x00010BB4 File Offset: 0x0000EDB4
|
|
|
|
|
public HslAgvCar()
|
|
|
|
|
{
|
|
|
|
|
this.InitializeComponent();
|
|
|
|
|
base.SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
|
|
|
|
|
base.SetStyle(ControlStyles.ResizeRedraw, true);
|
|
|
|
|
base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
|
|
|
|
base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取或设置当前AGV小车的颜色信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
// Token: 0x17000001 RID: 1
|
|
|
|
|
// (get) Token: 0x0600000D RID: 13 RVA: 0x00010C50 File Offset: 0x0000EE50
|
|
|
|
|
// (set) Token: 0x0600000E RID: 14 RVA: 0x00010C6D File Offset: 0x0000EE6D
|
|
|
|
|
[Browsable(true)]
|
|
|
|
|
[Description("获取或设置当前AGV小车的颜色信息")]
|
|
|
|
|
[Category("HslControls")]
|
|
|
|
|
[DefaultValue(typeof(Color), "Tomato")]
|
|
|
|
|
public virtual Color AgvColor
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.carBrush.Color;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.carBrush.Color = value;
|
|
|
|
|
base.Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取或设置当前的轮胎的颜色
|
|
|
|
|
/// </summary>
|
|
|
|
|
// Token: 0x17000002 RID: 2
|
|
|
|
|
// (get) Token: 0x0600000F RID: 15 RVA: 0x00010C84 File Offset: 0x0000EE84
|
|
|
|
|
// (set) Token: 0x06000010 RID: 16 RVA: 0x00010C91 File Offset: 0x0000EE91
|
|
|
|
|
[Browsable(true)]
|
|
|
|
|
[Description("获取或设置当前的轮胎的颜色")]
|
|
|
|
|
[Category("HslControls")]
|
|
|
|
|
[DefaultValue(typeof(Color), "52, 52, 52")]
|
|
|
|
|
public virtual Color TireColor
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.darkBlack.Color;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.darkBlack.Color = value;
|
|
|
|
|
base.Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 重绘控件的
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="e">重绘事件</param>
|
|
|
|
|
// Token: 0x06000011 RID: 17 RVA: 0x00010CA8 File Offset: 0x0000EEA8
|
|
|
|
|
protected override void OnPaint(PaintEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
bool flag = true;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
Graphics graphics = e.Graphics;
|
|
|
|
|
graphics.SmoothingMode = SmoothingMode.HighQuality;
|
|
|
|
|
graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
|
|
|
|
|
this.PaintHslControls(graphics, base.Width, base.Height);
|
|
|
|
|
base.OnPaint(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc cref="M:HslControls.HslArrow.PaintHslControls(System.Drawing.Graphics,System.Single,System.Single)" />
|
|
|
|
|
// Token: 0x06000012 RID: 18 RVA: 0x00010CF8 File Offset: 0x0000EEF8
|
|
|
|
|
public void PaintHslControls(Graphics g, int width, int height)
|
|
|
|
|
{
|
|
|
|
|
this.PaintMain(g, width, height);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Token: 0x06000013 RID: 19 RVA: 0x00010D20 File Offset: 0x0000EF20
|
|
|
|
|
private void PaintMain(Graphics g, int width, int height)
|
|
|
|
|
{
|
|
|
|
|
int num = (int)((float)height * 0.08f);
|
|
|
|
|
bool flag = width < 50 && height < 50;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
num = (int)((float)height * 0.12f);
|
|
|
|
|
}
|
|
|
|
|
int num2 = (int)((float)width * 0.04f);
|
|
|
|
|
int num3 = (int)((float)width * 0.1f);
|
|
|
|
|
GraphicsPath graphicsPath = new GraphicsPath();
|
|
|
|
|
graphicsPath.AddArc(new Rectangle(width - num3 - num3 + 1, num, num3 + num3 - 2, num3 + num3 - 2), -90f, 90f);
|
|
|
|
|
graphicsPath.AddLine(new Point(width - 1, num + num3), new Point(width - 1, height - num - num3));
|
|
|
|
|
graphicsPath.AddArc(new Rectangle(width - num3 - num3 + 1, height - num - num3 - num3, num3 + num3 - 2, num3 + num3), 0f, 90f);
|
|
|
|
|
Rectangle rect = new Rectangle(num2, num, width - num2 - num3, height - num - num);
|
|
|
|
|
using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(new PointF(0f, (float)(height - num)), new PointF(0f, (float)num), this.carBrush.Color, HslHelper.GetColorOffset(this.carBrush.Color, height - num)))
|
|
|
|
|
{
|
|
|
|
|
linearGradientBrush.InterpolationColors = new ColorBlend
|
|
|
|
|
{
|
|
|
|
|
Positions = new float[]
|
|
|
|
|
{
|
|
|
|
|
0f,
|
|
|
|
|
0.1f,
|
|
|
|
|
0.9f,
|
|
|
|
|
1f
|
|
|
|
|
},
|
|
|
|
|
Colors = new Color[]
|
|
|
|
|
{
|
|
|
|
|
HslHelper.GetColorLight(this.carBrush.Color),
|
|
|
|
|
this.carBrush.Color,
|
|
|
|
|
this.carBrush.Color,
|
|
|
|
|
HslHelper.GetColorLight(this.carBrush.Color)
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
g.FillPath(linearGradientBrush, graphicsPath);
|
|
|
|
|
g.DrawPath(this.borderPen, graphicsPath);
|
|
|
|
|
g.FillRectangle(linearGradientBrush, rect);
|
|
|
|
|
g.DrawRectangle(this.borderPen, rect);
|
|
|
|
|
using (Pen pen = new Pen(HslHelper.GetColorLight(this.carBrush.Color, -15)))
|
|
|
|
|
{
|
|
|
|
|
g.DrawLine(pen, new Point(width - num3, num + 1), new Point(width - num3, height - num - 2));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int num4 = (int)((float)width * 0.12f);
|
|
|
|
|
int num5 = (int)((float)width * 0.28f);
|
|
|
|
|
Rectangle rect2 = new Rectangle(rect.X + rect.Width / 2 - num5 - num4 / 2, 0, num4, num * 2);
|
|
|
|
|
g.FillRectangle(this.darkBlack, rect2);
|
|
|
|
|
rect2.X = rect.X + rect.Width / 2 + num5 - num4 / 2;
|
|
|
|
|
g.FillRectangle(this.darkBlack, rect2);
|
|
|
|
|
rect2.X = rect.X + rect.Width / 2 - num5 - num4 / 2;
|
|
|
|
|
rect2.Y = height - rect2.Height;
|
|
|
|
|
g.FillRectangle(this.darkBlack, rect2);
|
|
|
|
|
rect2.X = rect.X + rect.Width / 2 + num5 - num4 / 2;
|
|
|
|
|
g.FillRectangle(this.darkBlack, rect2);
|
|
|
|
|
Point point = new Point(rect.X + rect.Width / 2, height / 2);
|
|
|
|
|
g.TranslateTransform((float)point.X, (float)point.Y);
|
|
|
|
|
int num6 = (int)((float)height * 0.36f);
|
|
|
|
|
g.FillEllipse(Brushes.LightGray, new Rectangle(-num6, -num6, num6 + num6, num6 + num6));
|
|
|
|
|
g.DrawEllipse(Pens.Gray, new Rectangle(-num6, -num6, num6 + num6, num6 + num6));
|
|
|
|
|
num6 = (int)((float)height * 0.33f);
|
|
|
|
|
for (int i = 0; i < 6; i++)
|
|
|
|
|
{
|
|
|
|
|
g.FillPie(this.darkBlack, new Rectangle(-num6, -num6, num6 + num6, num6 + num6), (float)(-115 + 60 * i), 50f);
|
|
|
|
|
}
|
|
|
|
|
num6 = (int)((float)height * 0.24f);
|
|
|
|
|
g.FillEllipse(Brushes.LightGray, new Rectangle(-num6, -num6, num6 + num6, num6 + num6));
|
|
|
|
|
num6 = (int)((float)height * 0.04f);
|
|
|
|
|
for (int j = 0; j < 4; j++)
|
|
|
|
|
{
|
|
|
|
|
g.FillEllipse(this.darkBlack, new Rectangle((int)((float)height * 0.16f) - num6, -num6, num6 * 2, num6 * 2));
|
|
|
|
|
g.RotateTransform(90f);
|
|
|
|
|
}
|
|
|
|
|
num6 = (int)((float)height * 0.06f);
|
|
|
|
|
g.FillEllipse(this.carBrush, new Rectangle(-num6, -num6, num6 + num6, num6 + num6));
|
|
|
|
|
g.TranslateTransform((float)(-(float)point.X), (float)(-(float)point.Y));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 清理所有正在使用的资源。
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
|
|
|
|
// Token: 0x06000014 RID: 20 RVA: 0x00011208 File Offset: 0x0000F408
|
|
|
|
|
protected override void Dispose(bool disposing)
|
|
|
|
|
{
|
|
|
|
|
bool flag = disposing && this.components != null;
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
this.components.Dispose();
|
|
|
|
|
}
|
|
|
|
|
base.Dispose(disposing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设计器支持所需的方法 - 不要修改
|
|
|
|
|
/// 使用代码编辑器修改此方法的内容。
|
|
|
|
|
/// </summary>
|
|
|
|
|
// Token: 0x06000015 RID: 21 RVA: 0x00011240 File Offset: 0x0000F440
|
|
|
|
|
private void InitializeComponent()
|
|
|
|
|
{
|
|
|
|
|
base.SuspendLayout();
|
|
|
|
|
base.AutoScaleMode = AutoScaleMode.None;
|
|
|
|
|
this.BackColor = Color.Transparent;
|
|
|
|
|
this.Font = new Font("微软雅黑", 9f, FontStyle.Regular, GraphicsUnit.Point, 134);
|
|
|
|
|
base.Name = "HslAgvCar";
|
|
|
|
|
base.Size = new Size(58, 65);
|
|
|
|
|
base.ResumeLayout(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Token: 0x0400000B RID: 11
|
|
|
|
|
private Color borderColor = Color.Gray;
|
|
|
|
|
|
|
|
|
|
// Token: 0x0400000C RID: 12
|
|
|
|
|
private Pen borderPen = new Pen(Color.Gray, 1f);
|
|
|
|
|
|
|
|
|
|
// Token: 0x0400000D RID: 13
|
|
|
|
|
private SolidBrush carBrush = new SolidBrush(Color.Tomato);
|
|
|
|
|
|
|
|
|
|
// Token: 0x0400000E RID: 14
|
|
|
|
|
private SolidBrush darkBlack = new SolidBrush(Color.FromArgb(52, 52, 52));
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 必需的设计器变量。
|
|
|
|
|
/// </summary>
|
|
|
|
|
// Token: 0x0400000F RID: 15
|
|
|
|
|
private IContainer components = null;
|
|
|
|
|
}
|
|
|
|
|
}
|