欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

基于C#實(shí)現(xiàn)PDF文件合并工具

 更新時間:2025年01月20日 10:00:54   作者:StevenChen85  
這篇文章主要為大家詳細(xì)介紹了如何基于C#實(shí)現(xiàn)一個簡單的PDF文件合并工具,文中的示例代碼簡潔易懂,有需要的小伙伴可以跟隨小編一起學(xué)習(xí)一下

界面

主要用于發(fā)票PDF文件的合并。經(jīng)常出差要報銷的很有用。

代碼

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 iTextSharp.text;
using iTextSharp.text.pdf;
//using PdfSharp.Pdf;
//using PdfSharp.Pdf.IO;
 
namespace PdfMergeApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            btnOpenDir.Enabled = false;
        }
 
        private List<string> pdfList;
        private string outputPdfDir;
 
        private void bntSelectDir_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
            DialogResult dialogResult = folderBrowserDialog.ShowDialog();
 
            if (dialogResult == DialogResult.OK)
            {
                string selectedFolderPath = folderBrowserDialog.SelectedPath;
                //Console.WriteLine("選擇的目錄是: " + selectedFolderPath);
                txtFileDir.Text = selectedFolderPath;
 
                pdfList = Directory.GetFiles(selectedFolderPath, "*.pdf").ToList();
 
                if (pdfList != null && pdfList.Count > 0)
                {
                    pdfList = pdfList.OrderBy(t => t).ToList();
                }
 
                addPdfList();
            }
        }
 
        private void addPdfList()
        {
            this.listViewWorkLogs.Items.Clear();
            int no = 1;
            foreach (var item in pdfList)
            {
                ListViewItem lvItem = new ListViewItem();
 
                lvItem.ForeColor = Color.Blue;
                lvItem.Text = no.ToString();
                lvItem.StateImageIndex = 0;
                lvItem.Tag = no - 1;
                lvItem.SubItems.Add(item);
 
                this.listViewWorkLogs.Items.Add(lvItem);
                no++;
            }
        }
 
        /// <summary>
        /// 合并多個PDF文件為一個PDF文件
        /// </summary>
        /// <param name="inputFolderPath"></param>
        /// <param name="outputFolderPath"></param>
        /// <param name="outputPdfName"></param>
        public void MergePDFs(string outputFilePath, params string[] inputFilePaths)
        {
            // 獲取輸入文件夾中所有的PDF文件  
            //string[] inputFiles = Directory.GetFiles(inputFolderPath, "*.pdf");
 
            // 創(chuàng)建輸出PDF文件路徑  
            //string outputPdfPath = Path.Combine(outputFolderPath, outputPdfName);
 
            // 檢查新輸出文件是否已存在  
            if (File.Exists(outputFilePath))
            {
                // 如果已存在,則刪除舊文件并創(chuàng)建新文件  
                File.Delete(outputFilePath);
            }
 
            // 創(chuàng)建輸出PDF文件  
            using (FileStream stream = new FileStream(outputFilePath, FileMode.Create))
            {
                Document pdfDoc = new Document();
                PdfCopy pdf = new PdfCopy(pdfDoc, stream);
                pdfDoc.Open();
 
                foreach (string file in inputFilePaths)
                {
                    // 讀取每個PDF文件并將其頁面添加到輸出PDF中  
                    PdfReader reader = new PdfReader(file);
                    int n = reader.NumberOfPages;
                    for (int i = 1; i <= n; i++)
                    {
                        pdf.AddPage(pdf.GetImportedPage(reader, i));
                    }
                    reader.Close();
                }
 
                if (pdfDoc != null) pdfDoc.Close();
                stream.Close();
            }
        }
 
        /// <summary>
        /// 合并多個PDF文件為一個PDF文件
        /// </summary>
        /// <param name="inputFolderPath"></param>
        /// <param name="outputFolderPath"></param>
        /// <param name="outputPdfName"></param>
        public void MergePDFs(string inputFolderPath, string outputFolderPath, string outputPdfName)
        {
            // 獲取輸入文件夾中所有的PDF文件  
            string[] inputFiles = Directory.GetFiles(inputFolderPath, "*.pdf");
 
            // 創(chuàng)建輸出PDF文件路徑  
            string outputPdfPath = Path.Combine(outputFolderPath, outputPdfName);
 
            outputPdfPath.CreateDirectoryByPath();
 
            // 創(chuàng)建輸出PDF文件  
            using (FileStream stream = new FileStream(outputPdfPath, FileMode.Create))
            {
                Document pdfDoc = new Document();
                PdfCopy pdf = new PdfCopy(pdfDoc, stream);
                pdfDoc.Open();
 
                foreach (string file in inputFiles)
                {
                    // 讀取每個PDF文件并將其頁面添加到輸出PDF中  
                    PdfReader reader = new PdfReader(file);
                    int n = reader.NumberOfPages;
                    for (int i = 1; i <= n; i++)
                    {
                        pdf.AddPage(pdf.GetImportedPage(reader, i));
                    }
                    reader.Close();
                }
 
                if (pdfDoc != null) pdfDoc.Close();
                stream.Close();
            }
 
            string newOutputPdfPath = Path.Combine(outputFolderPath, "AllPDF_Merged.pdf");
            //string newOutputPdfPath = Path.Combine(outputFolderPath, outputPdfName);
 
            // 檢查新輸出文件是否已存在  
            if (File.Exists(newOutputPdfPath))
            {
                // 如果已存在,則刪除舊文件并創(chuàng)建新文件  
                File.Delete(newOutputPdfPath);
            }
 
            // 重命名輸出PDF文件  
            File.Move(outputPdfPath, newOutputPdfPath);
        }
 
        /// <summary>
        /// 合并多個PDF文件為一個PDF文件
        /// </summary>
        /// <param name="inputFolderPath"></param>
        /// <param name="outputFolderPath"></param>
        /// <param name="outputPdfName"></param>
        public bool MergePDFs(string outputFolderPath, string outputPdfName)
        {
            var isOk = false;
            try
            {
                // 獲取輸入文件夾中所有的PDF文件  
                //string[] inputFiles = Directory.GetFiles(inputFolderPath, "*.pdf");
 
                // 創(chuàng)建輸出PDF文件路徑  
                string outputPdfPath = Path.Combine(outputFolderPath, outputPdfName);
 
                outputPdfPath.CreateDirectoryByPath();
 
                // 創(chuàng)建輸出PDF文件  
                using (FileStream stream = new FileStream(outputPdfPath, FileMode.Create))
                {
                    Document pdfDoc = new Document();
                    PdfCopy pdf = new PdfCopy(pdfDoc, stream);
                    pdfDoc.Open();
 
                    foreach (string file in pdfList)
                    {
                        // 讀取每個PDF文件并將其頁面添加到輸出PDF中  
                        PdfReader reader = new PdfReader(file);
                        int n = reader.NumberOfPages;
                        for (int i = 1; i <= n; i++)
                        {
                            pdf.AddPage(pdf.GetImportedPage(reader, i));
                        }
                        reader.Close();
                    }
 
                    if (pdfDoc != null) pdfDoc.Close();
                    stream.Close();
                }
 
                string newOutputPdfPath = Path.Combine(outputFolderPath, "AllPDF_Merged.pdf");
                //string newOutputPdfPath = Path.Combine(outputFolderPath, outputPdfName);
 
                // 檢查新輸出文件是否已存在  
                if (File.Exists(newOutputPdfPath))
                {
                    // 如果已存在,則刪除舊文件并創(chuàng)建新文件  
                    File.Delete(newOutputPdfPath);
                }
 
                // 重命名輸出PDF文件  
                File.Move(outputPdfPath, newOutputPdfPath);
                isOk = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("合并異常:" + ex.Message);
            }
            return isOk;
        }
 
        private void btnMergePDF_Click(object sender, EventArgs e)
        {
            if (pdfList != null && pdfList.Count > 0)
            {
                var outputFilePath = txtFileDir.Text + "\\MergePDF_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf";
                //MergePDFs(outputFilePath, pdfList.ToArray());
 
                var outputPdfName = "MergePDF_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf";
                var outputPdfNameAll = txtFileDir.Text + "\\MergePDF\\" + outputPdfName;
                outputPdfDir = txtFileDir.Text + "\\MergePDF";
                //MergePDFs(txtFileDir.Text, txtFileDir.Text+ "\\MergePDF", outputPdfName);
                var isOk = MergePDFs(outputPdfDir, outputPdfName);
                if (isOk)
                {
                    lblResult.Text = "合并完成。輸出文件目錄:" + outputPdfNameAll;
                    btnOpenDir.Enabled = true;
                    MessageBox.Show("合并完成");
                }                
            }
            else
            {
                MessageBox.Show("你沒有要合并的PDF文件");
            }
        }
 
        private void btnOpenDir_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(outputPdfDir))
            {
                OpenDirectory(outputPdfDir);
            }
            else
            {
                MessageBox.Show("合并文件沒有生成");
            }
        }
 
        static void OpenDirectory(string path)
        {
            ProcessStartInfo startInfo = new ProcessStartInfo
            {
                Arguments = path,
                FileName = "explorer.exe"
            };
 
            Process.Start(startInfo);
        }
 
        private void listViewWorkLogs_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            var listViewItem = sender as ListViewItem;
            var index = listViewItem.Tag;
            var a = 0;
        }
 
        private int selectIndex;
        private int newIndex;
        //private string selectFileName;
 
        private void listViewWorkLogs_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewWorkLogs.SelectedItems.Count > 0)
            {
                var listViewItem = listViewWorkLogs.SelectedItems[0];
                selectIndex = (int)listViewItem.Tag;
                newIndex = selectIndex;
            }
        }
 
        
        private void btnMoveUp_Click(object sender, EventArgs e)
        {
            if (pdfList != null && pdfList.Count > 0)
            {
                newIndex--;
                if (newIndex >= 0 && newIndex < pdfList.Count)
                {
                    var selectFileName = pdfList[selectIndex];
                    pdfList[selectIndex] = pdfList[newIndex];
                    pdfList[newIndex] = selectFileName;
                    selectIndex = newIndex;
 
                    addPdfList();
                }
                else
                {
                    newIndex = 0;
                }
            }
        }
 
        private void btnMoveDown_Click(object sender, EventArgs e)
        {
            if (pdfList != null && pdfList.Count > 0)
            {
                newIndex++;
                if (newIndex < pdfList.Count)
                {
                    var selectFileName = pdfList[selectIndex];
                    pdfList[selectIndex] = pdfList[newIndex];
                    pdfList[newIndex] = selectFileName;
                    selectIndex = newIndex;
 
                    addPdfList();
                }
                else
                {
                    newIndex = pdfList.Count - 1;
                }
            }
        }
    }
}

