private static void OnMinorScaleCountChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { IndicatorMeter owner = d as IndicatorMeter; /* 属性更改后需要立刻重绘刻度 */ owner.DrawScale(owner.PrimaryScaleRaduisInner, owner.PrimaryScaleRadiusOuter, owner.PrimaryScaleCount, owner.MinorScaleRadiusInner, owner.MinorScaleRadiusOuter, owner.MinorScaleCount, owner.PrimaryScaleStartAngle, owner.PrimaryScaleEndAngle, owner.PrimaryScaleWitdh, owner.PrimaryScaleBackground); }
private static void OnMaxChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { IndicatorMeter owner = d as IndicatorMeter; if (owner.Max <= owner.Min) { owner.Max = owner.Min; return; } if (owner.Max < owner.IndicatorValue) { owner.IndicatorValue = owner.Max; } if (owner.Max < owner.RangeBarMax) { owner.RangeBarMax = owner.Max; } /* 属性更改后需要立刻重绘刻度 */ owner.DrawScale(owner.PrimaryScaleRaduisInner, owner.PrimaryScaleRadiusOuter, owner.PrimaryScaleCount, owner.MinorScaleRadiusInner, owner.MinorScaleRadiusOuter, owner.MinorScaleCount, owner.PrimaryScaleStartAngle, owner.PrimaryScaleEndAngle, owner.PrimaryScaleWitdh, owner.PrimaryScaleBackground); // 更改Indicator Bar颜色 owner.ChangeIndicatorBarBackground(); }
private static void OnPrimaryScaleRaduisInnerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { IndicatorMeter owner = d as IndicatorMeter; double val = (double)e.NewValue; /* 如果内圈半径大于外圈半径,则令内圈半径等于外圈半径 */ if (val >= owner.PrimaryScaleRadiusOuter) { owner.PrimaryScaleRaduisInner = owner.PrimaryScaleRadiusOuter; return; } else { /* 属性更改后需要立刻重绘刻度 */ owner.DrawScale(owner.PrimaryScaleRaduisInner, owner.PrimaryScaleRadiusOuter, owner.PrimaryScaleCount, owner.MinorScaleRadiusInner, owner.MinorScaleRadiusOuter, owner.MinorScaleCount, owner.PrimaryScaleStartAngle, owner.PrimaryScaleEndAngle, owner.PrimaryScaleWitdh, owner.PrimaryScaleBackground); } }