frmRename.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace PictureManage
{
    public partial class frmRename : Form
    {
        public frmRename()
        {
            InitializeComponent();
        }
        public string filename;
        public string filepath;
        public string filetype;
        private void frmRename_Load(object sender, EventArgs e)
        {
            textBox1.Text = filename;
            textBox2.Text = filename;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox2.Text == "")
                {
                    MessageBox.Show("请输入文件名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    string path = filepath.Remove(filepath.LastIndexOf("\\"));
                    string newPath;
                    if (path.Length == 4)
                    {
                        newPath = path;
                    }
                    else
                    {
                        newPath = path + "\\";
                    }
                    string newfilepath = newPath + textBox2.Text.Trim() + "." + filetype;
                    FileInfo fi = new FileInfo(newfilepath);
                    if (fi.Exists)
                    {
                        MessageBox.Show("文件名存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    else
                    {
                        File.Move(filepath, newfilepath);
后面还有 12 行代码,购买后查看完整代码

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

AI 解读 AI

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

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