Winform怎么将注册表的值传递到label?
using Microsoft.Win32;
private string GetRegistryValue(string path, string paramName)
{
string value = string.Empty;
RegistryKey root = Registry.CurrentUser;
RegistryKey rk = root.OpenSubKey(path);
if (rk != null)
{
value = (string)rk.GetValue(paramName, null);
}
return value;
}
调用
string value = GetRegistryValue(@"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "Fonts");
label1.Text = value;