簡體   English   中英

更新的圖標圖像不會顯示在“文檔”標簽中

[英]Updated icon image won't show in document tab

我剛剛找到DockPanel Suite,正在學習使用它。

我下載了v2.9,並將其與VS2013中的C#結合使用。 我創建了一個簡單的Windows Forms MDI應用程序。 它具有一種類型的子窗體,該子窗體是一種簡單的窗體,其中僅包含富文本框控件。 我將其中一些作為文檔加載。 我在文檔的選項卡上添加了一個圖標,以指示富文本框文本是否已保存。

每當用戶通過使用text_Changed事件在富文本框中鍵入內容時,我都會更改選項卡圖標:

private void txtCode_TextChanged(object sender, EventArgs e)
    {
        //The text has changed, set the warning icon.
        this.Icon = MyApp.Properties.Resources.Warning;
    }

我的問題是,全速運行時圖標不會更新。 當我單步執行上述事件時,它會更新正常。 當我在表單的Load事件中加載文件時,它也可以更新。

private void frmCode_Load(object sender, EventArgs e)
    {
        //Get the full file path.
        string sFile = Path.Combine(cCoCoIDE.CodeBaseRootFolder, Path.GetFileNameWithoutExtension(cCoCoIDE.CodeBaseFile), this.Text);

        //Load the source file into the code window.
        //A few validations.
        //Make sure the file exists.
        if (File.Exists(sFile))
        {
            //File is there. Is it empty? Load only if not empty.
            if (new FileInfo(sFile).Length > 0)
            {
                txtCode.LoadFile(sFile);
                //I had to add the following because the text changed
                //event fires when I load the file and I need to start
                //off with the green checkmark icon.
                this.Icon = CoCoIDE.Properties.Resources.GreenChk;
            }
        }

    }

更改圖標后(在“已更改文本”事件中),我嘗試了以下操作:

            this.ShowIcon = true;
            this.Refresh();
            this.Update();

注意:我一次嘗試了這些。 以上只是方法列表。

誰能幫我這個? 謝謝! SgarciaV

我找到了解決方案。 看這里:

Dockpanel Suite:圖片未更新

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM