Backup/Form1.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;


//源码下载 www.51aspx.com
namespace Hanoi
{
    public partial class Form1 : Form
    {
        private HanoiData hanoiData = new HanoiData(10);

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void panelHanoi_Paint(object sender, PaintEventArgs e)
        {
            for (float i = 1; i <= 3; i++)
            {
                float x=i/3*panelHanoi.Width-panelHanoi.Width/3/2;
                e.Graphics.DrawLine(new Pen(Color.Black, 10), x, 0, x, panelHanoi.Height);
            }

            float index = 0;
            int offset=20;
            foreach (string key in hanoiData.diskList.Keys)
            {
                index++;
                float x = index / 3 * panelHanoi.Width - panelHanoi.Width / 3 / 2;                
                for (int j = 0; j < hanoiData.diskList[key].Count; j++)
                {
                    int width = (int)((panelHanoi.Width / 3 - offset)*((float)hanoiData.diskList[key][j]/hanoiData.diskCount))+offset;
                    int left=(int)(x-width/2);
                    int height=20;
                    int top=panelHanoi.Height-(hanoiData.diskList[key].Count-j)*height;
                    e.Graphics.FillRectangle(new SolidBrush(Color.Blue), new Rectangle(left, top, width, height-2));
                    e.Graphics.DrawString(hanoiData.diskList[key][j].ToString(), this.Font, new SolidBrush(Color.White), left, top);
                }
            }
        }

        private void btnGo_Click(object sender, EventArgs e)
        {
            List<Step> steps=hanoiData.GenerateSteps();
        }

        private void btnChange1_Click(object sender, EventArgs e)
        {
            hanoiData.Move("x","y");
后面还有 58 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。