home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Planet Source Code Jumbo …e CD Visual Basic 1 to 7
/
7_2009-2012.ISO
/
data
/
zips
/
Disk_Data_2224916142012.psc
/
clsKeyEdit.cls
< prev
Wrap
Text File
|
2012-06-14
|
7KB
|
163 lines
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "cKeyEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
' ***************************************************************************
' Module: cKeyEdit
'
' Description: These are the common edit routines you will find in most
' word processors. (Copy, Cut, Paste)
'
' ===========================================================================
' DATE NAME / DESCRIPTION
' ----------- --------------------------------------------------------------
' 02-JUL-1998 Kenneth Ives kenaso@tx.rr.com
' Wrote module
' 11-Jan-2009 Kenneth Ives kenaso@tx.rr.com
' Updated ProcessNumericOnly() routine flower box with an
' additional code suggestion.
' 20-Dec-2010 Kenneth Ives kenaso@tx.rr.com
' - Major update to CenterCaption() routine.
' - Changed ErrorMsg call to InfoMsg call in CenterCaption()
' and CenterReportText() routines.
' 25-Dec-2010 Kenneth Ives kenaso@tx.rr.com
' Rewrote CenterReportText() routine.
' 18-Feb-2011 Kenneth Ives kenaso@tx.rr.com
' Added NoCopyText() routine.
' 16-Mar-2011 Kenneth Ives kenaso@tx.rr.com
' Updated CenterReportText() routine
' 10-Jul-2011 Kenneth Ives kenaso@tx.rr.com
' Fixed a bug in CenterCaption() routine.
' 02-Oct-2011 Kenneth Ives kenaso@tx.rr.com
' Fixed minor bugs. See ProcessNumericOnly() and
' ProcessAlphaNumeric() routines.
' ***************************************************************************
Option Explicit
' ***************************************************************************
' Constants
' ***************************************************************************
Private Const MODULE_NAME As String = "clsKeyEdit"
Private Const SPI_GETNONCLIENTMETRICS As Long = 41
Private Const LOGPIXELSY As Long = 90
' ***************************************************************************
' Type structures
' ***************************************************************************
Private Type LogFont
FontHeight As Long
FontWidth As Long
FontEscapement As Long
FontOrientation As Long
FontWeight As Long
FontItalic As Byte
FontUnderline As Byte
FontStrikeOut As Byte
FontCharSet As Byte
FontOutPrecision As Byte
FontClipPrecision As Byte
FontQuality As Byte
FontPitchAndFamily As Byte
FontFaceName As String * 32
End Type
Private Type NONCLIENTMETRICS
cbSize As Long
iBorderWidth As Long
iScrollWidth As Long
iScrollHeight As Long
iCaptionWidth As Long
iCaptionHeight As Long
LFCaptionFont As LogFont
iSMCaptionWidth As Long
iSMCaptionHeight As Long
LFSMCaptionFont As LogFont
iMenuWidth As Long
iMenuHeight As Long
LFMenuFont As LogFont
LFStatusFont As LogFont
LFMessageFont As LogFont
End Type
' ***************************************************************************
' API Declares
' ***************************************************************************
' The GetSystemMetrics function retrieves various system metrics and
' system configuration settings. System metrics are the dimensions
' (widths and heights) of Windows display elements. All dimensions
' retrieved by GetSystemMetrics are in pixels.
Private Declare Function GetSystemMetrics Lib "user32" _
(ByVal nIndex As Long) As Long
' The GetDeviceCaps function retrieves device-specific information
' about a specified device.
Private Declare Function GetDeviceCaps Lib "gdi32" _
(ByVal hDC As Long, ByVal nIndex As Long) As Long
' The SystemParametersInfo function queries or sets systemwide
' parameters. This function can also update the user profile while
' setting a parameter. This function is intended for use with
' applications, such as Control Panel, that allow the user to
' customize the Windows environment.
Private Declare Function SystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" (ByVal uAction As Long, _
ByVal uParam As Long, lpvParam As Any, _
ByVal fuWinIni As Long) As Long
' ZeroMemory is used for clearing contents of a type structure.
Private Declare Sub ZeroMemory Lib "kernel32" Alias "RtlZeroMemory" _
(Destination As Any, ByVal Length As Long)
' ***************************************************************************
' **** Methods ****
' ***************************************************************************
' ***************************************************************************
' Routine: CenterCaption
'
' Description: Centers a caption on a form.
'
' Parameters: frmForm - Name of form whose caption is to be centered
'
' ===========================================================================
' DATE NAME / DESCRIPTION
' ----------- --------------------------------------------------------------
' 17-OCT-2000 Tom Pydeski
' http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=12103&lngWId=1
' 20-Dec-2010 Kenneth Ives kenaso@tx.rr.com
' Modified and documented
' 10-Jul-2011 Kenneth Ives kenaso@tx.rr.com
' Exit routine if form caption is empty.
' ***************************************************************************
Public Sub CenterCaption(ByRef frmForm As Form)
Dim strCaption As String
Dim lngTwips As Long
Dim lngCtrlBox As Long
Dim lngTbarWidth As Long
Dim lngTbarHeight As Long
Dim lngCaptionWidth As Long
On Error GoTo CenterCaption_Error
Set frmForm.Font = GetTitleFont(frmForm) ' Get font information
strCaption = TrimStr(frmForm.Caption) ' Capture form caption
' If no caption then leave
If Len(strCaption) = 0 Then
Exit Sub
End If
lngTbarHeight = GetSystemMetrics(4) * Screen.TwipsPerPixelX ' height of window