//constructor public PipGraphic(BoardGraphic parentBoard, Pips SubjPips, bool inv, bool pen = false) { InitializeComponent(); SprImage = WhitePip; parent = parentBoard; Subj = SubjPips; Width = SprImage.Width + 2; Height = Limit * 50 + 2; Sprs = new PictureBox[Limit]; BackColor = Color.Transparent; Selected = false; this.Inverse = inv; this.Penalize = pen; Indx = new ToolTip(); Indx.IsBalloon = true; Indx.UseFading = false; Indx.ShowAlways = true; for (int i = 0; i < Limit; i++) { Sprs[i] = new PictureBox(); Sprs[i].Width = SprImage.Width; Sprs[i].Height = SprImage.Height; Sprs[i].Image = SprImage; Sprs[i].SendToBack(); Sprs[i].MouseEnter += new System.EventHandler(this.PipGraphic_MouseEnter); Sprs[i].MouseLeave += new System.EventHandler(this.PipGraphic_MouseLeave); Sprs[i].MouseClick += new System.Windows.Forms.MouseEventHandler(this.PipGraphic_MouseClick); Controls.Add(Sprs[i]); Sprs[i].Location = new Point(0, i * SprImage.Height); } FlowOver_Label = new Label(); FlowOver_Label.Font = new Font("AR JULIAN", 14, FontStyle.Regular); if (inv) { FlowOver_Label.Location = new Point(Location.X + Xoff, Location.Y + Yoff); } else { FlowOver_Label.Location = new Point(Location.X + Xoff, Location.Y + Height - Yoff * 2); } FlowOver_Label.Visible = false; Controls.Add(FlowOver_Label); UpdtView(); BringToFront(); }
//ctor public Board(Person [] users) { GameBoard = new Pips[26]; for (int i = 0; i < 26; i++) { GameBoard[i] = new Pips(i); } int[,] InitialState = new int[, ] { { 6, 5 }, { 8, 3 }, { 13, 5 }, { 24, 2 } }; for (int i = 0; i < 4; i++) { for (int j = 0; j < InitialState[i, 1]; j++) { GameBoard[InitialState[i, 0]].AddPip(users[0]); GameBoard[25 - InitialState[i, 0]].AddPip(users[1]); } } }