# Re: 如何将一个form每次开始时也在同一个地方?

Posted by 彭明柳 on June 23, 1998 at 22:42:15:

In Reply to: Re: 如何将一个form每次开始时也在同一个地方? posted by 洛斯狄克 on June 23, 1998 at 13:30:04:

1. 在Form_Load()事件中,加入以下程式码:
Me.Left = GetSetting(App.Title, "Settings", "MainLeft", 1000)
Me.Top = GetSetting(App.Title, "Settings", "MainTop", 1000)
Me.Width = GetSetting(App.Title, "Settings", "MainWidth", 6500)
Me.Height = GetSetting(App.Title, "Settings", "MainHeight", 6500)

在Form_Unload()事件中,加入以下程式码
SaveSetting App.Title, "Settings", "MainLeft", Me.Left
SaveSetting App.Title, "Settings", "MainTop", Me.Top
SaveSetting App.Title, "Settings", "MainWidth", Me.Width
SaveSetting App.Title, "Settings", "MainHeight", Me.Height

如此一来,每回离开应用程式时,程式都会把离开的位置存入register中,载入时便能复原.
2. 如果您只是要开启时显示在同个地方,那就更简单了!
Form_Load()
Me.Move x1, y1 'x1, y1为您指定出现的值
或是在Design Mode中,指定StartUpPosition及Top, Left等属性不就好了?
Try it and enjoy it!

Follow Ups: