新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
C#進(jìn)度條效果實(shí)現(xiàn)實(shí)例
C# 進(jìn)度條效果實(shí)現(xiàn)實(shí)例是如何的呢?下面讓我們看看:

創(chuàng)新互聯(lián)公司于2013年創(chuàng)立,先為循化等服務(wù)建站,循化等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為循化企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。
C# 進(jìn)度條效果實(shí)現(xiàn)實(shí)例源碼:
- public class LargeFileCopier
- {
- private const int FO_COPY = 0x02;
- private const int FOF_ALLOWUNDO = 0x40;
- //C# 進(jìn)度條效果實(shí)現(xiàn)實(shí)例
- [StructLayout(LayoutKind.Sequential,
- CharSet = CharSet.Auto,Pack=0)]
- public struct SHFILEOPSTRUCT
- {
- public IntPtr hwnd;
- [MarshalAs(UnmanagedType.U4)]
- public int wFunc;
- public string pFrom;
- public string pTo;
- public short fFlags;
- [MarshalAs(UnmanagedType.Bool)]
- public bool fAnyOperationsAborted;
- public IntPtr hNameMappings;
- public string lpszProgressTitle;
- }
- //C# 進(jìn)度條效果實(shí)現(xiàn)實(shí)例
- [DllImport("shell32.dll",
- CharSet = CharSet.Auto)]
- static extern int SHFileOperation(
- ref SHFILEOPSTRUCT FileOp);
- public static bool DoCopy(
- string strSource, string strTarget)
- {
- SHFILEOPSTRUCT fileop = new SHFILEOPSTRUCT();
- fileop.wFunc = FO_COPY;
- fileop.pFrom = strSource;
- fileop.pTo = strTarget;
- fileop.fFlags = FOF_ALLOWUNDO;
- SHFileOperation(ref fileop);
- return !fileop.fAnyOperationsAborted;
- }
- } //C# 進(jìn)度條效果實(shí)現(xiàn)實(shí)例
C# 進(jìn)度條效果實(shí)現(xiàn)實(shí)例調(diào)用方法:
- LargeFileCopier.DoCopy(@"D:\2009-01.exe", "f:\2009-01.exe");
C# 進(jìn)度條效果實(shí)現(xiàn)實(shí)例的基本內(nèi)容就向你介紹到這里,希望對你了解和學(xué)習(xí)C# 進(jìn)度條效果實(shí)現(xiàn)實(shí)例有所幫助。
【編輯推薦】
- C#多線程控制進(jìn)度條之長任務(wù)操作
- C#多線程控制進(jìn)度條之長異步操作
- C#多線程控制進(jìn)度條之異步調(diào)用
- C#多線程控制進(jìn)度條之多線程安全
- C# listview進(jìn)度條顯示淺析
當(dāng)前名稱:C#進(jìn)度條效果實(shí)現(xiàn)實(shí)例
鏈接URL:http://fisionsoft.com.cn/article/cojjpgh.html


咨詢
建站咨詢
