Exemplo n.º 1
0
        private void DrawResultTileSequences(TableLayout tableLayout, int startX, int startY, int tableColumnCount, int gap, TimeSpan elapsed)
        {
            Debug.WriteLine("tableLayout.ResultTileSequences.Count: {0}", tableLayout.ResultTileSequences.Count);

            Font       font  = new Font(FontFamily.GenericSansSerif, 20);
            SolidBrush brush = new SolidBrush(Color.Black);

            this.graphics.DrawString(
                string.Format(
                    "A táblán összesen {0} kártya lehet, {1} oszlopban. A keresés {3:0.000} másodperc alatt {2} db elrendezést talált; \n {4} alkalommal próbált meg letenni egy kártyát, és az {5} alkalommal sikerült.",
                    tableLayout.TileCountOnTable,
                    tableLayout.ColumnCount,
                    tableLayout.ResultTileSequences.Count,
                    elapsed.TotalSeconds,
                    tableLayout.PutTileTryCount,
                    tableLayout.PutTileSuccessCount),
                font,
                brush,
                10,
                startY - 120);

            this.graphics.TranslateTransform(startX, startY);

            for (int i = 0; i < tableLayout.ResultTileSequences.Count; i++)
            {
                var tileSequence = tableLayout.ResultTileSequences[i];

                Debug.WriteLine("i: {0}, tileSequence: {1}", i, tileSequence);
                var size = tableLayout.DrawTileSequence(this.graphics, tileSequence);

                int x = (i + 1) % tableColumnCount;
                int y = (i + 1) / tableColumnCount;

                this.graphics.ResetTransform();
                this.graphics.TranslateTransform(startX + ((size.Width + gap) * x), startY + ((size.Height + gap) * y));
            }
        }