资源简介
C#飞机大战源代码,主要技术不多,主要解决的问题是资源的占用,和对飞机的处理
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Media;
using System.Threading;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
PictureBox zd;
Random xx = new Random();
PictureBox again;
int fen = 0;
SoundPlayer zidan = new SoundPlayer(Properties.Resources.zid);
SoundPlayer gameover = new SoundPlayer(Properties.Resources.gameover);
private void Form1_KeyDown(object sender KeyEventArgs e)
{
Point my = myplane.Location;
if (e.KeyValue == 37)
{if(my.X>=0) my.X-=10; myplane.Location = my; }else
if (e.KeyValue == 39)
{if(my.X+myplane.Size.Width<=this.Width) my.X+=10; myplane.Location = my; }else
if (e.KeyValue == 38)
{if(my.Y>=0)my.Y-=10; myplane.Location = my; }else
if (e.KeyValue == 40)
{if(my.Y+myplane.Size.Height<=this.Size.Height) my.Y+=10; myplane.Location = my; }
}
private void newz_Tick(object sender EventArgs e)
{
zd = new System.Windows.Forms.PictureBox();
zd.Name = “zd“;
zd.Borderstyle = Borderstyle.None;
zd.Size = new Size(4 5);
zd.Location = new Point(myplane.Location.X + myplane.Size.Width / 2 - zd.Width / 2 myplane.Location.Y - zd.Size.Height);
zd.SizeMode = PictureBoxSizeMode.StretchImage;
zd.Image = Properties.Resources.zidan;
this.Controls.Add(zd);
zidan.Play();
}
private void y_Tick(object sender EventArgs e)
{
foreach (PictureBox pp in this.Controls)
{
if (pp.Name == “zd“)
{
pp.Location = new Point(pp.Location.X pp.Location.Y - 3);
if (pp.Location.Y <= 0) { this.Controls.Remove(pp); pp.Dispose(); }
}
}
}
private void newagainst_Tick(object sender EventArgs e)
{
for (int i = 0; i < 10; i++)
xx.Next();
again = new System.Windows.Forms.PictureBox();
again.Name = “again“;
again.Borderstyle = Borderstyle.None;
again.Size = new Size(36 36);
again.Location = new Point(xx.Next(0this.Size.Width-again.Size.Width)1);
again.SizeMode = PictureBoxSizeMode.StretchImage;
again.Image = Properties.Resources.icon36x36;
this.Controls.Add(again);
}
private void again_y_Tick(object sender EventArgs e)
{
foreach (PictureBox pp in th
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 16958 2014-01-25 21:46 WindowsFormsApplication1\WindowsFormsApplication1\airplane.ico
文件 134656 2014-02-27 19:25 WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
文件 38400 2014-02-27 19:25 WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb
文件 14328 2014-03-21 08:32 WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
文件 490 2013-06-18 20:24 WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest
文件 6174 2014-02-27 19:25 WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs
文件 4878 2014-01-29 15:20 WindowsFormsApplication1\WindowsFormsApplication1\Form1.Designer.cs
文件 7151 2014-01-29 15:20 WindowsFormsApplication1\WindowsFormsApplication1\Form1.resx
文件 705 2014-01-26 00:04 WindowsFormsApplication1\WindowsFormsApplication1\Form2.cs
文件 2019 2014-01-25 23:46 WindowsFormsApplication1\WindowsFormsApplication1\Form2.Designer.cs
文件 6008 2014-01-25 23:46 WindowsFormsApplication1\WindowsFormsApplication1\Form2.resx
文件 5632 2014-01-25 23:43 WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 1150 2014-03-21 08:32 WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt
文件 1153 2014-01-29 15:20 WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.GenerateResource.Cache
文件 134656 2014-02-27 19:25 WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.exe
文件 180 2014-01-29 15:20 WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.Form1.resources
文件 180 2014-01-25 23:47 WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.Form2.resources
文件 38400 2014-02-27 19:25 WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.pdb
文件 103086 2014-01-25 23:47 WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.Properties.Resources.resources
文件 505 2014-01-26 00:02 WindowsFormsApplication1\WindowsFormsApplication1\Program.cs
文件 1477 2014-01-26 00:17 WindowsFormsApplication1\WindowsFormsApplication1\Properties\AssemblyInfo.cs
文件 4290 2014-01-25 23:43 WindowsFormsApplication1\WindowsFormsApplication1\Properties\Resources.Designer.cs
文件 7415 2014-01-25 23:43 WindowsFormsApplication1\WindowsFormsApplication1\Properties\Resources.resx
文件 1109 2014-01-22 22:01 WindowsFormsApplication1\WindowsFormsApplication1\Properties\Settings.Designer.cs
文件 249 2014-01-22 22:01 WindowsFormsApplication1\WindowsFormsApplication1\Properties\Settings.settings
文件 13498 2014-01-22 22:40 WindowsFormsApplication1\WindowsFormsApplication1\Resources\airplane.png
文件 14124 2014-01-25 23:20 WindowsFormsApplication1\WindowsFormsApplication1\Resources\gameover.WAV
文件 5939 2014-01-25 22:25 WindowsFormsApplication1\WindowsFormsApplication1\Resources\icon36x36.png
文件 32044 2014-01-25 23:20 WindowsFormsApplication1\WindowsFormsApplication1\Resources\zid.wav
文件 2829 2014-01-22 23:09 WindowsFormsApplication1\WindowsFormsApplication1\Resources\zidan.png
............此处省略18个文件信息
- 上一篇:信息论,香浓、费诺编码解码程序
- 下一篇:NPOI组件
评论
共有 条评论