12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
-
- namespace ComeCapture.Controls
- {
- public class RectangleTool : StackPanel
- {
- static RectangleTool()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(RectangleTool), new FrameworkPropertyMetadata(typeof(RectangleTool)));
- }
-
- public RectangleTool()
- {
- _Current = this;
- }
-
- #region 属性 Current
-
- private static RectangleTool _Current = null;
-
- public static RectangleTool 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(RectangleTool),
- new PropertyMetadata(5.0, new PropertyChangedCallback(RectangleTool.OnLineThicknessPropertyChanged)));
-
- private static void OnLineThicknessPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
- {
- if (obj is RectangleTool)
- {
- (obj as RectangleTool).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(RectangleTool),
- new PropertyMetadata(new SolidColorBrush(Colors.Red), new PropertyChangedCallback(RectangleTool.OnLineBrushPropertyChanged)));
-
- private static void OnLineBrushPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
- {
- if (obj is RectangleTool)
- {
- (obj as RectangleTool).OnLineBrushValueChanged();
- }
- }
-
- protected void OnLineBrushValueChanged()
- {
- }
-
- #endregion LineBrush DependencyProperty
- }
- }
|