在我们写程序的时候,有时需要记录当前窗体位置和大小,以便下次打开时恢复上次的大小跟位置,像一般的播放器 浏览器就有这个功能
通过注册表记录窗体的大小跟位置
Private Sub Form_Load() Me.Width = GetSetting(App.Title, Me.Name, "Width", 7200) Me.Height = GetSetting(App.Title, Me.Name, "Height", 6300) Me.Top = GetSetting(App.Title, Me.Name, "Top", 100) Me.Left = GetSetting(App.Title, Me.Name, "Left", 100) End Sub Private Sub Form_Unload(Cancel As Integer) Call SaveSetting(App.Title, Me.Name, "Width", Me.Width) Call SaveSetting(App.Title, Me.Name, "Height", Me.Height) Call SaveSetting(App.Title, Me.Name, "Top", Me.Top) Call SaveSetting(App.Title, Me.Name, "Left", Me.Left) End Sub