Form1.cs

(开头部分) 8KB

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

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using PaddleOCRSharp;

namespace PaddleOcr
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            dataGridViewMain.RowHeadersVisible = false;  //隐藏第一列空白
        }

        //选择文件
        private void button2_Click(object sender, EventArgs e)
        {
            int count = 1;

            //清空数据
            dataGridViewMain.Rows.Clear();

            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Multiselect = true;//该值确定是否可以选择多个文件
            dialog.Title = "请选择文件夹";
            dialog.Filter = "图片文件(*.*)|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
            dialog.RestoreDirectory = true; //记忆上次打开的目录

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string[] strNames = dialog.SafeFileNames; //文件名列表(不带路径)
                for (int i = 0; i < strNames.Length; i++)
                {
                    //Path.GetDirectoryName(dialog.FileName)+strNames[i] 路径+文件名                    
                    string strlj = Path.GetDirectoryName(dialog.FileName) + "\\" + strNames[i];//文件全路径
                    var size = new FileInfo(strlj).Length / 1024 + "k";//文件大小
                    int index = this.dataGridViewMain.Rows.Add();
                    this.dataGridViewMain.Rows[index].Cells[0].Value = count++; //序号
                    this.dataGridViewMain.Rows[index].Cells[1].Value = strlj;
                    this.dataGridViewMain.Rows[index].Cells[2].Value = size;
                }
            }
        }


        //识别方法
        private void button1_Click(object sender, EventArgs e)
        {
            //数据初始化
            int TotalCount;     //总行数
            int Percent = 0;    //百分比
后面还有 156 行代码,解锁后查看完整代码

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

AI 解读

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

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