传文文件批量重命名/Form1.cs

(开头部分) 19KB

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

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



namespace 传文文件批量重命名
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();          

        }
        string[] fileNames;//文件列表


        private void button1_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Title = "选择一个文件";           
            openFileDialog1.Multiselect = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                // 获取选择的文件路径
                fileNames = openFileDialog1.FileNames;
                dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                dataGridView1.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;


                foreach (string fileName in fileNames)
                {
                    

                    string fName = Path.GetFileNameWithoutExtension(fileName);
                    string extension = Path.GetExtension (fileName);

                    string fpatch = Path.GetDirectoryName(fileName);

                   // MessageBox.Show("你选择的文件ming: " + fName+"kuozhan"+extension);

                    DataGridViewRow newRow = new DataGridViewRow();
                    newRow.Cells.Add(new DataGridViewTextBoxCell() { Value = fpatch });
                    newRow.Cells.Add(new DataGridViewTextBoxCell() { Value = fName });
                    newRow.Cells.Add(new DataGridViewTextBoxCell() { Value = extension });
                    newRow.Cells.Add(new DataGridViewTextBoxCell() { Value = fName });
                    newRow.Cells.Add(new DataGridViewTextBoxCell() { Value = extension });
                    dataGridView1.Rows.Add(newRow);
                                                         
                }
               
后面还有 462 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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