首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> C語言 >> 關於C語言

C# 檔案分割合併工具(四):分割程式介面設計、元件屬性與檔案選擇邏輯

     編輯:關於C語言

介面元件屬性設定表

元件名稱屬性值
Buttonbutton1FlatStyleFlat
Text執行
Buttonbutton2FlatStylePopup
Text...
FormForm1Text檔案分割
MaximizeBoxFalse
MinimizeBoxTrue
FormBorderStyleFixedSingle
ComboBoxcomboBox1Items720, 1440, 2880 (KB)
Labellabel1Text請選擇大小:
Labellabel2Text請選擇檔案:
Labellabel3Text輸入存放目錄:
Labellabel4Text(單位:KB)
TextBoxtextBox1Text(空)
TextBoxtextBox2Text(空)

設計完成畫面

分割程式設計介面

命名空間引入

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms.Design;

選擇檔案按鈕邏輯

private void button2_Click(object sender, EventArgs e)
{
    openFileDialog1.Title = "請選擇要分割的檔案名稱";
    DialogResult result = openFileDialog1.ShowDialog();
    
    if (result == DialogResult.OK && openFileDialog1.FileName != string.Empty)
    {
        textBox1.Text = openFileDialog1.FileName;
        button1.Enabled = true;  // 啟用分割按鈕
    }
}

下篇預告

分割執行核心邏輯實作與執行驗證畫面。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved