Beispiel #1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            if (m_pp == null)
            {
                return;
            }
            Graphics g = e.Graphics;

            for (int q = -5; q <= 5; q++)
            {
                for (int r = -5; r <= 5; r++)
                {
                    int x = q * SIZEY;
                    int y = (r * SIZEY) / 2;
                    x = x + y;

                    string s    = q.ToString() + "," + r.ToString();
                    bool   bold = false;
                    foreach (var p in m_pp)
                    {
                        if (q == p.Location.Q)
                        {
                            if (r == p.Location.R)
                            {
                                s    = p.Color.ToString().Substring(0, 1) + p.PieceType.ToString().Substring(0, 2);
                                bold = true;
                            }
                        }
                    }

                    BoardLocation bl = new BoardLocation(q, r);
                    if (bl.IsValidLocation())
                    {
                        if (m_highlights.ContainsTheLocation(bl))
                        {
                            g.DrawString(s, SystemFonts.DialogFont, bold ? SystemBrushes.ControlText : SystemBrushes.Highlight, (float)(x * .6) + OFFSET - 1, y + OFFSET - 2);
                        }
                        g.DrawString(s, SystemFonts.DialogFont, bold ? SystemBrushes.ControlDarkDark : SystemBrushes.Highlight, (float)(x * .6) + OFFSET, y + OFFSET);
                    }
                }
            }
        }