private void checkBox1_CheckedChanged(object sender, EventArgs e) { AppHotKey.UnRegKey(mainForm.Handle); if (checkBox1.Checked) { AppHotKey.RegHotKey(mainForm.Handle, comboBox1.SelectedIndex); } Config.SaveHotkeyConfig(new Config.HotKeyConfig(comboBox1.SelectedIndex, checkBox1.Enabled)); }
private void Form1_Load(object sender, EventArgs e) { this.TransparencyKey = Color.Green; //注册热键 AppHotKey.RegHotKey(Handle, Config.ReadHotkeyConfigFromFile().hotkeyIndex); // Move this window to taskbar. SetDisplayMode(); pbLeftIcon.Tag = "百度"; Search.GetIconLinks(); Search.GetBaiduHotKeywords(); Search.GetDefaultExplorer(); popupFormList = new List <Form>(); //总在最前 topMostTask = new Task(() => { //设置为最前 while (true) { this.Invoke(new MethodInvoker( () => { if (displayMode == DisplayMode.TaskBar) { MoveTaskBarButtons(this.mainPanel.Width); SetDisplayMode(); } if (topMostEnable) { this.TopMost = true; //MyDebug.Print("top"+DateTime.Now.ToFileTime()); } } )); Thread.Sleep(30); } }); topMostTask.Start(); }