"The code is exactly
how I would like to write code and the algorithms used are very
efficient and well-documented."
Van T. Dinh, Microsoft MVP
|
|
Class: CFormPos
Form Position Handler class to perform various functions relating to the position of a form on a screen. You may save a form's position to the Windows registry, and restore a form to its previously-saved position. You may center a form, or move it to a specified location.
This class uses the Windows registry to store information about the forms. You may specify any location of the registry by specifying the location with the RegistryPath and RootKey properties.
|
Procedure Name
|
Type
|
Description
|
|
(Declarations)
|
Declarations
|
Declarations and private variables for the CFormPos class
|
|
Form
|
Property
|
Sets a pointer to the form whose location you want to save and restore (required)
|
|
RegistryPath
|
Property
|
Sets the path to use for the form position entries in the registry (defaults to SOFTWARE\ plus the value of App.Title)
|
|
RootKey
|
Property
|
Gets the current value of the RootKey used for the form position entries in the registry (defaults to fprkHKeyLocalMachine, or the "HKEY_LOCAL_MACHINE" root key hive of the registry)
|
|
SubKey
|
Property
|
Sets the SubKey to use for the form position entries in the registry.
If not supplied, or set to "", the entries are stored in the root of the key indicated by the RegistryPath property.
|
|
CenterForm
|
Method
|
Centers the form on the screen
|
|
Class_Initialize
|
Initialize
|
Set initial values to defaults which may be overridden with property settings
|
|
Class_Terminate
|
Terminate
|
Release resources used by the class
|
|
RegistryGetKeyValue
|
Private
|
Returns a value from the system registry
|
|
RegistrySetKeyValue
|
Private
|
Sets a key value
|
|
RestoreForm
|
Method
|
Restores the form to the last-saved position stored by the SaveForm method.
Use the fForceVisible argument to handle the case where the form position was saved at a high resolution, but the user then changed to a low-resolution.
|
|
SaveForm
|
Method
|
Saves the current position of the form to the Windows registry.
This method stores the form's current Left, Top, Width, and Height values, along with its current WindowState property, to the Windows registry. The location where this value is saved is determined by the RootKey, RegistryPath and SubKey properties of the class.
|
Overview of Total Visual SourceBook
The source code in Total Visual
SourceBook includes modules and classes for Microsoft Access, Visual
Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily
add this professionally written, tested, and documented royalty-free code
into your applications to simplify your application development efforts.
Additional Resources
|
|