Esempio n. 1
0
        /// <summary>
        /// Moves the <see cref="ArrowGraphic"/> by a specified delta.
        /// </summary>
        /// <remarks>
        /// <see cref="IGraphic.CoordinateSystem"/> determines whether this property is in source or destination coordinates.
        /// </remarks>
        /// <param name="delta">The offset by which the graphic is to be moved.</param>
        public override void Move(SizeF delta)
        {
            _enablePointChangeEvents = false;
            try
            {
                base.Move(delta);

                // force realignment the arrowhead
                _arrowhead.Point = _shaft.Point2;
                this.UpdateArrowheadAngle();
            }
            finally
            {
                _enablePointChangeEvents = true;
            }

            // trigger events
            _shaft.CoordinateSystem = CoordinateSystem.Source;
            try
            {
                this.OnShaftPoint1Changed(this, new PointChangedEventArgs(_shaft.Point1, CoordinateSystem.Source));
                this.OnShaftPoint2Changed(this, new PointChangedEventArgs(_shaft.Point2, CoordinateSystem.Source));
            }
            finally
            {
                _shaft.ResetCoordinateSystem();
            }
        }
Esempio n. 2
0
        private void OnPointsItemAdded(object sender, IndexEventArgs e)
        {
            if (_points.Count >= 2)
            {
                LinePrimitive line = new LinePrimitive();
                line.Color            = _color;
                line.LineStyle        = _lineStyle;
                line.CoordinateSystem = this.CoordinateSystem;
                try
                {
                    if (e.Index == _points.Count - 1)
                    {
                        _lines.Graphics.Add(line);
                        line.Point1 = _points[e.Index - 1];
                        line.Point2 = _points[e.Index];
                    }
                    else
                    {
                        _lines.Graphics.Insert(e.Index, line);
                        line.Point1 = _points[e.Index];
                        line.Point2 = _points[e.Index + 1];

                        if (e.Index > 0)
                        {
                            ((LinePrimitive)_lines.Graphics[e.Index - 1]).Point2 = _points[e.Index];
                        }
                    }
                }
                finally
                {
                    line.ResetCoordinateSystem();
                }
            }
            base.NotifyVisualStateChanged("Points", VisualStatePropertyKind.Geometry);
        }
Esempio n. 3
0
		private void OnPointsItemAdded(object sender, IndexEventArgs e)
		{
			if (_points.Count >= 2)
			{
				LinePrimitive line = new LinePrimitive();
				line.Color = _color;
				line.LineStyle = _lineStyle;
				line.CoordinateSystem = this.CoordinateSystem;
				try
				{
					if (e.Index == _points.Count - 1)
					{
						_lines.Graphics.Add(line);
						line.Point1 = _points[e.Index - 1];
						line.Point2 = _points[e.Index];
					}
					else
					{
						_lines.Graphics.Insert(e.Index, line);
						line.Point1 = _points[e.Index];
						line.Point2 = _points[e.Index + 1];

						if (e.Index > 0)
							((LinePrimitive) _lines.Graphics[e.Index - 1]).Point2 = _points[e.Index];
					}
				}
				finally
				{
					line.ResetCoordinateSystem();
				}
			}
			base.NotifyVisualStateChanged("Points");
		}