UI代碼

 
namespace PdfMergeApp
{
    partial class Form1
    {
        /// <summary>
        /// 必需的設(shè)計器變量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;
 
        /// <summary>
        /// 清理所有正在使用的資源。
        /// </summary>
        /// <param name="disposing">如果應(yīng)釋放托管資源,為 true;否則為 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows 窗體設(shè)計器生成的代碼
 
        /// <summary>
        /// 設(shè)計器支持所需的方法 - 不要修改
        /// 使用代碼編輯器修改此方法的內(nèi)容。
        /// </summary>
        private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.txtFileDir = new System.Windows.Forms.TextBox();
            this.button1 = new System.Windows.Forms.Button();
            this.bntSelectDir = new System.Windows.Forms.Button();
            this.btnMergePDF = new System.Windows.Forms.Button();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.listViewWorkLogs = new System.Windows.Forms.ListView();
            this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.lblResult = new System.Windows.Forms.Label();
            this.btnOpenDir = new System.Windows.Forms.Button();
            this.btnMoveUp = new System.Windows.Forms.Button();
            this.btnMoveDown = new System.Windows.Forms.Button();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(12, 9);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(75, 15);
            this.label1.TabIndex = 0;
            this.label1.Text = "選擇目錄:";
            // 
            // txtFileDir
            // 
            this.txtFileDir.Location = new System.Drawing.Point(90, 6);
            this.txtFileDir.Name = "txtFileDir";
            this.txtFileDir.ReadOnly = true;
            this.txtFileDir.Size = new System.Drawing.Size(491, 25);
            this.txtFileDir.TabIndex = 1;
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(120, 141);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(8, 8);
            this.button1.TabIndex = 2;
            this.button1.Text = "button1";
            this.button1.UseVisualStyleBackColor = true;
            // 
            // bntSelectDir
            // 
            this.bntSelectDir.Location = new System.Drawing.Point(600, 6);
            this.bntSelectDir.Name = "bntSelectDir";
            this.bntSelectDir.Size = new System.Drawing.Size(118, 35);
            this.bntSelectDir.TabIndex = 3;
            this.bntSelectDir.Text = "選擇目錄";
            this.bntSelectDir.UseVisualStyleBackColor = true;
            this.bntSelectDir.Click += new System.EventHandler(this.bntSelectDir_Click);
            // 
            // btnMergePDF
            // 
            this.btnMergePDF.Location = new System.Drawing.Point(724, 7);
            this.btnMergePDF.Name = "btnMergePDF";
            this.btnMergePDF.Size = new System.Drawing.Size(94, 32);
            this.btnMergePDF.TabIndex = 3;
            this.btnMergePDF.Text = "合并PDF";
            this.btnMergePDF.UseVisualStyleBackColor = true;
            this.btnMergePDF.Click += new System.EventHandler(this.btnMergePDF_Click);
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.listViewWorkLogs);
            this.groupBox1.Location = new System.Drawing.Point(15, 49);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(764, 589);
            this.groupBox1.TabIndex = 4;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "文件列表";
            // 
            // listViewWorkLogs
            // 
            this.listViewWorkLogs.BackColor = System.Drawing.SystemColors.InactiveCaption;
            this.listViewWorkLogs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeader1,
            this.columnHeader2});
            this.listViewWorkLogs.Dock = System.Windows.Forms.DockStyle.Fill;
            this.listViewWorkLogs.FullRowSelect = true;
            this.listViewWorkLogs.GridLines = true;
            this.listViewWorkLogs.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
            this.listViewWorkLogs.HideSelection = false;
            this.listViewWorkLogs.ImeMode = System.Windows.Forms.ImeMode.NoControl;
            this.listViewWorkLogs.LabelWrap = false;
            this.listViewWorkLogs.Location = new System.Drawing.Point(3, 21);
            this.listViewWorkLogs.MultiSelect = false;
            this.listViewWorkLogs.Name = "listViewWorkLogs";
            this.listViewWorkLogs.Size = new System.Drawing.Size(758, 565);
            this.listViewWorkLogs.TabIndex = 2;
            this.listViewWorkLogs.UseCompatibleStateImageBehavior = false;
            this.listViewWorkLogs.View = System.Windows.Forms.View.Details;
            this.listViewWorkLogs.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.listViewWorkLogs_ItemCheck);
            this.listViewWorkLogs.SelectedIndexChanged += new System.EventHandler(this.listViewWorkLogs_SelectedIndexChanged);
            // 
            // columnHeader1
            // 
            this.columnHeader1.Text = "序號";
            this.columnHeader1.Width = 50;
            // 
            // columnHeader2
            // 
            this.columnHeader2.Text = "文件名";
            this.columnHeader2.Width = 580;
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.lblResult);
            this.groupBox2.Controls.Add(this.btnOpenDir);
            this.groupBox2.Location = new System.Drawing.Point(15, 644);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(809, 68);
            this.groupBox2.TabIndex = 5;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "合并結(jié)果";
            // 
            // lblResult
            // 
            this.lblResult.AutoSize = true;
            this.lblResult.Location = new System.Drawing.Point(17, 34);
            this.lblResult.Name = "lblResult";
            this.lblResult.Size = new System.Drawing.Size(55, 15);
            this.lblResult.TabIndex = 0;
            this.lblResult.Text = "label2";
            // 
            // btnOpenDir
            // 
            this.btnOpenDir.Location = new System.Drawing.Point(709, 24);
            this.btnOpenDir.Name = "btnOpenDir";
            this.btnOpenDir.Size = new System.Drawing.Size(94, 32);
            this.btnOpenDir.TabIndex = 3;
            this.btnOpenDir.Text = "查看文件";
            this.btnOpenDir.UseVisualStyleBackColor = true;
            this.btnOpenDir.Click += new System.EventHandler(this.btnOpenDir_Click);
            // 
            // btnMoveUp
            // 
            this.btnMoveUp.Location = new System.Drawing.Point(785, 141);
            this.btnMoveUp.Name = "btnMoveUp";
            this.btnMoveUp.Size = new System.Drawing.Size(33, 42);
            this.btnMoveUp.TabIndex = 6;
            this.btnMoveUp.Text = "上移";
            this.btnMoveUp.UseVisualStyleBackColor = true;
            this.btnMoveUp.Click += new System.EventHandler(this.btnMoveUp_Click);
            // 
            // btnMoveDown
            // 
            this.btnMoveDown.Location = new System.Drawing.Point(785, 224);
            this.btnMoveDown.Name = "btnMoveDown";
            this.btnMoveDown.Size = new System.Drawing.Size(33, 42);
            this.btnMoveDown.TabIndex = 6;
            this.btnMoveDown.Text = "下移";
            this.btnMoveDown.UseVisualStyleBackColor = true;
            this.btnMoveDown.Click += new System.EventHandler(this.btnMoveDown_Click);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(836, 724);
            this.Controls.Add(this.btnMoveDown);
            this.Controls.Add(this.btnMoveUp);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.btnMergePDF);
            this.Controls.Add(this.bntSelectDir);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.txtFileDir);
            this.Controls.Add(this.label1);
            this.Name = "Form1";
            this.Text = "PDF文件合并";
            this.groupBox1.ResumeLayout(false);
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();
 
        }
 
        #endregion
 
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox txtFileDir;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button bntSelectDir;
        private System.Windows.Forms.Button btnMergePDF;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.ListView listViewWorkLogs;
        private System.Windows.Forms.ColumnHeader columnHeader1;
        private System.Windows.Forms.ColumnHeader columnHeader2;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.Label lblResult;
        private System.Windows.Forms.Button btnOpenDir;
        private System.Windows.Forms.Button btnMoveUp;
        private System.Windows.Forms.Button btnMoveDown;
    }
}

