• 博客(0)
  • 资源 (3)
  • 问答 (3)

空空如也

俄罗斯方块

运用工厂模式和二维数组 //画面初始化 private void MainFrm_Load(object sender, EventArgs e) { this.picGamePalette.Size = new Size(this.game.GamePalette.Width * 15, this.game.GamePalette.Height * 15); this.picGamePalette.BackColor = this.game.GamePalette.BgColor; this.picGamePalette.Location = this.game.GamePalette.Location; this.picPalette.Size = new Size(this.game.Palette.Width * 15, this.game.Palette.Height * 15); this.picPalette.BackColor = this.game.Palette.BgColor; this.picPalette.Location = this.game.Palette.Location; }

2012-10-29

模拟 贪吃蛇

贪吃蛇,运用了面向对象程序编程 //在屏幕随机位置显示食物 public void ShowFood() { Random rnd = new Random(); int x, y; do { x = rnd.Next(0, 35) * this.snake.SnkWidth; y = 32 + rnd.Next(0, 30) * this.snake.SnkWidth; } while (this.snake.CheckInSnakeBody(x, y)); FoodLct.X = x; FoodLct.Y = y; }

2012-10-29

模拟停车位

模拟停车位, public SortedList<String, Car> ShowCarByPage(int page, int num) { SortedList<String, Car> temp = new SortedList<String, Car>(); for (int i = (page - 1) * num; i < page * num && i < this.Cars.Count; i++) { temp.Add(this.Cars.ElementAt(i).Key, this.Cars.ElementAt(i).Value); } return temp; } //获得分页的页码 public int GetPageNum(int num) { int temp = this.Cars.Count % num; return temp != 0 ? this.Cars.Count / num + 1 : this.Cars.Count / num; } }

2012-10-29

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除