private void WriteNote_FormClosed(object sender, FormClosedEventArgs e) { RegistryKey RegKey1, RegKey2; RegKey1 = Registry.CurrentUser;//获取当前用户注册表项 try { RegKey2 = RegKey1.CreateSubKey(@"Software\NoteBook");//创建注册表子项 RegKey2.SetValue("PointX", this.Location.X.ToString()); RegKey2.SetValue("PointY", this.Location.Y.ToString()); } catch { } WindowsAPI.AnimateWindow(this.Handle, 1000, WindowsAPI.AW_BLEND | WindowsAPI.AW_HIDE); }
private void WriteNote_Load(object sender, EventArgs e) { dh = new DataHelper(); tfb = new TestForBinary(); RegistryKey RegKey1, RegKey2; RegKey1 = Registry.CurrentUser;//获取当前用户注册表项 try { RegKey2 = RegKey1.CreateSubKey(@"Software\NoteBook");//创建注册表子项 this.Location = new Point(Convert.ToInt16(RegKey2.GetValue("PointX")), Convert.ToInt16(RegKey2.GetValue("PointY"))); } catch { this.Location = new Point( (Screen.PrimaryScreen.WorkingArea.Width - this.Size.Width) / 2, (Screen.PrimaryScreen.WorkingArea.Height - this.Size.Height) / 2); } this.Icon = Properties.Resources.Icon_book; pictureBox_min.BackColor = Color.Transparent; pictureBox_close.BackColor = Color.Transparent; comboBox_weather.Items.Add("晴"); comboBox_weather.Items.Add("阴"); comboBox_weather.Items.Add("多云"); comboBox_weather.Items.Add("雨"); comboBox_weather.Items.Add("雪"); comboBox_weather.SelectedIndex = 0; comboBox_mood.Items.Add("开心"); comboBox_mood.Items.Add("郁闷"); comboBox_mood.Items.Add("失落"); comboBox_mood.Items.Add("无聊"); comboBox_mood.SelectedIndex = 0; label_UserName.Text = GlobalParam.Active_User; WindowsAPI.AnimateWindow(this.Handle, 300, WindowsAPI.AW_CENTER | WindowsAPI.AW_ACTIVATE); }