| Skype: | TextControlSupport | |
| Orders: | 877-462-4772 |

| Author: | TX Text Control Support Department |
| Language: | C# .NET |
| Version: | 1.0 |
| Released: | August 16, 2005 |
| Last modified: | January 11, 2008 |
| Requirements: | TX Text Control .NET with C# .NET |
| Download code: | tx_sample_dotnet_minimize.zip |
Some applications require a form to be minimized to the system tray and must not be visible in the task bar of Windows. As TX Text Control .NET always must be visible to work properly, we have to use a little trick to accomplish this task.
We store the content of TX Text Control in a global memory variable before the form is resized. After that, TX Text Control will be removed from the form.
private void Form1_Resize(object sender, System.EventArgs e) { if(minimized == true) return; if(this.WindowState == FormWindowState.Minimized) { textControl1.Save(out data, TXTextControl.StringStreamType.RichTextFormat); this.Controls.Clear(); this.ShowInTaskbar = false; ntfyIcon.Visible = true; minimized = true; } }
When the form is opened again, TX Text Control .NET simply must be added to the controls collection of the form and the document can be reloaded from the variable using the Load method.
private void ntfyIcon_DoubleClick(object sender, System.EventArgs e) { this.WindowState = FormWindowState.Normal; ntfyIcon.Visible = false; this.ShowInTaskbar = true; textControl1.Dock = DockStyle.Fill; this.Controls.Add(textControl1); textControl1.Load(data, TXTextControl.StringStreamType.RichTextFormat); minimized = false; }
At least a trial version of TX Text Control .NET 12.0 and Visual Studio 2003 is required.