コード例 #1
0
        public override void CreateGrid()
        {
            FBitmapSize.Height         = 0;
            FBitmapSize.Width          = 0;
            SwissPainterSettings.Scale = Convert.ToSingle(ScalePicture);

            int   ROUND_OFFSET   = Convert.ToInt32(20.0 * ScalePicture);
            int   OFFSET         = Convert.ToInt32(4.0 * ScalePicture);;
            Point round_left_top = new Point(ROUND_OFFSET, 0);
            int   match_top      = 0;


            Size LABEL_SIZE = new Size(SwissMatchPainter.Size.Width, SwissMatchPainter.Size.Height);

            FMatchPainters.Clear();
            int current_round = 0;

            foreach (MatchInfo match in Competition.Matches.Values)
            {
                if (match.Label.Round != current_round)
                {
                    //if (match.Label.Round % 2 == 1)
                    {
                        round_left_top.X = ROUND_OFFSET;
                        int round_height = ((Competition.Players.Count + 1) / 2 + 1) * (OFFSET + LABEL_SIZE.Height);
                        round_left_top.Y = ROUND_OFFSET + (round_height + ROUND_OFFSET) * (match.Label.Round - 1);
                    }

                    /*else
                     * {
                     *  round_left_top.X = round_left_top.X + LABEL_SIZE.Width + ROUND_OFFSET;
                     * }*/
                    match_top = round_left_top.Y;
                    RoundLabelPainter label_painter = new RoundLabelPainter(String.Format(Localizator.Dictionary.GetString("ROUND_INT"), match.Label.Round));
                    label_painter.TopF = match_top;
                    label_painter.Left = round_left_top.X;
                    FBitmapSize.Width  = Math.Max(FBitmapSize.Width, Convert.ToInt32(label_painter.Left) + LABEL_SIZE.Width + 50);
                    current_round      = match.Label.Round;
                    FMatchPainters.Add(match.Id + 10000 + current_round, label_painter);
                }

                match_top += OFFSET + LABEL_SIZE.Height;
                SwissMatchPainter painter = (SwissMatchPainter)GetMatchPainter();
                painter.TopF         = match_top;
                FBitmapSize.Height   = Math.Max(FBitmapSize.Height, Convert.ToInt32(painter.TopF) + LABEL_SIZE.Height + 50);
                painter.Left         = round_left_top.X;
                painter.Match        = match;
                painter.OnAfterEdit += new OnMatchPainterEvent(AfterMatchEdit);
                FMatchPainters.Add(painter.Match.Id, painter);
            }
            RoundCount = current_round;
        }
コード例 #2
0
        public void CreateGrid()
        {
            int   ROUND_OFFSET   = 20;
            int   OFFSET         = 4;
            Point round_left_top = new Point(30, 0);
            int   match_top      = 0;

            FBitmapSize.Height = match_top;
            FBitmapSize.Width  = 0;

            Size LABEL_SIZE = new Size(SwissMatchPainter.Size.Width, SwissMatchPainter.Size.Height);

            int current_round = 0;

            FMatchPainters.Clear();
            foreach (MatchInfo match in Matches.Values)
            {
                if (current_round < match.Label.Round)
                {
                    match_top += ROUND_OFFSET;
                    RoundLabelPainter label_painter = new RoundLabelPainter(String.Format(Localizator.Dictionary.GetString("ROUND_INT"), match.Label.Round));
                    label_painter.TopF = match_top;
                    label_painter.Left = round_left_top.X;
                    FBitmapSize.Width  = Math.Max(FBitmapSize.Width, Convert.ToInt32(label_painter.Left) + LABEL_SIZE.Width + 50);
                    current_round      = match.Label.Round;
                    FMatchPainters.Add(match.Id + 10000 + current_round, label_painter);
                    match_top += label_painter.ClientRect.Height;
                }
                match_top += OFFSET;
                SwissMatchPainter painter = new SwissMatchPainter();
                painter.TopF         = match_top;
                FBitmapSize.Height   = Math.Max(FBitmapSize.Height, Convert.ToInt32(painter.TopF) + 50);
                painter.Left         = round_left_top.X;
                painter.Match        = match;
                painter.OnAfterEdit += new OnMatchPainterEvent(AfterMatchEdit);
                FMatchPainters.Add(painter.Match.Id, painter);
                FBitmapSize.Width = painter.ClientRect.Width + ROUND_OFFSET * 2;
                match_top        += painter.ClientRect.Height;
            }
        }