private void textBox3_TextChanged(object sender, EventArgs e) { try { TrayIcon.xoffset = Convert.ToInt32(textBox3.Text); //RegistryKey hklm = Registry.CurrentUser; //RegistryKey lgn = hklm.OpenSubKey(@"Software", true).CreateSubKey("BatteryIcon"); //lgn.SetValue("xoffset", textBox3.Text, RegistryValueKind.String); PTConfig cfg = new PTConfig(); cfg.Load(); cfg.XOffset = textBox3.Text; cfg.Update(); } catch { // do nothing } }
private void pictureBox3_Click(object sender, EventArgs e) { ColorDialog loColorForm = new ColorDialog(); if (loColorForm.ShowDialog() == DialogResult.OK) { pictureBox3.BackColor = loColorForm.Color; TrayIcon.lowColor = loColorForm.Color; // 更新颜色 // 将设置的颜色保存到注册表中 //RegistryKey hklm = Registry.CurrentUser; //RegistryKey lgn = hklm.OpenSubKey(@"Software", true).CreateSubKey("BatteryIcon"); //lgn.SetValue("lowColor", new ColorConverter().ConvertToString(TrayIcon.lowColor), RegistryValueKind.String); PTConfig cfg = new PTConfig(); cfg.Load(); cfg.LowColor = new ColorConverter().ConvertToString(TrayIcon.lowColor); cfg.Update(); } }
private void textBox1_TextChanged(object sender, EventArgs e) { try { TrayIcon.iconFontSize = Convert.ToInt32(textBox1.Text); // 将设置的字号保存到注册表中 //RegistryKey hklm = Registry.CurrentUser; //RegistryKey lgn = hklm.OpenSubKey(@"Software", true).CreateSubKey("BatteryIcon"); //lgn.SetValue("fontsize", textBox1.Text, RegistryValueKind.String); PTConfig cfg = new PTConfig(); cfg.Load(); cfg.FontSize = textBox1.Text; cfg.Update(); } catch { // do nothing } }
// 电池电量充满后是否自动隐藏电池图标 private void checkBox1_CheckedChanged(object sender, EventArgs e) { //RegistryKey hklm = Registry.CurrentUser; //RegistryKey lgn = hklm.OpenSubKey(@"Software\BatteryIcon", true); PTConfig cfg = new PTConfig(); cfg.Load(); if (checkBox1.Checked == true) { TrayIcon.autoHide = "true"; //lgn.SetValue("autoHide", "true", RegistryValueKind.String); cfg.AutoHide = "true"; } else { TrayIcon.autoHide = "false"; //lgn.SetValue("autoHide", "false", RegistryValueKind.String); cfg.AutoHide = "false"; } cfg.Update(); }