private void SaveCurrentLocation() { DialogResult result1 = MessageBox.Show( "Update Favorite Location ", "Important Question", MessageBoxButtons.YesNo); if (result1 == DialogResult.Yes) { string hh = this.Left.ToString() + "," + this.Top.ToString() + "," + this.Width.ToString() + "," + this.Height.ToString(); var attacheWin = Init.GetAttacheWindowSize(); string hh1 = attacheWin.Left.ToString() + "," + attacheWin.Top.ToString() + "," + attacheWin.Width.ToString() + "," + attacheWin.Height.ToString(); hh += "|" + hh1; File.WriteAllText("FavoriteLocation.txt", hh); } }
public void TransparentFrm_KeyDown(object sender, KeyEventArgs e) { escapedKepPressed = false; if (e.Control && !controlKeyPressed) { ToggleTransparent(); controlKeyPressed = true; } if (e.Alt && !altKeyPressed) { altKeyPressed = true; } if (e.KeyCode == Keys.Escape) { if (WindowTransparentAlpha != 100) { WindowTransparentAlpha = 100; this.MakeTranseparent(); return; } //topFrm.WindowState = FormWindowState.Minimized; escapedKepPressed = true; Init.MinizeAttachWindow(); MinimizeAll(); MiniZeAllForms(); Init.MinizeAttachWindow(); escapedKepPressed = false; } if (e.KeyValue == 38) { if (e.Shift) { _Opacity += .1; this.SetOpacity(); } else if (e.Alt) { if (WindowTransparentAlpha < 100) { WindowTransparentAlpha++; this.MakeTranseparent(); } } } if (e.KeyValue == 40) { if (e.Shift) { _Opacity -= .1; this.SetOpacity(); } else if (e.Alt) { if (WindowTransparentAlpha > 0) { WindowTransparentAlpha--; this.MakeTranseparent(); } } } HandleHeightDecrease(e); if (e.KeyValue == 112) { string helpMsg = ">To Make Transparent Box moveable/sizeable with mouse Press control Key and move window with mouse" + Environment.NewLine + Environment.NewLine; helpMsg += ">To Make Transparent Box along with mouse double click outside Transparent Box" + Environment.NewLine + Environment.NewLine; helpMsg += ">To incress/decrease the opacity of transpent box use Arrow Keys with ALT" + Environment.NewLine + Environment.NewLine; helpMsg += ">To incress/decrease opacity of background use up and down arrow key with SHIFT" + Environment.NewLine + Environment.NewLine; helpMsg += ">To Reduces Bottom use F2 key. To reverse SHIFT F2" + Environment.NewLine + Environment.NewLine; helpMsg += ">To Reduces TOP use F3 key. To reverse SHIFT F3" + Environment.NewLine + Environment.NewLine; helpMsg += ">To Refresh/Realign use F4 key." + Environment.NewLine + Environment.NewLine; helpMsg += ">To Save Favorate Location F6/F7 key." + Environment.NewLine + Environment.NewLine; helpMsg += ">To Close use ESC key" + Environment.NewLine + Environment.NewLine; helpMsg += ">To Toggle TopMost Property cick on top form" + Environment.NewLine + Environment.NewLine; MessageBox.Show(helpMsg); } if (e.KeyValue == 115) { this.RealignBackGround(); } if (e.KeyValue == 117) { SaveCurrentLocation(); } if (e.KeyValue == 118) { this.MoveToFavoriteLocation(); this.RealignBackGround(); } if (e.KeyValue == 119) { //this.MakeTranspranceyLowSlowly(); if (WindowTransparentAlpha < 100) { WindowTransparentAlpha += 10; if (WindowTransparentAlpha > 100) { WindowTransparentAlpha = 100; } this.MakeTranseparent(); } } //F9 if (e.KeyValue == 120) { if (WindowTransparentAlpha > 0) { WindowTransparentAlpha -= 10; if (WindowTransparentAlpha < 0) { WindowTransparentAlpha = 0; } this.MakeTranseparent(); } //WindowTransparentAlpha = 0; //this.MakeTranseparent(); } //F11 if (e.KeyValue == 122) { ToggleTopMost(); SetBackGround(); ToggleTopMost(); RealignBackGround(); } //F12 if (e.KeyValue == 123) { this.MakeTranseparent12(); } }