示例#1
0
        private ToolTipGeometry calculateToolTipGeometry()
        {
            var total = RenderSize;
            var body  = new Rect();
            var arrow = new TrianglePoints();

            if (ArrowDirection == ToolTipDirection.Left)
            {
                var startY = (total.Height - ArrowBaseLength) / 2;
                var point1 = new Point(ArrowPointHeight, startY);
                var point2 = new Point(ArrowPointHeight, startY + ArrowBaseLength);
                var point3 = new Point(0, startY + (ArrowBaseLength / 2));
                arrow = new TrianglePoints(point1, point2, point3);
                body  = new Rect(new Point(ArrowPointHeight, 0), new Point(total.Width, total.Height));
            }
            if (ArrowDirection == ToolTipDirection.Top)
            {
                var startX = (total.Width - ArrowBaseLength) / 2;
                var point1 = new Point(startX, ArrowPointHeight);
                var point2 = new Point(startX + ArrowBaseLength, ArrowPointHeight);
                var point3 = new Point(startX + (ArrowBaseLength / 2), 0);
                arrow = new TrianglePoints(point1, point2, point3);
                body  = new Rect(new Point(0, ArrowPointHeight), new Point(total.Width, total.Height));
            }
            if (ArrowDirection == ToolTipDirection.Right)
            {
                var startY = (total.Height - ArrowBaseLength) / 2;
                var point1 = new Point(total.Width - ArrowPointHeight, startY);
                var point2 = new Point(total.Width - ArrowPointHeight, startY + ArrowBaseLength);
                var point3 = new Point(total.Width, startY + (ArrowBaseLength / 2));
                arrow = new TrianglePoints(point1, point2, point3);
                body  = new Rect(new Point(0, 0), new Point(total.Width - ArrowPointHeight, total.Height));
            }
            if (ArrowDirection == ToolTipDirection.Bottom)
            {
                var startX = (total.Width - ArrowBaseLength) / 2;
                var point1 = new Point(startX, Height - ArrowPointHeight);
                var point2 = new Point(startX + ArrowBaseLength, total.Height - ArrowPointHeight);
                var point3 = new Point(startX + (ArrowBaseLength / 2), total.Height);
                arrow = new TrianglePoints(point1, point2, point3);
                body  = new Rect(new Point(0, 0), new Point(total.Width, total.Height - ArrowPointHeight));
            }
            return(new ToolTipGeometry(body, arrow));
        }
示例#2
0
		public ToolTipGeometry(Rect body, TrianglePoints arrow)
		{
			Body = body;
			Arrow = arrow;
		}
示例#3
0
		private ToolTipGeometry calculateToolTipGeometry()
		{
			var total = RenderSize;
			var body = new Rect();
			var arrow = new TrianglePoints();
			if (ArrowDirection == ToolTipDirection.Left)
			{
				var startY = (total.Height - ArrowBaseLength) / 2;
				var point1 = new Point(ArrowPointHeight, startY);
				var point2 = new Point(ArrowPointHeight, startY + ArrowBaseLength);
				var point3 = new Point(0, startY + (ArrowBaseLength / 2));
				arrow = new TrianglePoints(point1, point2, point3);
				body = new Rect(new Point(ArrowPointHeight, 0), new Point(total.Width, total.Height));
			}
			if (ArrowDirection == ToolTipDirection.Top)
			{
				var startX = (total.Width - ArrowBaseLength) / 2;
				var point1 = new Point(startX, ArrowPointHeight);
				var point2 = new Point(startX + ArrowBaseLength, ArrowPointHeight);
				var point3 = new Point(startX + (ArrowBaseLength / 2), 0);
				arrow = new TrianglePoints(point1, point2, point3);
				body = new Rect(new Point(0, ArrowPointHeight), new Point(total.Width, total.Height));
			}
			if (ArrowDirection == ToolTipDirection.Right)
			{
				var startY = (total.Height - ArrowBaseLength) / 2;
				var point1 = new Point(total.Width - ArrowPointHeight, startY);
				var point2 = new Point(total.Width - ArrowPointHeight, startY + ArrowBaseLength);
				var point3 = new Point(total.Width, startY + (ArrowBaseLength / 2));
				arrow = new TrianglePoints(point1, point2, point3);
				body = new Rect(new Point(0, 0), new Point(total.Width - ArrowPointHeight, total.Height));
			}
			if (ArrowDirection == ToolTipDirection.Bottom)
			{
				var startX = (total.Width - ArrowBaseLength) / 2;
				var point1 = new Point(startX, Height - ArrowPointHeight);
				var point2 = new Point(startX + ArrowBaseLength, total.Height - ArrowPointHeight);
				var point3 = new Point(startX + (ArrowBaseLength / 2), total.Height);
				arrow = new TrianglePoints(point1, point2, point3);
				body = new Rect(new Point(0, 0), new Point(total.Width, total.Height - ArrowPointHeight));
			}
			return new ToolTipGeometry(body, arrow);
		}
示例#4
0
 public ToolTipGeometry(Rect body, TrianglePoints arrow)
 {
     Body  = body;
     Arrow = arrow;
 }