My.Computer.Registry.SetValue(path, "BottomMarginPx", 16, RegistryValueKind.DWord)
My.Computer.Registry.SetValue(path, "LeftMarginPx", 16, RegistryValueKind.DWord)
My.Computer.Registry.SetValue(path, "RightMarginPx", 16, RegistryValueKind.DWord)
My.Computer.Registry.SetValue("HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Explorer/Advanced", "ExtendedUIHoverTime", 400, RegistryValueKind.DWord)
maxSizeTextBox.Text = "200"
miniSizeTextBox.Text = "200"
xsTextBox.Text = "16"
ysTextBox.Text = "16"
tmTextBox.Text = "16"
bmTextBox.Text = "16"
lmTextBox.Text = "16"
rmTextBox.Text = "16"
dtTextBox.Text = "400"
"修改注册表后,重启explore.exe
Dim Explorers() As Process = Process.GetProcessesByName("explorer")
For Each Explorer As Process In Explorers
Explorer.Kill()
Next
Process.Start("explorer.exe")
Explorers = Nothing
End Sub
主要的代码就是这样, 下面是程序中所有的代码:
Imports Microsoft.Win32
Public Class mainForm
Dim path As String = "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Explorer/Taskband"
Private Sub textBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
"这个函数的功能是判断按下的键是否为数字或者Backspace键
If (e.KeyChar < "0" Or e.KeyChar > "9") Then
e.Handled = True
If Convert.ToInt32(e.KeyChar).Equals(8) Then
e.Handled = False
End If
Else
e.Handled = False
End If
End Sub "KeyPress函数
Private Sub txtBox_TextChanged(ByVal txtBox As TextBox, ByVal trackBar As TrackBar)
"TextBox里的值发生变化后
"如果值不为空
If txtBox.Text <> "" Then
"滑动条的值等于文本框内的数值
Try
trackBar.Value = txtBox.Text
If trackBar.Value > 512 Then "如果滑动条的值超过512则抛出一个异常
Throw New Exception
End If
Catch ex As Exception
trackBar.Value = 512
txtBox.Text = "512"
End Try
End If
"如果值为空
If txtBox.Text = "" Then
"滑动条的值置为0,文本框的值置为空
trackBar.Value = 0
txtBox.Text = ""
End If
End Sub "TextChanged函数
Private Sub trackBar_ValueChanged(ByVal txtBox As TextBox, ByVal tracBar As TrackBar)
"当滑动条数值变化时,文本框里的数值始终和滑动条值相等
txtBox.Text = tracBar.Value
End Sub "TrackBarValueChanged函数
Private Sub btnApplySettings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnApplySettings.Click
My.Computer.Registry.SetValue(path, "MaxThumbSizePx", Convert.ToInt32(maxSizeTrackBar.Value), RegistryValueKind.DWord)
My.Computer.Registry.SetValue(path, "MinThumbSizePx", Convert.ToInt32(miniSizeTrackBar.Value), RegistryValueKind.DWord)
My.Computer.Registry.SetValue(path, "ThumbSpacingXPx", Convert.ToInt32(xsTrackBar.Value), RegistryValueKind.DWord)
My.Computer.Registry.SetValue(path, "ThumbSpacingYPx", Convert.ToInt32(ysTrackBar.Value), RegistryValueKind.DWord)
My.Computer.Registry.SetValue(path, "TopMarginPx", Convert.ToInt32(tmTrackBar.Value), RegistryValueKind.DWord)
My.Computer.Registry.SetValue(path, "BottomMarginPx", Convert.ToInt32(bmTrackBar.Value), RegistryValueKind.DWord)
My.Computer.Registry.SetValue(path, "LeftMarginPx", Convert.ToInt32(lmTrackBar.Value), RegistryValueKind.DWord)
My.Computer.Registry.SetValue(path, "RightMarginPx", Convert.ToInt32(rmTrackBar.Value), RegistryValueKind.DWord)
推荐阅读
- Windows 7 VC-1编码器多核心支持不力
- Windows 7 SP1马蹄声近 微软升级系统部署工具
- 用Windows 7游戏管理器管理所有游戏
- Windows 7等多系统的备份与恢复
- Windows 7最新Bing日本官方主题
- 别盯Windows8 微软重头戏是云计算
- 卸载Windows7 SP1 Beta的三种方法
- 在Windows 7下利用笔记本的无线网卡定义热区供手机上网
- 微软:Windows 7比Mac OS X、Linux都要优秀
- 调整注册表让Windows7预览窗口更清晰