Ejemplo n.º 1
0
        public Window1()
        {
            InitializeComponent();

            SetDependencyProperties();

            SetAndMarkOrigin();

            WireupCanvasEvents();

            wall = new Wall();

            WallDetails wallInfo = new WallDetails();
            wallInfo.StartEchelonPoint = new EchelonPoint(-25, -25);
            wallInfo.EndEchelonPoint = new EchelonPoint(75, 75);
            wall.WallInfo = wallInfo;

            WallElement = new WallElement(Origin, wall.WallInfo);

            designerCanvas.Children.Add(WallElement);

            SetBindings();

            this.MouseMove += new MouseEventHandler(Window1_MouseMove);
        }
Ejemplo n.º 2
0
        public WallAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
            FrameworkPropertyMetadata meta = new FrameworkPropertyMetadata();
            meta.AffectsMeasure = true;

            element = (WallElement)adornedElement;

            _visualChildren = new VisualCollection(this);

            _startThumb = new Thumb();
            _startThumb.Height = 10;
            _startThumb.Width = 10;
            _startThumb.Background = Brushes.Yellow;

            _startThumb.DragDelta += new DragDeltaEventHandler(_startThumb_DragDelta);
            _startThumb.DragCompleted += new DragCompletedEventHandler(_startThumb_DragCompleted);
            _startThumb.DragStarted += new DragStartedEventHandler(_startThumb_DragStarted);

            _visualChildren.Add(_startThumb);

            _endThumb = new Thumb();
            _endThumb.Height = 10;
            _endThumb.Width = 10;
            _endThumb.Background = Brushes.Green;

            _endThumb.DragCompleted += new DragCompletedEventHandler(_endThumb_DragCompleted);

            _visualChildren.Add(_endThumb);

            previewLine = new Line();
            previewLine.Fill = Brushes.Purple;
            previewLine.Stroke = Brushes.Blue;
            previewLine.StrokeThickness = 3;
            previewLine.Visibility = Visibility.Hidden;
            previewLine.X1 = element.WallElementDetails.StartPoint.X;
            previewLine.Y1 = element.WallElementDetails.StartPoint.Y;
            previewLine.X2 = element.WallElementDetails.EndPoint.X;
            previewLine.Y2 = element.WallElementDetails.EndPoint.Y;

            _visualChildren.Add(previewLine);
        }