Skype:TextControlSupport
Orders:877-462-4772
TX Text Control - word processing components.
What is this?Syndicate this content

Minimizing TX Text Control .NET to the system tray

This source code snippet requires TX Text Control .NET
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 Download [32.95 KB, 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.

  1. private void Form1_Resize(object sender, System.EventArgs e)
  2. {
  3. if(minimized == true)
  4. return;
  5.  
  6. if(this.WindowState == FormWindowState.Minimized)
  7. {
  8. textControl1.Save(out data, TXTextControl.StringStreamType.RichTextFormat);
  9. this.Controls.Clear();
  10. this.ShowInTaskbar = false;
  11. ntfyIcon.Visible = true;
  12. minimized = true;
  13. }
  14. }

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.

  1. private void ntfyIcon_DoubleClick(object sender, System.EventArgs e)
  2. {
  3. this.WindowState = FormWindowState.Normal;
  4. ntfyIcon.Visible = false;
  5. this.ShowInTaskbar = true;
  6. textControl1.Dock = DockStyle.Fill;
  7. this.Controls.Add(textControl1);
  8. textControl1.Load(data, TXTextControl.StringStreamType.RichTextFormat);
  9. minimized = false;
  10. }

At least a trial version of TX Text Control .NET 12.0 and Visual Studio 2003 is required.

top

Top 10 Bestselling Product Award 2007Top 25 Publisher Product Award 2007Top 10 Bestselling Product Award 2007 in JapanTop 25 Bestselling Product Award 2006Top 25 Bestselling Publisher Award 2006Reader's Choice Award, dot.net magazin, 3rd place