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