MineSweeper/FrmMain.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MineSweeper
{
public partial class FrmMain : Form
{
private Point mousePoint = new Point();
private bool isPressOnWindow = false;
public FrmMain()
{
InitializeComponent();
gameView.OnPublishGameTimeEvent += description =>
{
lbGameTime.Text = "当前耗时:" + description;
};
}
private void btnPlayGame_Click(object sender, EventArgs e)
{
gameView.ResetGameMap();
}
private void FrmMain_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
mousePoint.X = -e.X;
mousePoint.Y = -e.Y;
isPressOnWindow = true;
}
}
private void FrmMain_MouseMove(object sender, MouseEventArgs e)
{
if (isPressOnWindow)
{
Point mouseSet = Control.MousePosition;
mouseSet.Offset(mousePoint.X, mousePoint.Y); //设置移动后的位置
Location = mouseSet;
}
}
private void FrmMain_MouseUp(object sender, MouseEventArgs e)
{
if (isPressOnWindow)
{
isPressOnWindow = false;
}
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。