到此這篇關(guān)于基于C#實(shí)現(xiàn)PDF文件合并工具的文章就介紹到這了,更多相關(guān)C# PDF文件合并內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 基于C#實(shí)現(xiàn)網(wǎng)頁爬蟲

    基于C#實(shí)現(xiàn)網(wǎng)頁爬蟲

    這篇文章主要為大家詳細(xì)介紹了基于C#實(shí)現(xiàn)網(wǎng)頁爬蟲的相關(guān)資料,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2016-03-03
  • C#在線程中訪問ui元素的幾種實(shí)現(xiàn)方法

    C#在線程中訪問ui元素的幾種實(shí)現(xiàn)方法

    在C#中,特別是在Windows窗體(WinForms)或WPF應(yīng)用程序中,直接從非UI線程(如后臺工作線程)訪問UI元素通常是不被允許的,如果你需要在非UI線程中更新UI元素,本文給大家介紹了C#在線程中訪問ui元素的幾種實(shí)現(xiàn)方法,需要的朋友可以參考下
    2024-07-07
  • 簡單實(shí)現(xiàn)C#窗體程序判斷是否閏年

    簡單實(shí)現(xiàn)C#窗體程序判斷是否閏年

    這篇文章主要介紹了簡單實(shí)現(xiàn)C#窗體程序判斷是否閏年的相關(guān)代碼,禁止窗體調(diào)整大小,關(guān)閉窗體前的判斷,感興趣的小伙伴們可以參考一下
    2016-07-07
  • WPF實(shí)現(xiàn)Interaction框架的Behavior擴(kuò)展

    WPF實(shí)現(xiàn)Interaction框架的Behavior擴(kuò)展

    這篇文章介紹了WPF實(shí)現(xiàn)Interaction框架Behavior擴(kuò)展的方法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-06-06
  • c#動態(tài)編譯執(zhí)行對象方法示例 運(yùn)用映射機(jī)制創(chuàng)建對象

    c#動態(tài)編譯執(zhí)行對象方法示例 運(yùn)用映射機(jī)制創(chuàng)建對象

    本示例核心技術(shù)是運(yùn)用.NET動態(tài)編譯技術(shù)+.NET映射技術(shù),把一個代碼塊中的代碼,動態(tài)編譯成程序集后,在運(yùn)用映射機(jī)制,創(chuàng)建對象示例,調(diào)用對象方法
    2014-01-01
  • C#實(shí)現(xiàn)的Win32控制臺線程計時器功能示例

    C#實(shí)現(xiàn)的Win32控制臺線程計時器功能示例

    這篇文章主要介紹了C#實(shí)現(xiàn)的Win32控制臺線程計時器功能,結(jié)合實(shí)例形式分析了C#基于控制臺的時間操作相關(guān)技巧,需要的朋友可以參考下
    2016-08-08
  • C語言使用getch()讀取方向鍵

    C語言使用getch()讀取方向鍵

    getch()是編程中所用的函數(shù),這個函數(shù)是一個不回顯函數(shù),當(dāng)用戶按下某個字符時,函數(shù)自動讀取,無需按回車,有的C語言命令行程序會用到此函數(shù)做游戲,但是這個函數(shù)并非標(biāo)準(zhǔn)函數(shù),要注意移植性
    2021-07-07
  • c# WPF中自定義加載時實(shí)現(xiàn)帶動畫效果的Form和FormItem

    c# WPF中自定義加載時實(shí)現(xiàn)帶動畫效果的Form和FormItem

    這篇文章主要介紹了c# WPF中自定義加載時實(shí)現(xiàn)帶動畫效果的Form和FormItem,幫助大家更好的理解和學(xué)習(xí)使用c#,感興趣的朋友可以了解下
    2021-03-03
  • 一文帶你了解C#中抽象方法與虛方法的區(qū)別

    一文帶你了解C#中抽象方法與虛方法的區(qū)別

    這篇文章主要通過簡單的示例為大家詳細(xì)介紹一下C#中抽象方法與虛方法的區(qū)別,文中的示例代碼簡潔易懂,感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2023-03-03
  • C#獲取指定文件著作權(quán)信息的方法

    C#獲取指定文件著作權(quán)信息的方法

    這篇文章主要介紹了C#獲取指定文件著作權(quán)信息的方法,涉及C#中FileVersionInfo類的使用技巧,需要的朋友可以參考下
    2015-04-04

最新評論