Dashboard.cs
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
using System.Windows.Media;
using System.Windows.Shapes;
using Microsoft.Expression.Shapes;
namespace DashboardDemo
{
public class Dashboard : System.Windows.Controls.Control
{
public const string ArcName = "arckd";
public const string ValueTxtName = "valueTxt";
public const string CanvasName = "canvasPlate";
public const string ZZRotateName = "rtPointer";
private static double StartAngle = -135.5;
static Dashboard()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(Dashboard), new FrameworkPropertyMetadata(typeof(Dashboard)));
}
Arc arckd;
TextBlock valueTxt;
Canvas canvasPlate;
RotateTransform rtPointer;
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
if (arckd == null)
arckd = GetTemplateChild(ArcName) as Arc;
if (valueTxt == null)
valueTxt = GetTemplateChild(ValueTxtName) as TextBlock;
if (canvasPlate == null)
canvasPlate = GetTemplateChild(CanvasName) as Canvas;
if (rtPointer == null)
rtPointer = GetTemplateChild(ZZRotateName) as RotateTransform;
DrawScale();
DrawAngle();
arckd.EndAngle = StartAngle + (-StartAngle * 2d) * ((double)Value / Maximum);
valueTxt.Text = Value.ToString();
}
public double Value
{
get { return (double)GetValue(ValueProperty); }
set
{
SetValue(ValueProperty, value);
}
}
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(double), typeof(Dashboard),
new PropertyMetadata(default(double), new PropertyChangedCallback(OnValuePropertyChanged)));
public double Minimum
后面还有 120 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
