HslMoveText

dep
我叫锄头 12 months ago
parent bcb198e65a
commit 6a639b5912

@ -36,7 +36,9 @@ namespace Mesnac.Action.ChemicalWeighing.Test
MCButton mCButton;
// LoggingService<TestAction> _log;
// LoggingService<TestAction> _log;
HslMoveText hslMove;
public void theout(object source, EventArgs e)
@ -52,6 +54,21 @@ namespace Mesnac.Action.ChemicalWeighing.Test
var allDb=GetAllControls();
mCButton = allDb.FirstOrDefault(x => x.Name == "MCButton1") as MCButton;
hslMove= allDb.FirstOrDefault(x => x.Name == "HslMoveText1") as HslMoveText;
this.hslMove.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.hslMove.BackColor = Color.FromArgb(128, 128, 255);
this.hslMove.Font = new Font("楷体", 15f, FontStyle.Regular, GraphicsUnit.Point, 134);
this.hslMove.ForeColor = Color.Yellow;
this.hslMove.Margin = new Padding(5, 6, 5, 6);
this.hslMove.MoveSpeed = 20f;
this.hslMove.Size = new Size(726, 49);
this.hslMove.TabIndex = 8;
this.hslMove.Text = "公告:这是一条测试的公告信息。";
mCButton.Click += MCButton_Click;
System.Timers.Timer t = new System.Timers.Timer(5000);//实例化Timer类设置间隔时间为10000毫秒

@ -0,0 +1,256 @@
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>
/// 移动的文本控件
/// </summary>
// Token: 0x02000045 RID: 69
[Description("移动文本控件,支持文件正向反向移动,支持设置移动速度")]
public class HslMoveText : UserControl
{
/// <summary>
/// 实例化一个默认的对象
/// </summary>
// 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 = 50;
this.timer.Tick += this.Timer_Tick;
this.timer.Start();
}
/// <summary>
/// 获取或设置控件的背景色
/// </summary>
// 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;
}
}
/// <summary>
/// 获取或设置当前控件的文本
/// </summary>
// 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();
}
}
/// <summary>
/// 获取或设置泵控件是否是横向的还是纵向的
/// </summary>
// 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();
}
}
/// <summary>
/// 获取或设置泵的动画速度0为静止正数为正向流动负数为反向流动
/// </summary>
// 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();
}
}
/// <summary>
/// 重绘控件的
/// </summary>
/// <param name="e">重绘事件</param>
// 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);
}
/// <inheritdoc cref="M:HslControls.HslArrow.PaintHslControls(System.Drawing.Graphics,System.Single,System.Single)" />
// 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)
{
bool flag = this.moveSpeed != 0f;
if (flag)
{
bool flag2 = this.startLocationX < -this.fontWidth - 5f;
if (flag2)
{
this.startLocationX = (float)(base.Width + 1);
}
else
{
this.startLocationX -= this.moveSpeed;
}
base.Invalidate();
}
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
// 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);
}
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
// 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;
/// <summary>
/// 必需的设计器变量。
/// </summary>
// Token: 0x040002E3 RID: 739
private IContainer components = null;
}
}

@ -150,6 +150,9 @@
<Compile Include="HslLedDisplay.Designer.cs">
<DependentUpon>HslLedDisplay.cs</DependentUpon>
</Compile>
<Compile Include="HslMoveText.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="HslPipeLine.cs">
<SubType>UserControl</SubType>
</Compile>

@ -1650,6 +1650,22 @@
</DataBinding>
</Component>
<Component Name="HslMoveText" Namespace="Mesnac.Controls.ChemicalWeighing" Asm="Mesnac.Controls.ChemicalWeighing.dll">
<Propertys>
<Property Name="Location" Caption="位置" Group=""/>
<Property Name="Name" Caption="名称" Group=""/>
<Property Name="Size" Caption="大小" Group=""/>
<Property Name="Status" Caption="状态" Group=""/>
</Propertys>
<DataBinding>
</DataBinding>
</Component>
<Component Name="HslLanternSimple" Namespace="Mesnac.Controls.ChemicalWeighing" Asm="Mesnac.Controls.ChemicalWeighing.dll">
<Propertys>
<Property Name="Location" Caption="λÖÃ" Group=""/>

@ -1,6 +1,11 @@
<Object type="Mesnac.Gui.Common.FrmRunTemplate, Mesnac.Gui.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="Form1" children="Controls">
<Object type="System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="Panel1" children="Controls">
<Object type="Mesnac.Controls.ChemicalWeighing.HslMoveText, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslMoveText1" children="Controls">
<Property name="Location">652, 182</Property>
<Property name="Name">HslMoveText1</Property>
<Property name="Size">477, 41</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCButton1" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAALAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAANBAs=</Binary>

@ -117,8 +117,8 @@
<ToolComponent chineseName="HslLanternAlarm" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslLanternAlarm" />
<ToolComponent chineseName="HslLanternSimple" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslLanternSimple" />
<ToolComponent chineseName="HslLedDisplay" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslLedDisplay" />
<ToolComponent chineseName="HslMoveText" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslMoveText" />
<ToolComponent chineseName="HslSwitch" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslSwitch" />
<!--<ToolComponent chineseName="管道" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslPipeLine" />-->
<ToolComponent chineseName="3管道" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslPipeLineThree" />

Loading…
Cancel
Save