0

I just found DockPanel Suite and am learning to use it.

I downloaded v2.9 and am using it with C# in VS2013. I created a simple Windows Forms MDI app. It has one type of child form which is a simple form with only a rich text box control in it. I loaded a few of these as documents. I added an icon to the document's tab to indicate whether the rich text box text has been saved or not.

I change the tab icon anytime the user types in the rich text box through the use of the text_Changed event:

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

The problem I have is that the icon does not update when running at full speed. It updates fine when I am single stepping through the above event. It also updates fine when I load a file within the form's Load event;

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;
            }
        }

    }

I tried the following after I change the icon (in the Text Changed event):

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

Note: I tried these one at a time. The above is just a list of methods.

Can anyone help me with this? Thank you! SgarciaV

Reto
  • 3,107
  • 1
  • 21
  • 33

1 Answers1

0

I found the solution. See here:

Dockpanel Suite: Image not updating