///<summary>示波器控件</summary> static OscilloscopeControl() { DefaultStyleKeyProperty.OverrideMetadata(typeof(OscilloscopeControl), new FrameworkPropertyMetadata(typeof(OscilloscopeControl))); ForegroundProperty.OverrideMetadata(typeof(OscilloscopeControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.SubPropertiesDoNotAffectRender, new PropertyChangedCallback((DependencyObject d, DependencyPropertyChangedEventArgs e) => { if (e.NewValue != null) { var sender = d as OscilloscopeControl; if (sender != null && sender.m_IsPropertyEnabled) { var temp = e.NewValue as SolidColorBrush; if (temp != null) { sender.m_Core.ChangeForegroundColor(ColorHelper.ToColorValue(temp.Color)); } } } }))); BackgroundProperty.OverrideMetadata(typeof(OscilloscopeControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.SubPropertiesDoNotAffectRender, new PropertyChangedCallback((DependencyObject d, DependencyPropertyChangedEventArgs e) => { if (e.NewValue != null) { var sender = d as OscilloscopeControl; if (sender != null && sender.m_IsPropertyEnabled) { var temp = e.NewValue as SolidColorBrush; if (temp != null) { sender.m_Core.ChangeBackgroundColor(ColorHelper.ToColorValue(temp.Color)); } } } }))); }
///<summary>刷新颜色</summary> public void RefreshColors() { if (m_Core != null) { var foreground = Foreground as SolidColorBrush; if (foreground != null) { m_Core.ChangeForegroundColor(m_Index, ColorHelper.ToColorValue(foreground.Color)); } } }
///<summary>刷新颜色</summary> public void RefreshColors() { var temp = Background as SolidColorBrush; if (temp != null) { m_Core.ChangeBackgroundColor(ColorHelper.ToColorValue(temp.Color)); } temp = AxisColor; if (temp != null) { m_Core.ChangeAxisColor(ColorHelper.ToColorValue(temp.Color)); } }