- handle form minimize event and hide window to tray;

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@90 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Pavel Petroshenko 2008-05-23 10:35:45 +00:00
parent 4cbc37f270
commit a61f1a7583
2 changed files with 17 additions and 11 deletions

View File

@ -30,7 +30,7 @@ namespace webImTray {
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.refreshToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.optionsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.hideWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.hideWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.notifyMenu.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
@ -90,7 +90,7 @@ namespace webImTray {
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.refreshToolStripMenuItem,
this.optionsMenuItem,
this.hideWindowMenuItem});
this.hideWindowToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(864, 24);
@ -111,12 +111,12 @@ namespace webImTray {
this.optionsMenuItem.Text = "Options";
this.optionsMenuItem.Click += new System.EventHandler(this.optionsToolStripMenuItem1_Click);
//
// hideWindowMenuItem
// hideWindowToolStripMenuItem
//
this.hideWindowMenuItem.Name = "hideWindowMenuItem";
this.hideWindowMenuItem.Size = new System.Drawing.Size(79, 20);
this.hideWindowMenuItem.Text = "Hide window";
this.hideWindowMenuItem.Click += new System.EventHandler(this.hideWindowToolStripMenuItem_Click);
this.hideWindowToolStripMenuItem.Name = "hideWindowToolStripMenuItem";
this.hideWindowToolStripMenuItem.Size = new System.Drawing.Size(79, 20);
this.hideWindowToolStripMenuItem.Text = "Hide window";
this.hideWindowToolStripMenuItem.Click += new System.EventHandler(this.hideWindowToolStripMenuItem_Click);
//
// MainWindow
//
@ -126,12 +126,12 @@ namespace webImTray {
this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.MinimizeBox = false;
this.Name = "MainWindow";
this.ShowInTaskbar = false;
this.Shown += new System.EventHandler(this.MainWindow_Shown);
this.GotFocus += new System.EventHandler(this.gotFocus);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Client_FormClosing);
this.Resize += new System.EventHandler(this.FormResize);
this.notifyMenu.ResumeLayout(false);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
@ -150,7 +150,7 @@ namespace webImTray {
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem optionsMenuItem;
private System.Windows.Forms.ToolStripMenuItem hideWindowMenuItem;
private System.Windows.Forms.ToolStripMenuItem hideWindowToolStripMenuItem;
}
}

View File

@ -49,8 +49,8 @@ namespace webImTray {
private void updateLocalizedControls() {
// Update localized controls
hideWindowMenuItem.Text = Options.resourceManager.GetString("hideWindow");
optionsMenuItem.Text = Options.resourceManager.GetString("optionsMenuItem");
hideWindowToolStripMenuItem.Text = Options.resourceManager.GetString("hideWindow");
optionsToolStripMenuItem.Text = Options.resourceManager.GetString("optionsMenuItem");
refreshToolStripMenuItem.Text = Options.resourceManager.GetString("refreshMenuItem");
optionsToolStripMenuItem.Text = Options.resourceManager.GetString("trayOptions");
exitToolStripMenuItem.Text = Options.resourceManager.GetString("trayExit");
@ -218,5 +218,11 @@ namespace webImTray {
private void hideWindowToolStripMenuItem_Click(object sender, EventArgs e) {
hideWindow();
}
private void FormResize(object sender, System.EventArgs e) {
if (FormWindowState.Minimized == WindowState) {
hideWindow();
}
}
}
}