黑马程序员技术交流社区
标题:
飞行棋的棋盘。半成品~
[打印本页]
作者:
q55964133
时间:
2014-5-26 12:42
标题:
飞行棋的棋盘。半成品~
7714580_102309224197_2.jpg
(175.7 KB, 下载次数: 39)
下载附件
2014-5-26 12:40 上传
这个飞行棋的棋盘。。。。
画了之后。。。才发现。。要从0 开始。。。这里先将就的看吧。。。
用代码生成出来的。。。。可能 方法土了点。。。每次画都要想坐标。。。。
附上我的代码。。。希望有大神 提供出 更好的。。。。
public void ViewShow()
{
//i 是格数 J控制格数到哪 k是显示颜色
//画左一横
for (int i = 1; i <= 5; i++)
{
PictureBox pic = new PictureBox();
pic.Size = new Size(34, 30);
pic.Image = Image.FromFile(Application.StartupPath + @"\img\1.jpg");
pic.Location = new System.Drawing.Point(1+i * 31, 130);
pic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.Controls.Add(pic);
}
for (int i = 1; i <= 3; i++)
{
PictureBox pic = new PictureBox();
pic.Size = new Size(34, 30);
pic.Image = Image.FromFile(Application.StartupPath + @"\img\1.jpg");
pic.Location = new System.Drawing.Point( 155, 5+i*31);
pic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.Controls.Add(pic);
}
for (int i = 1; i <= 7; i++)
{
PictureBox pic = new PictureBox();
pic.Size = new Size(34, 30);
pic.Image = Image.FromFile(Application.StartupPath + @"\img\1.jpg");
pic.Location = new System.Drawing.Point(125 + i * 31, 5);
pic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.Controls.Add(pic);
}
for (int i = 1; i <= 3; i++)
{
PictureBox pic = new PictureBox();
pic.Size = new Size(34, 30);
pic.Image = Image.FromFile(Application.StartupPath + @"\img\1.jpg");
pic.Location = new System.Drawing.Point(342, 5 + i * 31);
pic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.Controls.Add(pic);
}
for (int i = 1; i <= 5; i++)
{
PictureBox pic = new PictureBox();
pic.Size = new Size(34, 30);
pic.Image = Image.FromFile(Application.StartupPath + @"\img\1.jpg");
pic.Location = new System.Drawing.Point(311+i * 31, 129);
pic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.Controls.Add(pic);
}
for (int i = 1; i <= 6; i++)
{
PictureBox pic = new PictureBox();
pic.Size = new Size(34, 30);
pic.Image = Image.FromFile(Application.StartupPath + @"\img\1.jpg");
pic.Location = new System.Drawing.Point(466, 129+i*31);
pic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.Controls.Add(pic);
}
for (int i = 1; i <= 5; i++)
{
PictureBox pic = new PictureBox();
pic.Size = new Size(34, 30);
pic.Image = Image.FromFile(Application.StartupPath + @"\img\1.jpg");
pic.Location = new System.Drawing.Point(311 + i * 31, 315);
pic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.Controls.Add(pic);
}
for (int i = 1; i <= 3; i++)
{
PictureBox pic = new PictureBox();
pic.Size = new Size(34, 30);
pic.Image = Image.FromFile(Application.StartupPath + @"\img\1.jpg");
pic.Location = new System.Drawing.Point(342, 315 + i * 31);
pic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.Controls.Add(pic);
}
for (int i = 1; i <= 7; i++)
{
PictureBox pic = new PictureBox();
pic.Size = new Size(34, 30);
pic.Image = Image.FromFile(Application.StartupPath + @"\img\1.jpg");
pic.Location = new System.Drawing.Point(125+i*31, 439);
pic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.Controls.Add(pic);
}
for (int i = 1; i <= 3; i++)
{
PictureBox pic = new PictureBox();
pic.Size = new Size(34, 30);
pic.Image = Image.FromFile(Application.StartupPath + @"\img\1.jpg");
pic.Location = new System.Drawing.Point(156, 439 - i * 31);
pic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.Controls.Add(pic);
}
for (int i = 1; i <= 5; i++)
{
PictureBox pic = new PictureBox();
pic.Size = new Size(34, 30);
pic.Image = Image.FromFile(Application.StartupPath + @"\img\1.jpg");
pic.Location = new System.Drawing.Point(187-i*31, 315);
pic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.Controls.Add(pic);
}
for (int i = 1; i <= 5; i++)
{
PictureBox pic = new PictureBox();
pic.Size = new Size(34, 30);
pic.Image = Image.FromFile(Application.StartupPath + @"\img\1.jpg");
pic.Location = new System.Drawing.Point(32, 315-i*31);
pic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.Controls.Add(pic);
}
}
复制代码
搞了一个晚上的 求加技术分。。。。
作者:
continue
时间:
2014-5-26 18:21
楼主,可以考虑将代码重构 简化一下
作者:
夜猫子进宅
时间:
2014-6-7 14:00
虽然没看懂看起来好像很厉害的样子
作者:
boy_AND_gou
时间:
2014-6-8 21:29
我自己独立写了一个飞行棋,写得我特么想吐!
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2