C#实现批量更改文件名称大小写或扩展名
作者:芝麻粒儿 时间:2023-03-25 02:20:50
实践过程
效果
代码
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string[] files;//选择文件的集合
FileInfo fi;//创建一个FileInfo对象,用于获取文件信息
string[] lvFiles=new string[7];//向控件中添加的行信息
Thread td;//处理批量更名方法的线程
private void 添加文件ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
listView1.GridLines = true;
listView1.Items.Clear();
files = openFileDialog1.FileNames;
for (int i = 0; i < files.Length; i++)
{
string path = files[i].ToString();
fi = new FileInfo(path);
string name = path.Substring(path.LastIndexOf("\\") + 1, path.Length - 1 - path.LastIndexOf("\\"));
string ftype = path.Substring(path.LastIndexOf("."), path.Length - path.LastIndexOf("."));
string createTime = fi.CreationTime.ToShortDateString();
double a = Convert.ToDouble(Convert.ToDouble(fi.Length) / Convert.ToDouble(1024));
string fsize = a.ToString("0.0")+" KB";
lvFiles[0] = name;
lvFiles[1] = name;
lvFiles[2] = ftype;
lvFiles[3] = createTime;
lvFiles[4] = path.Remove(path.LastIndexOf("\\") + 1);
lvFiles[5] = fsize;
ListViewItem lvi = new ListViewItem(lvFiles);
lvi.UseItemStyleForSubItems = false;
lvi.SubItems[1].BackColor = Color.AliceBlue;
listView1.Items.Add(lvi);
}
tsslSum.Text = listView1.Items.Count.ToString();
}
}
bool flag = true;
private void 总在最前ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (flag)
{
总在最前ToolStripMenuItem.Checked = true;
this.TopMost = true;
flag = false;
}
else
{
总在最前ToolStripMenuItem.Checked = false;
this.TopMost = false;
flag = true;
}
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)//文件名大写
{
if (listView1.Items.Count > 0)
{
if (radioButton1.Checked)
{
for (int i = 0; i < listView1.Items.Count; i++)
{
string name = listView1.Items[i].SubItems[1].Text;
string name1 = name.Remove(name.LastIndexOf("."));
string newName = name.Replace(name1,name1.ToUpper());
listView1.Items[i].SubItems[1].Text = newName;
}
}
}
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)//文件名小写
{
if (listView1.Items.Count > 0)
{
if (radioButton2.Checked)
{
for (int i = 0; i < listView1.Items.Count; i++)
{
string name = listView1.Items[i].SubItems[1].Text;
string name1 = name.Remove(name.LastIndexOf("."));
string newName = name.Replace(name1, name1.ToLower());
listView1.Items[i].SubItems[1].Text = newName;
}
}
}
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)//第一个字母大写
{
if (listView1.Items.Count > 0)
{
if (radioButton3.Checked)
{
for (int i = 0; i < listView1.Items.Count; i++)
{
string name = listView1.Items[i].SubItems[1].Text;
string name1 = name.Substring(0,1);
string name2 = name.Substring(1);
string newName = name1.ToUpper() + name2;
listView1.Items[i].SubItems[1].Text = newName;
}
}
}
}
private void radioButton4_CheckedChanged(object sender, EventArgs e)//扩展名大写
{
if (listView1.Items.Count > 0)
{
if (radioButton4.Checked)
{
for (int i = 0; i < listView1.Items.Count; i++)
{
string name = listView1.Items[i].SubItems[1].Text;
string name1 = name.Substring(name.LastIndexOf("."), name.Length - name.LastIndexOf("."));
string newName = name.Replace(name1, name1.ToUpper());
listView1.Items[i].SubItems[1].Text = newName;
}
}
}
}
private void radioButton5_CheckedChanged(object sender, EventArgs e)
{
if (listView1.Items.Count > 0)
{
if (radioButton5.Checked)
{
for (int i = 0; i < listView1.Items.Count; i++)
{
string name = listView1.Items[i].SubItems[1].Text;
string name1 = name.Substring(name.LastIndexOf("."), name.Length - name.LastIndexOf("."));
string newName = name.Replace(name1, name1.ToLower());
listView1.Items[i].SubItems[1].Text = newName;
}
}
}
}
bool IsOK = false;//判断是否应用了模板
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)//选择模板的下拉框
{
int k = (int)nuStart.Value;
if (comboBox2.Text != "")
{
txtTemplate.Text = comboBox2.Text.Remove(comboBox2.Text.LastIndexOf("_"));
int B = comboBox2.SelectedIndex;
switch (B)
{
case 0:
if (listView1.Items.Count > 0)
{
for (int i = 0; i < listView1.Items.Count; i++)
{
string name = listView1.Items[i].SubItems[1].Text;
string name1 = name.Remove(name.LastIndexOf("."));
string name2 = "pic_" + k.ToString();
k = k + (int)nuAdd.Value;
string newName = name.Replace(name1, name2);
listView1.Items[i].SubItems[1].Text = newName;
}
IsOK = true;
}
break;
case 1:
if (listView1.Items.Count > 0)
{
for (int i = 0; i < listView1.Items.Count; i++)
{
string name = listView1.Items[i].SubItems[1].Text;
string name1 = name.Remove(name.LastIndexOf("."));
string name2 = "file_" + k.ToString();
k = k +(int) nuAdd.Value;
string newName = name.Replace(name1,name2);
listView1.Items[i].SubItems[1].Text = newName;
}
IsOK = true;
}
break;
}
}
}
private void StartNumAndAdd()//设置起始数字和增量值
{
int k = (int)nuStart.Value;
if (comboBox2.Text != "")
{
if (listView1.Items.Count > 0)
{
for (int i = 0; i < listView1.Items.Count; i++)
{
string name = listView1.Items[i].SubItems[1].Text;
string name1 = name.Remove(name.LastIndexOf("."));
string name2 = name1.Remove(name.LastIndexOf("_")+1)+k.ToString();
k = k + (int)nuAdd.Value;
string newName = name.Replace(name1, name2);
listView1.Items[i].SubItems[1].Text = newName;
}
IsOK = true;
}
}
}
private void nuStart_ValueChanged(object sender, EventArgs e)//选择起始数字
{
StartNumAndAdd();
}
private void nuAdd_ValueChanged(object sender, EventArgs e)//选择增量值
{
StartNumAndAdd();
}
private void txtTemplate_TextChanged(object sender, EventArgs e)//更换模板样式
{
if (listView1.Items.Count > 0)
{
if (IsOK&&txtTemplate.Text.Trim()!=""&&comboBox2.Text!="")
{
for (int i = 0; i < listView1.Items.Count; i++)
{
string name = listView1.Items[i].SubItems[1].Text;
string name1 = name.Remove(name.LastIndexOf("_") + 1);
string newName = name.Replace(name1, txtTemplate.Text.Trim() + "_");
listView1.Items[i].SubItems[1].Text = newName;
}
}
}
}
private void ChangeName()
{
int flag = 0;
try
{
toolStripProgressBar1.Minimum = 0;
toolStripProgressBar1.Maximum = listView1.Items.Count - 1;
for (int i = 0; i < listView1.Items.Count; i++)
{
string path = listView1.Items[i].SubItems[4].Text;
string sourcePath = path + listView1.Items[i].SubItems[0].Text;
string newPath = path + listView1.Items[i].SubItems[1].Text;
File.Copy(sourcePath, newPath);
File.Delete(sourcePath);
toolStripProgressBar1.Value = i;
listView1.Items[i].SubItems[0].Text = listView1.Items[i].SubItems[1].Text;
listView1.Items[i].SubItems[6].Text = "√成功";
}
}
catch(Exception ex)
{
flag++;
MessageBox.Show(ex.Message);
}
finally
{
tsslError.Text = flag.ToString() + " 个错误";
}
}
private void 更名ToolStripMenuItem_Click(object sender, EventArgs e)//开始批量更名
{
if (listView1.Items.Count > 0)
{
for (int i = 0; i < listView1.Items.Count; i++)
{
listView1.Items[i].SubItems[6].Text = "";
}
tsslError.Text = "";
td = new Thread(new ThreadStart(ChangeName));
td.Start();
}
}
private void Form1_Load(object sender, EventArgs e)
{
CheckForIllegalCrossThreadCalls = false;
}
private void 导出文件列表ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
StreamWriter sw;
string txt = "";
string path = saveFileDialog1.FileName;
for (int i = 0; i < listView1.Items.Count; i++)
{
txt = listView1.Items[i].SubItems[0].Text + " " + listView1.Items[i].SubItems[1].Text;
sw = File.AppendText(path);
sw.WriteLine(txt);
sw.Close();
}
}
}
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private static string TraditionalChineseToSimplifiedChinese(string str)//繁体转简体
{
return (Microsoft.VisualBasic.Strings.StrConv(str,Microsoft.VisualBasic.VbStrConv.SimplifiedChinese,0));
}
private static string SimplifiedChineseToTraditionalChinese(string str)//简体转繁体
{
return (Microsoft.VisualBasic.Strings.StrConv(str as string ,Microsoft.VisualBasic.VbStrConv.TraditionalChinese,0));
}
private void 繁体转简体ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (listView1.Items.Count > 0)
{
for (int i = 0; i < listView1.Items.Count; i++)
{
string name = listView1.Items[i].SubItems[1].Text;
string name1 = TraditionalChineseToSimplifiedChinese(name);
listView1.Items[i].SubItems[1].Text = name1;
}
}
}
private void 简体转繁体ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (listView1.Items.Count > 0)
{
for (int i = 0; i < listView1.Items.Count; i++)
{
string name = listView1.Items[i].SubItems[1].Text;
string name1 = SimplifiedChineseToTraditionalChinese(name);
listView1.Items[i].SubItems[1].Text = name1;
}
}
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
if (td != null)
{
td.Abort();
}
}
private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
{
AboutBox1 ab = new AboutBox1();
ab.ShowDialog();
}
}
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.文件ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.添加文件ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.总在最前ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.导出文件列表ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.更名PToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.更名ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.繁体转简体ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.简体转繁体ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.帮助HToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.关于ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
this.tsslSum = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar();
this.tsslError = new System.Windows.Forms.ToolStripStatusLabel();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.radioButton5 = new System.Windows.Forms.RadioButton();
this.radioButton4 = new System.Windows.Forms.RadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioButton3 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.txtTemplate = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.nuAdd = new System.Windows.Forms.NumericUpDown();
this.label4 = new System.Windows.Forms.Label();
this.nuStart = new System.Windows.Forms.NumericUpDown();
this.label3 = new System.Windows.Forms.Label();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.listView1 = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
this.columnHeader6 = new System.Windows.Forms.ColumnHeader();
this.columnHeader7 = new System.Windows.Forms.ColumnHeader();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.tabPage2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nuAdd)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nuStart)).BeginInit();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.文件ToolStripMenuItem,
this.更名PToolStripMenuItem,
this.帮助HToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
this.menuStrip1.Size = new System.Drawing.Size(597, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// 文件ToolStripMenuItem
//
this.文件ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.添加文件ToolStripMenuItem,
this.总在最前ToolStripMenuItem,
this.导出文件列表ToolStripMenuItem,
this.退出ToolStripMenuItem});
this.文件ToolStripMenuItem.Name = "文件ToolStripMenuItem";
this.文件ToolStripMenuItem.Size = new System.Drawing.Size(59, 20);
this.文件ToolStripMenuItem.Text = "文件(&F)";
//
// 添加文件ToolStripMenuItem
//
this.添加文件ToolStripMenuItem.Image = global::FileBatchChangeName.Properties.Resources.图标__220_;
this.添加文件ToolStripMenuItem.Name = "添加文件ToolStripMenuItem";
this.添加文件ToolStripMenuItem.Size = new System.Drawing.Size(142, 22);
this.添加文件ToolStripMenuItem.Text = "添加文件...";
this.添加文件ToolStripMenuItem.Click += new System.EventHandler(this.添加文件ToolStripMenuItem_Click);
//
// 总在最前ToolStripMenuItem
//
this.总在最前ToolStripMenuItem.Name = "总在最前ToolStripMenuItem";
this.总在最前ToolStripMenuItem.Size = new System.Drawing.Size(142, 22);
this.总在最前ToolStripMenuItem.Text = "总在最前";
this.总在最前ToolStripMenuItem.Click += new System.EventHandler(this.总在最前ToolStripMenuItem_Click);
//
// 导出文件列表ToolStripMenuItem
//
this.导出文件列表ToolStripMenuItem.Image = global::FileBatchChangeName.Properties.Resources.图标__166_;
this.导出文件列表ToolStripMenuItem.Name = "导出文件列表ToolStripMenuItem";
this.导出文件列表ToolStripMenuItem.Size = new System.Drawing.Size(142, 22);
this.导出文件列表ToolStripMenuItem.Text = "导出文件列表";
this.导出文件列表ToolStripMenuItem.Click += new System.EventHandler(this.导出文件列表ToolStripMenuItem_Click);
//
// 退出ToolStripMenuItem
//
this.退出ToolStripMenuItem.Image = global::FileBatchChangeName.Properties.Resources.图标__99_;
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(142, 22);
this.退出ToolStripMenuItem.Text = "退出";
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click);
//
// 更名PToolStripMenuItem
//
this.更名PToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.更名ToolStripMenuItem,
this.繁体转简体ToolStripMenuItem,
this.简体转繁体ToolStripMenuItem});
this.更名PToolStripMenuItem.Name = "更名PToolStripMenuItem";
this.更名PToolStripMenuItem.Size = new System.Drawing.Size(59, 20);
this.更名PToolStripMenuItem.Text = "更名(&P)";
//
// 更名ToolStripMenuItem
//
this.更名ToolStripMenuItem.Image = global::FileBatchChangeName.Properties.Resources.图标;
this.更名ToolStripMenuItem.Name = "更名ToolStripMenuItem";
this.更名ToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.更名ToolStripMenuItem.Text = "应用";
this.更名ToolStripMenuItem.Click += new System.EventHandler(this.更名ToolStripMenuItem_Click);
//
// 繁体转简体ToolStripMenuItem
//
this.繁体转简体ToolStripMenuItem.Image = global::FileBatchChangeName.Properties.Resources.netspell;
this.繁体转简体ToolStripMenuItem.Name = "繁体转简体ToolStripMenuItem";
this.繁体转简体ToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.繁体转简体ToolStripMenuItem.Text = "繁体转简体";
this.繁体转简体ToolStripMenuItem.Click += new System.EventHandler(this.繁体转简体ToolStripMenuItem_Click);
//
// 简体转繁体ToolStripMenuItem
//
this.简体转繁体ToolStripMenuItem.Image = global::FileBatchChangeName.Properties.Resources.netspell;
this.简体转繁体ToolStripMenuItem.Name = "简体转繁体ToolStripMenuItem";
this.简体转繁体ToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.简体转繁体ToolStripMenuItem.Text = "简体转繁体";
this.简体转繁体ToolStripMenuItem.Click += new System.EventHandler(this.简体转繁体ToolStripMenuItem_Click);
//
// 帮助HToolStripMenuItem
//
this.帮助HToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.关于ToolStripMenuItem});
this.帮助HToolStripMenuItem.Name = "帮助HToolStripMenuItem";
this.帮助HToolStripMenuItem.Size = new System.Drawing.Size(59, 20);
this.帮助HToolStripMenuItem.Text = "帮助(&H)";
//
// 关于ToolStripMenuItem
//
this.关于ToolStripMenuItem.Image = global::FileBatchChangeName.Properties.Resources.图标__179_;
this.关于ToolStripMenuItem.Name = "关于ToolStripMenuItem";
this.关于ToolStripMenuItem.Size = new System.Drawing.Size(94, 22);
this.关于ToolStripMenuItem.Text = "关于";
this.关于ToolStripMenuItem.Click += new System.EventHandler(this.关于ToolStripMenuItem_Click);
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1,
this.toolStripStatusLabel2,
this.tsslSum,
this.toolStripStatusLabel3,
this.toolStripProgressBar1,
this.tsslError});
this.statusStrip1.Location = new System.Drawing.Point(0, 412);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(597, 22);
this.statusStrip1.TabIndex = 2;
this.statusStrip1.Text = "statusStrip1";
//
// toolStripStatusLabel1
//
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
this.toolStripStatusLabel1.Size = new System.Drawing.Size(0, 17);
//
// toolStripStatusLabel2
//
this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
this.toolStripStatusLabel2.Size = new System.Drawing.Size(59, 17);
this.toolStripStatusLabel2.Text = "文件总数:";
//
// tsslSum
//
this.tsslSum.AutoSize = false;
this.tsslSum.Name = "tsslSum";
this.tsslSum.Size = new System.Drawing.Size(150, 17);
this.tsslSum.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// toolStripStatusLabel3
//
this.toolStripStatusLabel3.ForeColor = System.Drawing.Color.Gray;
this.toolStripStatusLabel3.Name = "toolStripStatusLabel3";
this.toolStripStatusLabel3.Size = new System.Drawing.Size(11, 17);
this.toolStripStatusLabel3.Text = "|";
//
// toolStripProgressBar1
//
this.toolStripProgressBar1.Maximum = 10000;
this.toolStripProgressBar1.Name = "toolStripProgressBar1";
this.toolStripProgressBar1.Size = new System.Drawing.Size(200, 16);
//
// tsslError
//
this.tsslError.Name = "tsslError";
this.tsslError.Size = new System.Drawing.Size(0, 17);
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 24);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.tabControl1);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.listView1);
this.splitContainer1.Size = new System.Drawing.Size(597, 388);
this.splitContainer1.SplitterDistance = 122;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 1;
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(597, 122);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.pictureBox1);
this.tabPage1.Controls.Add(this.groupBox2);
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Location = new System.Drawing.Point(4, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(589, 97);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "基本设置";
this.tabPage1.UseVisualStyleBackColor = true;
//
// pictureBox1
//
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.Image = global::FileBatchChangeName.Properties.Resources.gg;
this.pictureBox1.Location = new System.Drawing.Point(401, 12);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(182, 79);
this.pictureBox1.TabIndex = 5;
this.pictureBox1.TabStop = false;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.radioButton5);
this.groupBox2.Controls.Add(this.radioButton4);
this.groupBox2.Location = new System.Drawing.Point(8, 51);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(387, 40);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "扩展名";
//
// radioButton5
//
this.radioButton5.AutoSize = true;
this.radioButton5.Location = new System.Drawing.Point(124, 18);
this.radioButton5.Name = "radioButton5";
this.radioButton5.Size = new System.Drawing.Size(83, 16);
this.radioButton5.TabIndex = 4;
this.radioButton5.TabStop = true;
this.radioButton5.Text = "扩展名小写";
this.radioButton5.UseVisualStyleBackColor = true;
this.radioButton5.CheckedChanged += new System.EventHandler(this.radioButton5_CheckedChanged);
//
// radioButton4
//
this.radioButton4.AutoSize = true;
this.radioButton4.Location = new System.Drawing.Point(6, 18);
this.radioButton4.Name = "radioButton4";
this.radioButton4.Size = new System.Drawing.Size(83, 16);
this.radioButton4.TabIndex = 3;
this.radioButton4.TabStop = true;
this.radioButton4.Text = "扩展名大写";
this.radioButton4.UseVisualStyleBackColor = true;
this.radioButton4.CheckedChanged += new System.EventHandler(this.radioButton4_CheckedChanged);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.radioButton3);
this.groupBox1.Controls.Add(this.radioButton2);
this.groupBox1.Controls.Add(this.radioButton1);
this.groupBox1.Location = new System.Drawing.Point(8, 6);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(387, 40);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "文件名";
//
// radioButton3
//
this.radioButton3.AutoSize = true;
this.radioButton3.Location = new System.Drawing.Point(244, 16);
this.radioButton3.Name = "radioButton3";
this.radioButton3.Size = new System.Drawing.Size(107, 16);
this.radioButton3.TabIndex = 2;
this.radioButton3.TabStop = true;
this.radioButton3.Text = "第一个字母大写";
this.radioButton3.UseVisualStyleBackColor = true;
this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged);
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(124, 16);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(83, 16);
this.radioButton2.TabIndex = 1;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "文件名小写";
this.radioButton2.UseVisualStyleBackColor = true;
this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(6, 16);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(83, 16);
this.radioButton1.TabIndex = 0;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "文件名大写";
this.radioButton1.UseVisualStyleBackColor = true;
this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
//
// tabPage2
//
this.tabPage2.Controls.Add(this.txtTemplate);
this.tabPage2.Controls.Add(this.label5);
this.tabPage2.Controls.Add(this.nuAdd);
this.tabPage2.Controls.Add(this.label4);
this.tabPage2.Controls.Add(this.nuStart);
this.tabPage2.Controls.Add(this.label3);
this.tabPage2.Controls.Add(this.comboBox2);
this.tabPage2.Controls.Add(this.label2);
this.tabPage2.Location = new System.Drawing.Point(4, 21);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(589, 97);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "序号设置";
this.tabPage2.UseVisualStyleBackColor = true;
//
// txtTemplate
//
this.txtTemplate.Location = new System.Drawing.Point(318, 25);
this.txtTemplate.Name = "txtTemplate";
this.txtTemplate.Size = new System.Drawing.Size(190, 21);
this.txtTemplate.TabIndex = 7;
this.txtTemplate.TextChanged += new System.EventHandler(this.txtTemplate_TextChanged);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(283, 31);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(29, 12);
this.label5.TabIndex = 6;
this.label5.Text = "模板";
//
// nuAdd
//
this.nuAdd.Location = new System.Drawing.Point(217, 60);
this.nuAdd.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nuAdd.Name = "nuAdd";
this.nuAdd.Size = new System.Drawing.Size(56, 21);
this.nuAdd.TabIndex = 5;
this.nuAdd.Value = new decimal(new int[] {
1,
0,
0,
0});
this.nuAdd.ValueChanged += new System.EventHandler(this.nuAdd_ValueChanged);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(161, 64);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(41, 12);
this.label4.TabIndex = 4;
this.label4.Text = "增量值";
//
// nuStart
//
this.nuStart.Location = new System.Drawing.Point(80, 60);
this.nuStart.Name = "nuStart";
this.nuStart.Size = new System.Drawing.Size(56, 21);
this.nuStart.TabIndex = 3;
this.nuStart.ValueChanged += new System.EventHandler(this.nuStart_ValueChanged);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(21, 64);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(53, 12);
this.label3.TabIndex = 2;
this.label3.Text = "起始数字";
//
// comboBox2
//
this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Items.AddRange(new object[] {
"pic_#",
"file_#"});
this.comboBox2.Location = new System.Drawing.Point(100, 25);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(173, 20);
this.comboBox2.TabIndex = 1;
this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(21, 28);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(77, 12);
this.label2.TabIndex = 0;
this.label2.Text = "选择预设模板";
//
// listView1
//
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2,
this.columnHeader3,
this.columnHeader4,
this.columnHeader5,
this.columnHeader6,
this.columnHeader7});
this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.listView1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.listView1.FullRowSelect = true;
this.listView1.Location = new System.Drawing.Point(0, 0);
this.listView1.MultiSelect = false;
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(597, 265);
this.listView1.TabIndex = 0;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details;
//
// columnHeader1
//
this.columnHeader1.Text = "文件名";
this.columnHeader1.Width = 100;
//
// columnHeader2
//
this.columnHeader2.Text = "预览";
this.columnHeader2.Width = 100;
//
// columnHeader3
//
this.columnHeader3.Text = "扩展名";
//
// columnHeader4
//
this.columnHeader4.Text = "日期";
this.columnHeader4.Width = 90;
//
// columnHeader5
//
this.columnHeader5.Text = "路径";
this.columnHeader5.Width = 80;
//
// columnHeader6
//
this.columnHeader6.Text = "大小";
this.columnHeader6.Width = 83;
//
// columnHeader7
//
this.columnHeader7.Text = "结果";
this.columnHeader7.Width = 80;
//
// notifyIcon1
//
this.notifyIcon1.Text = "notifyIcon1";
this.notifyIcon1.Visible = true;
//
// openFileDialog1
//
this.openFileDialog1.Multiselect = true;
//
// saveFileDialog1
//
this.saveFileDialog1.Filter = "文本文档(*.txt)|*.txt";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(597, 434);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.menuStrip1);
this.DoubleBuffered = true;
this.MainMenuStrip = this.menuStrip1;
this.MaximizeBox = false;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "批量更名器";
this.Load += new System.EventHandler(this.Form1_Load);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nuAdd)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nuStart)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem 文件ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 添加文件ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 总在最前ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 更名PToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 帮助HToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 导出文件列表ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 退出ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 更名ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 繁体转简体ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 简体转繁体ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 关于ToolStripMenuItem;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton3;
private System.Windows.Forms.RadioButton radioButton5;
private System.Windows.Forms.RadioButton radioButton4;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.ColumnHeader columnHeader4;
private System.Windows.Forms.ColumnHeader columnHeader5;
private System.Windows.Forms.ColumnHeader columnHeader6;
private System.Windows.Forms.ColumnHeader columnHeader7;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.NumericUpDown nuAdd;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.NumericUpDown nuStart;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.TextBox txtTemplate;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
private System.Windows.Forms.ToolStripStatusLabel tsslSum;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3;
private System.Windows.Forms.ToolStripProgressBar toolStripProgressBar1;
private System.Windows.Forms.ToolStripStatusLabel tsslError;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
}
来源:https://blog.csdn.net/qq_27489007/article/details/128363078
标签:C#,更改,文件,名称,扩展名
0
投稿
猜你喜欢
Android中mvp模式使用实例详解
2023-12-11 19:48:04
Java实现简单猜数字小游戏
2023-11-28 08:10:07
Java集合类的组织结构和继承、实现关系详解
2023-03-09 10:48:50
Java设计模式之桥接模式的实现
2021-10-18 20:29:04
详解SpringBoot的事务管理
2022-01-15 13:39:26
Java多态性抽象类与接口细致详解
2022-08-22 00:06:11
关于LinkedList集合对元素进行增查删操作
2022-09-23 11:48:45
Java对象不使用时赋值null的意义详解
2023-11-25 01:46:20
SpringBoot之Controller的使用详解
2023-02-16 21:18:30
Redis集群原理详细分析
2021-08-06 07:34:00
Android通过自定义View实现随机验证码
2022-10-24 07:16:19
SpringCloud实战之Feign声明式服务调用
2022-07-02 08:25:30
Java Mybatis框架多表操作与注解开发详解分析
2023-12-04 17:15:14
一篇超详细的SpringBoot整合MybatisPlus的文章
2023-02-26 11:04:35
ElasticSearch如何设置某个字段不分词浅析
2023-01-29 07:22:30
spring boot 注入 property的三种方式(推荐)
2023-01-23 05:10:27
C#运算符之与,或,异或及移位运算小结
2023-07-19 10:35:50
Spring Native项目实战(体验79毫秒启动springboot应用)
2022-03-14 22:18:42
Android编程之控件状态配置文件实例
2023-07-26 02:38:54
Spring Cloud Feign接口返回流的实现
2021-06-07 07:21:54