/View/ConnectorView.cs

https://github.com/shader/QuickArch · C# · 48 lines · 41 code · 7 blank · 0 comment · 0 complexity · b86aeeae5536657dd9a8afcc30ba4520 MD5 · raw file

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Shapes;
  6. using System.Windows.Media;
  7. using System.Windows;
  8. namespace QuickArch.View
  9. {
  10. public class ConnectorView : Shape
  11. {
  12. LineGeometry linegeo;
  13. public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register("StartPoint", typeof(Point), typeof(ConnectorView), new FrameworkPropertyMetadata(new Point(0, 0), FrameworkPropertyMetadataOptions.AffectsMeasure));
  14. public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register("EndPoint", typeof(Point), typeof(ConnectorView), new FrameworkPropertyMetadata(new Point(0, 0), FrameworkPropertyMetadataOptions.AffectsMeasure));
  15. public Point StartPoint
  16. {
  17. get { return (Point)GetValue(StartPointProperty); }
  18. set { SetValue(StartPointProperty, value); }
  19. }
  20. public Point EndPoint
  21. {
  22. get { return (Point)GetValue(EndPointProperty); }
  23. set { SetValue(EndPointProperty, value); }
  24. }
  25. public ConnectorView()
  26. {
  27. linegeo = new LineGeometry();
  28. this.Stroke = Brushes.Black;
  29. this.StrokeThickness = 2;
  30. }
  31. protected override Geometry DefiningGeometry
  32. {
  33. get
  34. {
  35. linegeo.StartPoint = StartPoint;
  36. linegeo.EndPoint = EndPoint;
  37. return linegeo;
  38. }
  39. }
  40. }
  41. }