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
{
///
/// 移动的文本控件
///
// Token: 0x02000045 RID: 69
[Description("移动文本控件,支持文件正向反向移动,支持设置移动速度")]
public class HslMoveText : UserControl
{
///
/// 实例化一个默认的对象
///
// Token: 0x060005CE RID: 1486 RVA: 0x00039D44 File Offset: 0x00037F44
public HslMoveText()
{
this.InitializeComponent();
this.sf = new StringFormat();
this.sf.Alignment = StringAlignment.Center;
this.sf.LineAlignment = StringAlignment.Center;
base.SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
base.SetStyle(ControlStyles.ResizeRedraw, true);
base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.timer = new Timer();
this.timer.Interval = 30;
this.timer.Tick += this.Timer_Tick;
this.timer.Start();
}
///
/// 获取或设置控件的背景色
///
// Token: 0x170001CB RID: 459
// (get) Token: 0x060005CF RID: 1487 RVA: 0x00039E30 File Offset: 0x00038030
// (set) Token: 0x060005D0 RID: 1488 RVA: 0x00039E38 File Offset: 0x00038038
[Browsable(true)]
[Description("获取或设置控件的背景色")]
[Category("HslControls")]
[DefaultValue(typeof(Color), "Transparent")]
[EditorBrowsable(EditorBrowsableState.Always)]
public override Color BackColor
{
get
{
return base.BackColor;
}
set
{
base.BackColor = value;
}
}
///
/// 获取或设置当前控件的文本
///
// Token: 0x170001CC RID: 460
// (get) Token: 0x060005D1 RID: 1489 RVA: 0x00039E44 File Offset: 0x00038044
// (set) Token: 0x060005D2 RID: 1490 RVA: 0x00039E5C File Offset: 0x0003805C
[Browsable(true)]
[Description("获取或设置当前控件的文本")]
[Category("HslControls")]
[EditorBrowsable(EditorBrowsableState.Always)]
[Bindable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
base.Invalidate();
}
}
///
/// 获取或设置泵控件是否是横向的还是纵向的
///
// Token: 0x170001CD RID: 461
// (get) Token: 0x060005D3 RID: 1491 RVA: 0x00039E70 File Offset: 0x00038070
// (set) Token: 0x060005D4 RID: 1492 RVA: 0x00039E88 File Offset: 0x00038088
[Browsable(true)]
[Description("获取或设置泵控件是否是横向的还是纵向的")]
[Category("HslControls")]
[DefaultValue(typeof(HslDirectionStyle), "Vertical")]
public HslDirectionStyle PumpStyle
{
get
{
return this.hslValvesStyle;
}
set
{
this.hslValvesStyle = value;
base.Invalidate();
}
}
///
/// 获取或设置泵的动画速度,0为静止,正数为正向流动,负数为反向流动
///
// Token: 0x170001CE RID: 462
// (get) Token: 0x060005D5 RID: 1493 RVA: 0x00039E9C File Offset: 0x0003809C
// (set) Token: 0x060005D6 RID: 1494 RVA: 0x00039EB4 File Offset: 0x000380B4
[Browsable(true)]
[Description("获取或设置传送带流动的速度,0为静止,正数为正向流动,负数为反向流动")]
[Category("HslControls")]
[DefaultValue(1f)]
public float MoveSpeed
{
get
{
return this.moveSpeed;
}
set
{
this.moveSpeed = value;
base.Invalidate();
}
}
///
/// 重绘控件的
///
/// 重绘事件
// Token: 0x060005D7 RID: 1495 RVA: 0x00039EC8 File Offset: 0x000380C8
protected override void OnPaint(PaintEventArgs e)
{
Graphics graphics = e.Graphics;
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
this.PaintHslControls(graphics, base.Width, base.Height);
base.OnPaint(e);
}
///
// Token: 0x060005D8 RID: 1496 RVA: 0x00039F18 File Offset: 0x00038118
public void PaintHslControls(Graphics g, int width, int height)
{
bool flag2 = this.hslValvesStyle == HslDirectionStyle.Vertical;
if (flag2)
{
this.PaintMain(g, (float)width, (float)height);
}
else
{
g.TranslateTransform((float)width, 0f);
g.RotateTransform(90f);
this.PaintMain(g, (float)height, (float)width);
g.ResetTransform();
}
}
// Token: 0x060005D9 RID: 1497 RVA: 0x00039F80 File Offset: 0x00038180
private void PaintMain(Graphics g, float width, float height)
{
this.fontWidth = g.MeasureString(this.Text, this.Font).Width + 3f;
Brush brush = new SolidBrush(this.ForeColor);
RectangleF layoutRectangle = new RectangleF(this.startLocationX, 0f, this.fontWidth, height);
g.DrawString(this.Text, this.Font, brush, layoutRectangle, this.sf);
}
// Token: 0x060005DA RID: 1498 RVA: 0x00039FF4 File Offset: 0x000381F4
private PointF[] GetPointsFrom(string points, float width, float height, float dx = 0f, float dy = 0f)
{
return HslHelper.GetPointsFrom(points, 80.7f, 112.5f, width, height, dx, dy);
}
// Token: 0x060005DB RID: 1499 RVA: 0x0003A01C File Offset: 0x0003821C
private void Timer_Tick(object sender, EventArgs e)
{
if (this.moveSpeed != 0f)
{
if (this.startLocationX < -this.fontWidth - 5f)
{
this.startLocationX = (float)(base.Width + 1);
}
else
{
this.startLocationX -= this.moveSpeed;
}
base.Invalidate();
}
}
///
/// 清理所有正在使用的资源。
///
/// 如果应释放托管资源,为 true;否则为 false。
// Token: 0x060005DC RID: 1500 RVA: 0x0003A088 File Offset: 0x00038288
protected override void Dispose(bool disposing)
{
bool flag = disposing && this.components != null;
if (flag)
{
this.components.Dispose();
}
base.Dispose(disposing);
}
///
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
///
// Token: 0x060005DD RID: 1501 RVA: 0x0003A0C0 File Offset: 0x000382C0
private void InitializeComponent()
{
base.SuspendLayout();
base.AutoScaleMode = AutoScaleMode.None;
this.BackColor = Color.Transparent;
base.Name = "HslMoveText";
base.Size = new Size(720, 41);
base.ResumeLayout(false);
}
// Token: 0x040002DD RID: 733
private float fontWidth = 100f;
// Token: 0x040002DE RID: 734
private StringFormat sf = null;
// Token: 0x040002DF RID: 735
private HslDirectionStyle hslValvesStyle = HslDirectionStyle.Vertical;
// Token: 0x040002E0 RID: 736
private float moveSpeed = 1f;
// Token: 0x040002E1 RID: 737
private Timer timer = null;
// Token: 0x040002E2 RID: 738
private float startLocationX = -100000f;
///
/// 必需的设计器变量。
///
// Token: 0x040002E3 RID: 739
private IContainer components = null;
}
}