Private Sub Form_Load()
Dim tIni As New cINIFile
tIni.IniFile = AppPath & MainIniName
'MsgBox "aa"
'设置窗体大小为上次保存退出的大小
'jerry 2008年3与14号
Dim State, IniLeft, IniTop, IniWidth, IniHeight As Long
State = tIni.ReadInt("WindowState", "State", 0)
IniLeft = tIni.ReadInt("WindowState", "Left", 0)
IniTop = tIni.ReadInt("WindowState", "Top", 0)
IniWidth = tIni.ReadInt("WindowState", "Width", 0)
IniHeight = tIni.ReadInt("WindowState", "Height", 0)
'Me.WindowState = State
Me.Left = IniLeft * 15
Me.Top = IniTop * 15
Me.Width = IniWidth * 15
Me.Height = IniHeight * 15
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call SaveWindowState
End Sub
'============窗口位置============================
Public Sub SaveWindowState()
Dim tIni As New cINIFile
tIni.IniFile = AppPath & MainIniName
Dim tIniFile As cINIFile
Set tIniFile = New cINIFile
With tIniFile
.IniFile = AppPath & MainIniName
Call .WriteKey("WindowState", "State", Str(Me.WindowState))
Call .WriteKey("WindowState", "Left", Str(Me.Left / 15))
Call .WriteKey("WindowState", "Top", Str(Me.Top / 15))
Call .WriteKey("WindowState", "Width", Str(Me.Width / 15))
Call .WriteKey("WindowState", "Height", Str(Me.Height / 15))
End With
End Sub
'===========