|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
-
- namespace ComeCapture.Controls
- {
- public class LineTool : StackPanel
- {
- static LineTool()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(LineTool), new FrameworkPropertyMetadata(typeof(LineTool)));
- }
-
- public LineTool()
- {
- _Current = this;
- }
-
- #region 属性 Current
-
- private static LineTool _Current = null;
-
- public static LineTool Current => _Current;
-
- #endregion 属性 Current
-
- #region LineThickness DependencyProperty
-
- public double LineThickness
- {
- get => (double)GetValue(LineThicknessProperty);
- set => SetValue(LineThicknessProperty, value);
- }
-
- public static readonly DependencyProperty LineThicknessProperty =
- DependencyProperty.Register("LineThickness", typeof(double), typeof(LineTool),
- new PropertyMetadata(5.0, new PropertyChangedCallback(LineTool.OnLineThicknessPropertyChanged)));
-
- private static void OnLineThicknessPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
- {
- if (obj is LineTool)
- {
- (obj as LineTool).OnLineThicknessValueChanged();
- }
- }
-
- protected void OnLineThicknessValueChanged()
- {
- }
-
- #endregion LineThickness DependencyProperty
-
- #region LineBrush DependencyProperty
-
- public SolidColorBrush LineBrush
- {
- get => (SolidColorBrush)GetValue(LineBrushProperty);
- set => SetValue(LineBrushProperty, value);
- }
-
- public static readonly DependencyProperty LineBrushProperty =
- DependencyProperty.Register("LineBrush", typeof(SolidColorBrush), typeof(LineTool),
- new PropertyMetadata(new SolidColorBrush(Colors.Red), new PropertyChangedCallback(LineTool.OnLineBrushPropertyChanged)));
-
- private static void OnLineBrushPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
- {
- if (obj is LineTool)
- {
- (obj as LineTool).OnLineBrushValueChanged();
- }
- }
-
- protected void OnLineBrushValueChanged()
- {
- }
-
- #endregion LineBrush DependencyProperty
- }
- }
|