资源简介
值得一看的小游戏,比较有意思的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.Threading.Tasks;
namespace 猜数
{
public partial class Form1 : Form
{
int n;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender EventArgs e)
{
}
private void button1_Click(object sender EventArgs e)
{
Random a = new Random();
n = a.Next(1 101);
int x = 10;
int y = 60;
for (int i = 0; i < 100; i++)
{
label1.Visible = false;
Button bt = new Button();
bt.BackColor = System.Drawing.Color.SteelBlue;
bt.Text = (i + 1).ToString();
bt.Name = (i + 1).ToString();
bt.Width = 40;
bt.Height = 40;
bt.Location = new Point(x y);
bt.Click += new EventHandler(bt_Click);
x +=36;
if ((i + 1) % 10 == 0)
{
x = 10;
y += 36;
}
Controls.Add(bt);
}
}
private void button2_Click(object sender EventArgs e)
{
Application.Exit();
}
private void bt_Click(object sender EventArgs e)
{
Button but = (Button)sender;
int t = int.Parse(but.Text);
if (t == n)
{
label1.Text = “ 恭喜你猜对啦 “;
label1.Visible = true;
but .BackColor = System .Drawing .Color .Red;
}
else if(t < n )
but.Text = “小了“;
else
but.Text = “大了“;
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 27136 2019-10-06 17:34 猜数\猜数\bin\Debug\猜数.exe
文件 26112 2019-10-06 17:34 猜数\猜数\bin\Debug\猜数.pdb
文件 11600 2019-10-06 17:34 猜数\猜数\bin\Debug\猜数.vshost.exe
文件 490 2018-09-15 15:29 猜数\猜数\bin\Debug\猜数.vshost.exe.manifest
文件 2026 2019-10-05 19:43 猜数\猜数\Form1.cs
文件 4697 2019-10-05 19:17 猜数\猜数\Form1.Designer.cs
文件 31192 2019-10-05 19:17 猜数\猜数\Form1.resx
文件 5420 2019-10-06 17:33 猜数\猜数\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6296 2019-10-06 17:34 猜数\猜数\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 586 2019-10-06 17:34 猜数\猜数\obj\x86\Debug\猜数.csproj.FileListAbsolute.txt
文件 975 2019-10-05 19:17 猜数\猜数\obj\x86\Debug\猜数.csproj.GenerateResource.Cache
文件 9174 2019-10-06 17:34 猜数\猜数\obj\x86\Debug\猜数.csprojResolveAssemblyReference.cache
文件 27136 2019-10-06 17:34 猜数\猜数\obj\x86\Debug\猜数.exe
文件 17209 2019-10-05 19:17 猜数\猜数\obj\x86\Debug\猜数.Form1.resources
文件 26112 2019-10-06 17:34 猜数\猜数\obj\x86\Debug\猜数.pdb
文件 180 2019-10-05 18:15 猜数\猜数\obj\x86\Debug\猜数.Properties.Resources.resources
文件 487 2019-10-05 17:41 猜数\猜数\Program.cs
文件 1344 2019-10-05 17:41 猜数\猜数\Properties\AssemblyInfo.cs
文件 2864 2019-10-05 17:41 猜数\猜数\Properties\Resources.Designer.cs
文件 5612 2019-10-05 17:41 猜数\猜数\Properties\Resources.resx
文件 1093 2019-10-05 17:41 猜数\猜数\Properties\Settings.Designer.cs
文件 249 2019-10-05 17:41 猜数\猜数\Properties\Settings.settings
文件 3671 2019-10-05 18:15 猜数\猜数\猜数.csproj
文件 860 2019-10-05 17:41 猜数\猜数.sln
..A..H. 17920 2019-10-07 20:17 猜数\猜数.suo
目录 0 2019-10-05 17:41 猜数\猜数\obj\x86\Debug\TempPE
目录 0 2019-10-06 17:34 猜数\猜数\obj\x86\Debug
目录 0 2019-10-05 18:15 猜数\猜数\bin\Debug
目录 0 2019-10-05 17:41 猜数\猜数\obj\x86
目录 0 2019-10-05 17:41 猜数\猜数\bin
............此处省略7个文件信息
- 上一篇:C#WinForm使用CefSharp内嵌
- 下一篇:C#考勤管理系统完整源码
相关资源
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
评论
共有 条评论