private void Lb_MouseClick2(object sender, MouseEventArgs e) { if (names == "ForceTer Setting") { if (MessageBox.Show("\r\n是否将ForceTer还原为初始状态?\r\n此操作会将所有添加的图标,背景图,点击率,等内容删除(不可恢复) !", "ForceTer 3.0", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { if (Sqlite.GetSetting().Start) { AddStart(false); //设置开机启动的项目 } Sqlite.SetBackgroundImage("\\localhost"); Sqlite.SetSetting(new Setting(false, true, true, false, false, "1024×768(推荐)", 1024, 768)); ft.ReloadForm(); ft.BackgroundImage = Sqlite.GetBackgroundImage(); ft.Enabled = true; ft.contextMenuStrip1.Enabled = true; Sqlite.DelMenuAll(); Files.DeleteFileAll(); ft.imageList1.Images.Clear(); ft.lv.Clear(); ft.lv.Items.Clear(); ft.Show(); this.Close(); } return; } }
private void 系统设置ToolStripMenuItem2_Click(object sender, EventArgs e) { this.Enabled = false; this.contextMenuStrip1.Enabled = false; Menu m = (Menu)(this.contextMenuStrip2.Tag); Popup p = new Popup(this); p.LoadSetting(420, 300, "ForceTer Setting"); p.LoadButtonManySetting("初始化", "扫描桌面", "还原默认", "应用设置", "取消", false); p.Show(); p.SetSetting(Sqlite.GetSetting()); }
private void Lb_MouseClick3(object sender, MouseEventArgs e)//应用设置里边的修改内容 { Setting s = new Setting(); Setting setting = Sqlite.GetSetting(); foreach (Control ctrl in this.Controls) { if ((string)ctrl.Tag == "开机启动") { Boolean strat = (((CheckBox)ctrl).CheckState == CheckState.Checked); if (setting.Start != strat) { if (!AddStart(strat)) { ((CheckBox)ctrl).CheckState = setting.Start?CheckState.Checked:CheckState.Unchecked; MessageBox.Show(" 提醒 : \r\n\t未同意管理员请求,设置失败! ", "ForceTer"); return; } } s.Start = ((CheckBox)ctrl).CheckState == CheckState.Checked ? true : false; } else if ((string)ctrl.Tag == "前台显示") { s.Top = ((CheckBox)ctrl).CheckState == CheckState.Checked ? true : false; } else if ((string)ctrl.Tag == "退出时提示") { s.Exit = ((CheckBox)ctrl).CheckState == CheckState.Checked ? true : false; } else if ((string)ctrl.Tag == "打开程序后隐藏") { s.Openfile = ((CheckBox)ctrl).CheckState == CheckState.Checked ? true : false; } else if ((string)ctrl.Tag == "打开文件位置后隐藏") { s.Openfoder = ((CheckBox)ctrl).CheckState == CheckState.Checked ? true : false; } else if ((string)ctrl.Tag == "type") { s.Desktop = ((ComboBox)ctrl).Text; } } Sqlite.SetSetting(s); ft.ReloadForm(); Pb_MouseClick4(sender, e); }
public void ReloadForm()//重置窗口大小 { setting = Sqlite.GetSetting(); this.Width = setting.Width; this.Height = setting.Height; Rectangle rect = Screen.GetWorkingArea(this); this.Left = rect.Width / 2 - this.Width / 2; this.Top = rect.Height / 2 - this.Height / 2; lv.Width = this.Width - 16; lv.Height = this.Height - 128; selectpb.Left = setting.Width - 224; selecttb.Left = setting.Width - 216; this.TopMost = setting.Top ? true : false; foreach (Control ctrl in this.Controls) { if (ctrl is PictureBox) { if (ctrl.Width == 35 || ctrl.Width == 45) { switch ((string)ctrl.Tag) { case "设置": ctrl.Left = this.Width - 45 - 4 - 35 - 35 - 35; break; case "更换皮肤": ctrl.Left = this.Width - 45 - 4 - 35 - 35; break; case "隐藏到托盘": ctrl.Left = this.Width - 45 - 4 - 35; break; case "关闭": ctrl.Left = this.Width - 45 - 4; break; default: break; } } } } }
private void LoadFile()//判断这个文件夹是否存在,不存在则创建 { try { if (!File.Exists("SQLite.Interop.dll") || !File.Exists("System.Data.SQLite.dll") || !File.Exists("databases.db") || !File.Exists("Advauthority.exe")) { MessageBox.Show(" Error : \r\n\t文件丢失,请重新下载! ", "ForceTer"); exit(); return; } else { justFileAuth(); if (!Directory.Exists("image")) { Directory.CreateDirectory("image"); } setting = Sqlite.GetSetting();//加载设置信息 LoadForm(); this.Show(); this.Activate(); SetTitle(this.Name); LoadListView(); SetNotify(); LoadImages(); LoadMenu("热门应用", true); LoadSelect(); } } catch { MessageBox.Show(" Error : \r\n\t没有权限,或文件损坏,请重新下载,或给予操作权限! ", "ForceTer"); exit(); return; } }