📄 winner.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace NumPuzzle
{
/// <summary>
/// Winner 的摘要说明。
/// </summary>
public class Winner : System.Windows.Forms.Form
{
int Game_Size;
int Game_Clicks;
string player;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label game_diff;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label game_clicks;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox player_name;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Winner(int GameSize,int Clicks)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
Game_Size = GameSize;
Game_Clicks = Clicks;
switch(GameSize)
{
case 3:
this.game_diff.Text = "Easy";
break;
case 4:
this.game_diff.Text = "Normal";
break;
case 5:
this.game_diff.Text = "Hard";
break;
case 6:
this.game_diff.Text = "BT";
break;
default:
this.game_diff.Text = "UnKnow";
break;
}
this.game_clicks.Text = Game_Clicks.ToString();
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.game_diff = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.game_clicks = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.player_name = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(312, 16);
this.label1.TabIndex = 0;
this.label1.Text = "Congratulations To You Guy,You are The Winner";
//
// label2
//
this.label2.Location = new System.Drawing.Point(32, 72);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(168, 16);
this.label2.TabIndex = 1;
this.label2.Text = "Your\'s Game Difficult is: ";
//
// game_diff
//
this.game_diff.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(192)), ((System.Byte)(0)));
this.game_diff.Location = new System.Drawing.Point(224, 72);
this.game_diff.Name = "game_diff";
this.game_diff.Size = new System.Drawing.Size(96, 16);
this.game_diff.TabIndex = 2;
//
// label4
//
this.label4.Location = new System.Drawing.Point(32, 112);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(304, 16);
this.label4.TabIndex = 3;
this.label4.Text = "You Used MoveTimes To Finish This Completion is: ";
//
// game_clicks
//
this.game_clicks.Font = new System.Drawing.Font("华文新魏", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.game_clicks.ForeColor = System.Drawing.Color.Red;
this.game_clicks.Location = new System.Drawing.Point(80, 136);
this.game_clicks.Name = "game_clicks";
this.game_clicks.Size = new System.Drawing.Size(192, 32);
this.game_clicks.TabIndex = 4;
this.game_clicks.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label6
//
this.label6.Location = new System.Drawing.Point(16, 176);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(360, 16);
this.label6.TabIndex = 5;
this.label6.Text = "You are Really a Genuis Guy,Can You Leave your Name Here?";
//
// button1
//
this.button1.Location = new System.Drawing.Point(144, 232);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(88, 24);
this.button1.TabIndex = 6;
this.button1.Text = "OK";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// player_name
//
this.player_name.Location = new System.Drawing.Point(56, 200);
this.player_name.Name = "player_name";
this.player_name.Size = new System.Drawing.Size(256, 21);
this.player_name.TabIndex = 7;
this.player_name.Text = "";
//
// Winner
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(386, 262);
this.Controls.Add(this.player_name);
this.Controls.Add(this.button1);
this.Controls.Add(this.label6);
this.Controls.Add(this.game_clicks);
this.Controls.Add(this.label4);
this.Controls.Add(this.game_diff);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "Winner";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Welcome Winner";
this.ResumeLayout(false);
}
#endregion
private void button1_Click(object sender, System.EventArgs e)
{
if(this.player_name.Text=="")
{
if(MessageBox.Show("大侠难道就是传说中的Red_angelX?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes)
{
player = "传说中的Red_angelX";
}
else
{
return;
}
}
else
{
player = this.player_name.Text;
}
try
{
System.IO.StreamWriter sw = new System.IO.StreamWriter("NumPuzzlePlayer",true,System.Text.Encoding.Default);
sw.WriteLine(player+"\t"+this.Game_Clicks.ToString()+"\t"+this.Game_Size.ToString());
sw.Close();
}
catch(System.IO.IOException)
{
}
Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -