support for .NET framework 3.5
Still have bugs
This commit is contained in:
1 parent
5878039e21
commit
7d6b491f25
704 files changed
+48273
-33
No files matched your search
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Windows.Controls;
|
||||
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// 作为刻度使用的文字块
|
||||
/// </summary>
|
||||
internal class SpeTextBlock : TextBlock
|
||||
{
|
||||
public double X { get; set; }
|
||||
|
||||
public SpeTextBlock() => Width = 60;
|
||||
|
||||
public SpeTextBlock(double x) : this()
|
||||
{
|
||||
X = x;
|
||||
Canvas.SetLeft(this, X);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 时间
|
||||
/// </summary>
|
||||
private DateTime _time;
|
||||
|
||||
/// <summary>
|
||||
/// 时间
|
||||
/// </summary>
|
||||
public DateTime Time
|
||||
{
|
||||
get => _time;
|
||||
set
|
||||
{
|
||||
_time = value;
|
||||
Text = $"{value.ToString(TimeFormat)}\r\n|";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 时间格式
|
||||
/// </summary>
|
||||
public string TimeFormat { get; set; } = "HH:mm";
|
||||
|
||||
/// <summary>
|
||||
/// 横向移动
|
||||
/// </summary>
|
||||
/// <param name="offsetX"></param>
|
||||
public void MoveX(double offsetX) => Canvas.SetLeft(this, X + offsetX);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user