private void button5_Click(object sender, EventArgs e) //Set Default { AuroraMain frm1 = (AuroraMain)this.Owner; frm1.BackgroundImage = null; frm1.menuStrip1.BackgroundImage = null; frm1.toolStrip1.BackgroundImage = null; frm1.groupBox1.BackgroundImage = null; frm1.statusStrip1.BackgroundImage = null; RegistryKey MyReg, RegBKLocation; //声明注册表对象 MyReg = Registry.CurrentUser; //获取当前用户注册表项 RegBKLocation = MyReg.CreateSubKey("Software\\Aurora\\Color"); //在注册表项中创建子项 try { RegBKLocation.SetValue("BKEnabled", "false"); } catch { } }
private void button6_Click(object sender, EventArgs e) //Choose Picture { AuroraMain frm1 = (AuroraMain)this.Owner; string fName = ""; OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "JPG 文件交换格式(*.jpg;*.jpeg;*.jfif;*.jpe)|*.jpg;*.jpeg;*.jfif;*.jpe|可移植网络图形(*.png)|*.png|Windows 位图(*.bmp;*.dib;*.rle)|*.bmp;*.dib;*.rle|Tag 图像文件格式(*.tif;*.tiff)|*.tif;*.tiff|Windows 图元文件(*.wmf)|*.wmf|内嵌的 PostScript(*.eps)|*.eps|Macintosh PICT(*.pct;*.pict)|*.pct;*.pict|WordPerfect 图形(*.wpg)|*.wpg|所有文件|*.*"; openFileDialog.FilterIndex = 1; if (openFileDialog.ShowDialog() == DialogResult.OK) { RegistryKey MyReg, RegBKLocation; //声明注册表对象 MyReg = Registry.CurrentUser; //获取当前用户注册表项 RegBKLocation = MyReg.CreateSubKey("Software\\Aurora\\Color"); //在注册表项中创建子项 try { fName = openFileDialog.FileName; //File.Delete(Application.StartupPath + "\\BK.jpg"); frm1.BackgroundImage = Image.FromFile(fName); frm1.BackgroundImageLayout = ImageLayout.Tile; frm1.menuStrip1.BackgroundImage = Image.FromFile(fName); frm1.menuStrip1.BackgroundImageLayout = ImageLayout.Tile; frm1.toolStrip1.BackgroundImage = Image.FromFile(fName); frm1.toolStrip1.BackgroundImageLayout = ImageLayout.Tile; frm1.groupBox1.BackgroundImage = Image.FromFile(fName); frm1.groupBox1.BackgroundImageLayout = ImageLayout.Tile; frm1.statusStrip1.BackgroundImage = Image.FromFile(fName); frm1.statusStrip1.BackgroundImageLayout = ImageLayout.Tile; RegBKLocation.SetValue("BKEnabled", "true"); File.Copy(fName, Application.StartupPath + "\\BK1.jpg", true); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } else { return; } }