矩形/Form1.cs

(开头部分) 5KB

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

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 矩形
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        //图片列表
        private string Img1Path = Application.StartupPath + "\\test.jpg";
        //存储矩形列表
        List<Rectangle> PictureCuttingList = new List<Rectangle>();
        //边长
        int SideLength = 180;

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void Button_Examine_Click(object sender, EventArgs e)
        {
            if (!System.IO.File.Exists(Img1Path))
            {
                Console.WriteLine("图片路径不存在:" + Img1Path);
                return;
            }

            Bitmap bitmaps = new Bitmap(Img1Path);
            Random random = new Random();

            PictureCuttingList.Clear();
            PictureBox_Coincide.Image = null;

            for (int i = 0; i < 2; i++)
            {
                int x = random.Next(10, bitmaps.Width - SideLength);
                int y = random.Next(10, bitmaps.Height - SideLength);
                PictureCuttingList.Add(new Rectangle(new Point(x, y), new Size(SideLength, SideLength)));
            }

            //给图片画矩形
            PictureBox_Template.Image = PaintingRectangle(PictureCuttingList, bitmaps);

            //判断两个矩形是否相交
            Rectangle rectangle1 = PictureCuttingList[0];
            Rectangle rectangle2 = PictureCuttingList[1];

后面还有 98 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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