[C#] 레지스트리 생성/읽기

//레지스트리를 읽어보자
reg = Registry.CurrentUser.OpenSubKey("Software\\KimKitty", true);
if (reg == null)
{
global_x = Screen.PrimaryScreen.Bounds.Width / 2;
global_y = Screen.PrimaryScreen.Bounds.Height / 2;

reg = Registry.CurrentUser.CreateSubKey("Software\\KimKitty", RegistryKeyPermissionCheck.ReadWriteSubTree);
reg.SetValue("Button_Set", "Left");
reg.SetValue("Mouse_X", global_x.ToString());
reg.SetValue("Mouse_Y", global_y.ToString());
reg.SetValue("Interval", metroTextBox1.Text);
}
else
{
if (reg.GetValue("Button_Set").ToString() == "Left")
{
metroRadioButton1.Checked = true;
}
else
{
metroRadioButton2.Checked = true;
}
global_x = int.Parse(reg.GetValue("Mouse_X").ToString());
global_y = int.Parse(reg.GetValue("Mouse_Y").ToString());
metroTextBox1.Text = reg.GetValue("Interval").ToString();
}

 

Post Author: 김 키티

답글 남기기

이메일 주소를 발행하지 않을 것입니다. 필수 항목은 *(으)로 표시합니다