C# 后台線程更新UI控件


/*********************************************************************************
 *                         C# 后台線程更新UI控件
 * 說明:
 *     C#多線程更新UI控件的方法,每次都要找,記錄一下,方便檢索。
 *
 *                                              2017-10-23 深圳 南山平山村 曾劍鋒
 ********************************************************************************/

一、參考文檔:
    1. How to update textbox on GUI from another thread [duplicate]
        https://stackoverflow.com/questions/1136399/how-to-update-textbox-on-gui-from-another-thread
        
二、示例
    1. 代碼:
        private void dealProgressValue(int value)
        {
            MethodInvoker action = delegate { dealProgress.Value = value; };
            ShowMessage.BeginInvoke(action);
        }
    2. 說明:
        dealProgress、ShowMessage都是UI控件。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM