using System; using System.Windows.Controls; namespace HandyControl.Controls; /// /// 作为刻度使用的文字块 /// internal class SpeTextBlock : TextBlock { public double X { get; set; } public SpeTextBlock() => Width = 60; public SpeTextBlock(double x) : this() { X = x; Canvas.SetLeft(this, X); } /// /// 时间 /// private DateTime _time; /// /// 时间 /// public DateTime Time { get => _time; set { _time = value; Text = $"{value.ToString(TimeFormat)}\r\n|"; } } /// /// 时间格式 /// public string TimeFormat { get; set; } = "HH:mm"; /// /// 横向移动 /// /// public void MoveX(double offsetX) => Canvas.SetLeft(this, X + offsetX); }