コード例 #1
0
 private void BoxEraser(Box daBox)
 {
     System.Drawing.Graphics graphicsObj;
     graphicsObj = this.CreateGraphics();
     Pen myPen = new Pen(System.Drawing.SystemColors.Control, 3);
     Rectangle myRectangle = new Rectangle(daBox.X, daBox.Y, daBox.Width, daBox.Height);
     graphicsObj.DrawRectangle(myPen, myRectangle);
 }
コード例 #2
0
 private void BoxDrawer(Box daBox, Color color)
 {
     System.Drawing.Graphics graphicsObj;
     graphicsObj = this.CreateGraphics();
     Pen myPen = new Pen(color, 5);
     Rectangle myRectangle = new Rectangle(daBox.X, daBox.Y, daBox.Width, daBox.Height);
     graphicsObj.DrawRectangle(myPen, myRectangle);
 }
コード例 #3
0
 private void BoxDrawer(Box daBox)
 {
     System.Drawing.Graphics graphicsObj;
     graphicsObj = this.CreateGraphics();
     Pen myPen = new Pen(System.Drawing.Color.Black, 3);
     if ((daBox.Turn % 2) == 1)
     {
         myPen.Color = System.Drawing.Color.Red;
     }
     Rectangle myRectangle = new Rectangle(daBox.X, daBox.Y, daBox.Width, daBox.Height);
     graphicsObj.DrawRectangle(myPen, myRectangle);
 }
コード例 #4
0
 //Creates an image when a piece is dropped
 private void PieceDrop(Box daBox)
 {
     System.Drawing.Graphics graphicsObj;
     graphicsObj = this.CreateGraphics();
     Pen myPen = new Pen(System.Drawing.Color.Black, 3);
     if ((daBox.Turn % 2) == 1)
     {
         myPen.Color = System.Drawing.Color.Red;
     }
     int i = FindLowestEmpty(daBox);
     int yCoor = 428 - (i * 64);
     Rectangle myRectangle = new Rectangle(daBox.X, yCoor, daBox.Width, daBox.Height);
     graphicsObj.DrawRectangle(myPen, myRectangle);
     DataUpdate(daBox, i);
 }
コード例 #5
0
 //Finds the lowest empty place, used by various
 private int FindLowestEmpty(Box daBox)
 {
     int i = 0;
     while (Data[i, daBox.Column] > 0)
     {
         ++i;
     }
     label1.Text = label1.Text + i.ToString() + ", ";
     return i;
 }
コード例 #6
0
 //Updates the Data array when a piece is dropped
 private void DataUpdate(Box daBox, int i)
 {
     if (daBox.Turn % 2 == 0)
     {
         Data[i, daBox.Column] = 2;
     }
     else
     {
         Data[i, daBox.Column] = 1;
     }
     CheckFourInARow(i, daBox.Column);
 }