diff --git a/frm_Main.Designer.cs b/frm_Main.Designer.cs index bb3a8de..b17fe0a 100644 --- a/frm_Main.Designer.cs +++ b/frm_Main.Designer.cs @@ -392,6 +392,7 @@ private void InitializeComponent() this.Controls.Add(this.group_screenshot); this.Controls.Add(this.group_upload); this.Controls.Add(this.main_menu); + this.DoubleBuffered = true; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.main_menu; this.MaximizeBox = false; @@ -400,6 +401,7 @@ private void InitializeComponent() this.Name = "frm_Main"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Hyperdesktop2"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Frm_MainFormClosing); this.Load += new System.EventHandler(this.Frm_MainLoad); this.main_menu.ResumeLayout(false); this.main_menu.PerformLayout(); diff --git a/frm_Main.cs b/frm_Main.cs index f591241..2607570 100644 --- a/frm_Main.cs +++ b/frm_Main.cs @@ -80,15 +80,15 @@ void hook_KeyPressed(object sender, KeyPressedEventArgs e) { switch(e.Key) { case Keys.D3: - btn_capture.PerformClick(); + screen_capture("screen"); break; case Keys.D4: - btn_capture_selected_area.PerformClick(); + screen_capture("region"); break; case Keys.D5: - Btn_windowClick(); + screen_capture("window"); break; } } @@ -100,6 +100,12 @@ void Frm_MainLoad(object sender, EventArgs e) Snipper.initialize(); } + + void Frm_MainFormClosing(object sender, FormClosingEventArgs e) + { + inverse_tray_options(sender, e); + e.Cancel = true; + } #endregion #region Upload Images @@ -145,8 +151,29 @@ void save_screenshot(Bitmap bmp, String name = null) } } - void work_image(Bitmap bmp) { - + void screen_capture(String type) + { + Bitmap bmp = null; + + switch(type) { + case "screen": + bmp = Screen_Capture.screen(Settings.show_cursor); + break; + + case "window": + bmp = Screen_Capture.window(Settings.show_cursor); + break; + + default: + bmp = Screen_Capture.region(Snipper.get_region()); + break; + } + + work_image(bmp); + } + + void work_image(Bitmap bmp) + { Global_Func.play_sound("capture.wav"); bmp = edit_screenshot(bmp); @@ -160,23 +187,9 @@ void work_image(Bitmap bmp) { save_screenshot(bmp); } - void Btn_windowClick() - { - Bitmap bmp = Screen_Capture.window(); - work_image(bmp); - } - - void Btn_captureClick(object sender, EventArgs e) - { - Bitmap bmp = Screen_Capture.screen(Settings.show_cursor); - work_image(bmp); - } - - void Btn_capture_regionClick(object sender, EventArgs e) - { - Bitmap bmp = Screen_Capture.region(Snipper.get_region()); - work_image(bmp); - } + void Btn_captureClick(object sender, EventArgs e) { screen_capture("screen"); } + void Btn_windowClick() { screen_capture("window"); } + void Btn_capture_regionClick(object sender, EventArgs e) { screen_capture("region"); } #endregion #region Main Menu @@ -198,7 +211,8 @@ void AboutToolStripMenuItemClick(object sender, EventArgs e) void inverse_tray_options(object sender, EventArgs e) { minimizeToTrayToolStripMenuItem.Text = (minimizeToTrayToolStripMenuItem.Text == "Open Window") ? "Minimize to Tray" : "Open Window"; - this.Visible = !this.Visible; + ShowInTaskbar = !ShowInTaskbar; + Opacity = Opacity < 1 ? 100 : 0; } #endregion