home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / code / various / formpos / formpos.bas next >
Encoding:
BASIC Source File  |  1994-04-11  |  1.0 KB  |  35 lines

  1. Sub LoadFormPosition (f As Form)
  2. ' Gets the form position from our .INI file.
  3. ' If a form position is found, repositions us to that
  4. ' position, otherwise does nothing
  5.  
  6. ' NOTE! The .INI file section name is in <form>.Tag
  7. '    The .INI file name is in the global const INI_NAME
  8.  
  9. Dim nTop As Integer
  10. Dim nLeft As Integer
  11.  
  12.     nTop = GetPrivateProfileInt(f.Tag, "Top", f.Top, INI_NAME)
  13.     nLeft = GetPrivateProfileInt(f.Tag, "Left", f.Left, INI_NAME)
  14.  
  15.     f.Move nLeft, nTop
  16.  
  17. End Sub
  18.  
  19.  
  20. Sub SaveFormPosition (f As Form)
  21. ' Saves the top,left,height & width positions of <f> into our
  22. ' .INI file, using <f>.Tag as a section heading
  23.  
  24. ' NOTE    The .INI file name is in the global const INI_NAME
  25.  
  26. Dim i As Integer
  27.  
  28. ' The top position
  29.     i = WritePrivateProfileString(f.Tag, "Top", LTrim$(Str$(f.Top)), INI_NAME)
  30.     i = WritePrivateProfileString(f.Tag, "Left", LTrim$(Str$(f.Left)), INI_NAME)
  31.     i = WritePrivateProfileString(f.Tag, "Height", LTrim$(Str$(f.Height)), INI_NAME)
  32.     i = WritePrivateProfileString(f.Tag, "Width", LTrim$(Str$(f.Width)), INI_NAME)
  33.  
  34. End Sub
  35.