|
Visual Basic (VB and VBA) |
|
Copyright 1999-2001 Christopher Greaves. All rights reserved. Home Page and email to [email protected] |
| If in doubt, record a macro and inspect the entrails! |
Please read the DISCLAIMER.
Here is an INDEX to all the procedures.
You will probably need one copy of my GLOBAL DECLARATIONS.
Public Function cmdUserFormInitialize(frmMe As UserForm)
' Procedure : cmd_UserFormInitialize
' Description: Generic GUI form initialization routine.
' Copyright: Chris Greaves Inc.
' Inputs: The name of a form.
' Returns: None.
' Assumes: None.
' Side Effects: None.
' Tested: By a call from the user.
' Obtain the current or default colours from the INI file.
Dim strColours As String
strColours = Trim(strGPA(strcColours, strcDefaultColours)) & strcINIFileDelimiter
Dim strR As String ' Red component
Dim strB As String ' Blue component
Dim strG As String ' Green component
' We now make repeated calls to strSplitStringAt to obtain successive sub-strings of the colour set.
' strip the Origin and base figures.
strR = strSplitStringAt(strColours, strcINIFileDelimiter, True)
strColours = strSplitStringAt(strColours, strcINIFileDelimiter, False)
strR = strSplitStringAt(strColours, strcINIFileDelimiter, True)
strColours = strSplitStringAt(strColours, strcINIFileDelimiter, False)
' Controls background
' obtain the controls background colour combinations.
strR = strSplitStringAt(strColours, strcINIFileDelimiter, True)
strColours = strSplitStringAt(strColours, strcINIFileDelimiter, False)
strB = strSplitStringAt(strColours, strcINIFileDelimiter, True)
strColours = strSplitStringAt(strColours, strcINIFileDelimiter, False)
strG = strSplitStringAt(strColours, strcINIFileDelimiter, True)
strColours = strSplitStringAt(strColours, strcINIFileDelimiter, False)
Dim myControl As Control
' set the controls background colour.
For Each myControl In frmMe.Controls
myControl.BackColor = RGB(Val(strR), Val(strB), Val(strG))
Next myControl
' Controls Foreground
' obtain the controls foreground colour combinations.
strR = strSplitStringAt(strColours, strcINIFileDelimiter, True)
strColours = strSplitStringAt(strColours, strcINIFileDelimiter, False)
strB = strSplitStringAt(strColours, strcINIFileDelimiter, True)
strColours = strSplitStringAt(strColours, strcINIFileDelimiter, False)
strG = strSplitStringAt(strColours, strcINIFileDelimiter, True)
strColours = strSplitStringAt(strColours, strcINIFileDelimiter, False)
' set the controls foreground colour.
For Each myControl In frmMe.Controls
On Error Resume Next
myControl.ForeColor = RGB(Val(strR), Val(strB), Val(strG))
Next myControl
' Forms Background
' obtain the form background colour combinations.
strR = strSplitStringAt(strColours, strcINIFileDelimiter, True)
strColours = strSplitStringAt(strColours, strcINIFileDelimiter, False)
strB = strSplitStringAt(strColours, strcINIFileDelimiter, True)
strColours = strSplitStringAt(strColours, strcINIFileDelimiter, False)
strG = strSplitStringAt(strColours, strcINIFileDelimiter, True)
strColours = strSplitStringAt(strColours, strcINIFileDelimiter, False)
' set the form background colour.
frmMe.BackColor = RGB(Val(strR), Val(strB), Val(strG))
' Control Fonts
'Procs Dim strFonts As String
Dim strTypeFace As String
Dim strPointSize As String
strTypeFace = strGPA(strcFontTypeface, strcFontTypefaceDefault)
strPointSize = strGPA(strcFontSize, strcFontSizeDefault)
For Each myControl In frmMe.Controls
On Error Resume Next
myControl.Object.FontName = strTypeFace
myControl.Object.FontSize = strPointSize
Next myControl
' Mouse Pointer
Dim strMousePointer As String
strMousePointer = strGPA(strcMousePointer, strcMousePointerdefault)
If strMousePointer = "" Then
Else
If boolFileExists(strMousePointer) Then
Else
strMousePointer = ""
End If
End If
For Each myControl In frmMe.Controls
On Error GoTo Failed
If myControl.Object.MousePointer = 99 = "" Then
myControl.Object.MousePointer = 0
Else
myControl.Object.MousePointer = 99
myControl.Object.MouseIcon = LoadPicture(strMousePointer)
End If
Failed:
On Error GoTo 0
Next myControl
End Function
| We all knew nothing when we started … |
|
Home Page and Contact Information Send email to [email protected]. This page was last updated Thursday, November 15, 2001 |