Beispiel #1
0
        /// <summary>
        /// Reset the text annotation position.
        /// </summary>
        public override void Reposition()
        {
            if (horizontalAxis != null && verticalAxis != null)
            {
                textRectangle.X = (int)(Position.X * horizontalAxis.WidthRate + ParentControl.Padding.Left + horizontalAxis.Center);
                textRectangle.Y = (int)(-Position.Y * verticalAxis.HeightRate + ParentControl.Padding.Top + verticalAxis.Center);
            }
            else
            {
                if (IsRelativePositionX)
                {
                    textRectangle.X = (int)(relateRateX * ParentControl.Width);     // (int)position.X;
                }
                else
                {
                    textRectangle.X = (int)position.X;
                }
                if (IsRelativePositionX)
                {
                    textRectangle.Y = (int)(relateRateY * ParentControl.Height);     // (int)position.X;
                }
                else
                {
                    textRectangle.Y = (int)position.Y;
                }
            }
            textRectangle.Height = (int)rSize.Height;
            textRectangle.Width  = (int)rSize.Width;

            ParentControl.ReDrawLayer(DrawingLayer);
        }
        /// <summary>
        /// Reset the annotation position.
        /// </summary>
        public override void Reposition()
        {
            if (horizontalAxis != null && verticalAxis != null)
            {
                rectangle.X      = startValuePoint.X * horizontalAxis.WidthRate + ParentControl.Padding.Left + horizontalAxis.Center;
                rectangle.Y      = -startValuePoint.Y * verticalAxis.HeightRate + ParentControl.Padding.Top + verticalAxis.Center;
                rectangle.Height = -(endValuePoint.Y - startValuePoint.Y) * verticalAxis.HeightRate;
                rectangle.Width  = (endValuePoint.X - startValuePoint.X) * horizontalAxis.WidthRate;
            }
            else
            {
                rectangle.X      = startValuePoint.X * ParentControl.DrawWidth + ParentControl.Padding.Left;
                rectangle.Y      = (1 - startValuePoint.Y) * ParentControl.DrawHeight + ParentControl.Padding.Top;
                rectangle.Height = -(endValuePoint.Y - startValuePoint.Y) * ParentControl.DrawHeight;
                rectangle.Width  = (endValuePoint.X - startValuePoint.X) * ParentControl.DrawWidth;
            }
            if (rectangle.Width < 0)
            {
                rectangle.Width *= -1;
                rectangle.X     -= rectangle.Width;
            }
            if (rectangle.Height < 0)
            {
                rectangle.Height *= -1;
                rectangle.Y      -= rectangle.Height;
            }

            ParentControl.ReDrawLayer(DrawingLayer);
        }