实现效果:
知识运用:
notraycontextmenu键
实现代码:
private void button1_Click(object sender, EventArgs e) { try { RegistryKey regkey; regkey = Registry.CurrentUser; regkey = regkey.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer"); regkey.SetValue("notraycontextmenu", 1, RegistryValueKind.DWord); regkey.Close(); if (MessageBox.Show("设置完成!") == DialogResult.OK) { RefreshSystem(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void button2_Click(object sender, EventArgs e) { try { RegistryKey regkey; regkey = Registry.CurrentUser; regkey = regkey.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer"); regkey.SetValue("notraycontextmenu", 0, RegistryValueKind.DWord); regkey.Close(); if (MessageBox.Show("设置完成!") == DialogResult.OK) { RefreshSystem(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }