Esempio n. 1
0
        private void DrawStones(Graphics g)
        {
            if (this.SumStones <= 5)
            {
                int slot = 0;
                if (WhiteStones > BlackStones)
                { // najpierw białe, bo jest ich więcej
                    for (int i = 0; i < WhiteStones; ++i)
                    {
                        g.FillEllipse(C.WhiteStoneBrush, GetFieldSlot(slot));
                        slot++;
                    }
                    for (int i = 0; i < BlackStones; ++i)
                    {
                        g.FillEllipse(C.BlackStoneBrush, GetFieldSlot(slot));
                        slot++;
                    }
                }
                else
                {   // najpierw czarne, bo jest ich więcej
                    for (int i = 0; i < BlackStones; ++i)
                    {
                        g.FillEllipse(C.BlackStoneBrush, GetFieldSlot(slot));
                        slot++;
                    }
                    for (int i = 0; i < WhiteStones; ++i)
                    {
                        g.FillEllipse(C.WhiteStoneBrush, GetFieldSlot(slot));
                        slot++;
                    }
                }
            }
            else
            {
                if (WhiteStones > BlackStones)
                {
                    g.DrawString(WhiteStones.ToString(), C.StoneFont, C.WhiteStoneBrush, GetFieldSlot(0));

                    if (BlackStones > 0)
                    {
                        g.DrawString(BlackStones.ToString(), C.StoneFont, C.BlackStoneBrush, GetFieldSlot(1));
                    }
                }
                else
                {
                    g.DrawString(BlackStones.ToString(), C.StoneFont, C.BlackStoneBrush, GetFieldSlot(0));

                    if (WhiteStones > 0)
                    {
                        g.DrawString(WhiteStones.ToString(), C.StoneFont, C.WhiteStoneBrush, GetFieldSlot(1));
                    }
                }
            }
        }
Esempio n. 2
0
        public void DrawStones(Graphics g)
        {
            if (Color == PColor.White) //dół
            {
                if (WhiteStones <= 6)
                {
                    for (int i = 0; i < WhiteStones; ++i)
                    {
                        int x = (1 - (i % 2)) * C.FieldSize;
                        int y = (2 - (i / 2)) * C.FieldSize;

                        g.FillEllipse(C.WhiteStoneBrush, Rect.X + x, Rect.Y + y, C.FieldSize, C.FieldSize);
                    }
                }
                else
                {
                    g.DrawString(WhiteStones.ToString(), C.StoneFont, C.WhiteStoneBrush, Rect.X + Rect.Width - C.FieldSize, Rect.Y + Rect.Height - C.FieldSize);
                }
            }
            else
            {
                if (BlackStones <= 6)
                {
                    for (int i = 0; i < BlackStones; ++i)
                    {
                        int x = (2 - (i % 2)) * C.FieldSize;
                        int y = (3 - (i / 2)) * C.FieldSize;

                        g.FillEllipse(C.BlackStoneBrush, Rect.X + Rect.Width - x, Rect.Y + Rect.Height - y, C.FieldSize, C.FieldSize);
                    }
                }
                else
                {
                    g.DrawString(BlackStones.ToString(), C.StoneFont, C.BlackStoneBrush, Rect.Location);
                }
            }
        }