示例#1
0
 //判定鼠标是否在任意的华容道柱体(sticks)内
 public bool isInStickX(Stick stick, Point point)
 {
     if ((point.x >= stick.x) && (point.x <= (stick.x + stick.width)) && (point.y >= stick.y) && (point.y <= (stick.y + stick.height)))
     {
         return(true);
     }
     return(false);
 }
示例#2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //设置双缓冲
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);

            //载入华容道的信息
            sticks[0] = new Stick(420, 195, 60, 30, 0, false, 13, 6, 2);
            sticks[1] = new Stick(300, 75, 60, 30, 0, false, 9, 2, 2);
            sticks[2] = new Stick(240, 165, 90, 30, 0, false, 7, 5, 3);
            sticks[3] = new Stick(330, 285, 90, 30, 0, false, 10, 9, 3);
            sticks[4] = new Stick(210, 285, 60, 30, 0, false, 6, 9, 2);
            sticks[5] = new Stick(300, 225, 30, 150, 1, false, 9, 7, 5);
            sticks[6] = new Stick(390, 75, 30, 150, 1, false, 12, 2, 5);
            sticks[7] = new Stick(150, 225, 30, 90, 1, false, 4, 7, 3);
        }