示例#1
0
        public static BrokenLine CreateLine(Point A, Point B)
        {
            BrokenLine line = new BrokenLine();

            if (A.Y == B.Y)
            {
                line.Left   = A.X;
                line.Top    = A.Y;
                line.Width  = B.X - A.X;
                line.Height = OlympicPainterSettings.Scaled(5);
                line.Orient = Orientation.Left_Right;
            }
            if (A.Y > B.Y)
            {
                line.Left   = A.X;
                line.Top    = B.Y + OlympicPainterSettings.Scaled(6);
                line.Width  = B.X - A.X;
                line.Height = A.Y - B.Y - OlympicPainterSettings.Scaled(4);
                line.Orient = Orientation.LeftBottom_RightTop;
            }
            if (A.Y < B.Y)
            {
                line.Left   = A.X;
                line.Top    = A.Y;
                line.Width  = B.X - A.X;
                line.Height = B.Y - A.Y - OlympicPainterSettings.Scaled(4);
                line.Orient = Orientation.LeftTop_RightBottom;
            }
            return(line);
        }
        internal static void CreateLines(OlympicPaintersGroup painters)
        {
            MatchPainter winner_view;

            painters.BrokenLinePainters.Clear();
            foreach (OlympicMatchPainter painter in painters.MatchPainters.Values)
            {
                if (painter.Match.Winner_Match != null)
                {
                    winner_view = painters.MatchPainters[painter.Match.Winner_Match.Id];
                    Point      A    = new Point(painter.Left + OlympicMatchPainter.Size.Width, painter.Top + OlympicMatchPainter.Size.Height / 2);
                    Point      B    = new Point(winner_view.Left, winner_view.Top + OlympicMatchPainter.Size.Height / 2);
                    BrokenLine line = BrokenLine.CreateLine(A, B);
                    line.Visible = painter.Visible;
                    painters.BrokenLinePainters.Add(line);
                }
            }
        }