C# winfrom拼图游戏

本文介绍了一款基于C# WinForms开发的拼图游戏,尽管存在一些bug,但展示了从启动界面到游戏界面的实现过程。代码来源于网络,包括Menus和游戏界面(form)两个主要部分。
摘要由CSDN通过智能技术生成

代码来着网络,这个拼图游戏还是有些bug的,因为很多地方没有做的很好。。


一共分为两个界面,一个是启动界面(Menus),一个为游戏界面(form)


Menus的代码

using 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 拼图游戏
{
    public partial class Menu : Form
    {
        public Menu()
        {
            InitializeComponent();
            GamePage.img = Image.FromFile(@"F:\\拼图游戏\\拼图游戏\\Resources\\1.jpg");
            Control.CheckForIllegalCrossThreadCalls = false;
        }


        private void button1_Click_1(object sender, EventArgs e)
        {
            
        }

        private void button2_Click(object sender, EventArgs e)
        {
            GamePage.dif = puzzle.Diff.ordinary;
            this.Hide();
            Form1 ff = new Form1();
            ff.closefather += new 拼图游戏.Form1.childclose(this.closethis);
            ff.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            GamePage.dif = puzzle.Diff.difficulty;
            this.Hide();
            Form1 ff = new Form1();
            ff.closefather += new 拼图游戏.Form1.childclose(this.closethis);
            ff.Show();
        }

        public void closethis()
        {
            this.Show();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.ShowDialog();
            GamePage.img = Image.FromFile(ofd.FileName).GetThumbnailImage(600, 600, new Image.GetThumbnailImageAbort(delegate { return false; }), IntPtr.Zero);
        }

        private void Menu_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            GamePage.dif = puzzle.Diff.simple;
            this.Hide();
            Form1 ff = new Form1();
            ff.closefather += new 拼图游戏.Form1.childclose(this.closethis);
            ff.Show();
        }
    }
}
form代码

using 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 拼图游戏
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private puzzle puzzle;
        private int Num = 0;
        private Image img;
      
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值