BORDER3D HEADING

If you have landed straight into this Page please refer my earlier Posts: Command-Button Animation to link the essential Library Files (the list of files and explains how to attach them) to your Project and visit Create 3D Headings on Forms to copy and paste the Main Programs
FormTxtLabels()
Validate_Dup()
MsgLabel()
(which are required to Run the Function introduced here) into the Visual Basic Global Module of your Project.
The following Function creates a beautiful Heading. The Font, FontStyle (Bold, Italic) Shadow, Border and Forecolor can be customized.
Copy and paste the following Code below in the same Global Module where you have pasted the Main Programs as mentioned above or in a separate Global Module:
Public Function Border3D(ByVal intStyle As Integer, _
ByVal intForeColor As Integer, ByVal intBorderColor As Integer, _
Optional ByVal Label0Text1 As Integer) As String
'--------------------------------------------------
'Author : a.p.r. Pillai
'Date : September 2006
'--------------------------------------------------
Dim intlbls As Integer
Dim j As Integer, ForeColor As Long, BorderColor As Long
Dim lblName() As String, X As Integer, mySection As Section
Dim l As Long, t As Long, I As Long, intFSize As Integer
On Error Resume Next
I = 0.0104 * 1440 ' 0.0104 inches
Border3D = FormTxtLabels(Label0Text1)
Set mySection = MyFrm.Section(acDetail)
intlbls = mySection.Controls.Count - 1
On Error GoTo Border3D_Err
X = Validate_Dup(MyFrm, 7) ' check type and duplicate
If X = 1 Then
Exit Function
End If
intlbls = mySection.Controls.Count - 1
X = intForeColor
intForeColor = IIf(X < 0, 0, IIf(X > 15, 15, intForeColor))
X = intBorderColor
intBorderColor = IIf(X < 0, 0, IIf(X > 15, 15, intBorderColor))
X = intStyle
intStyle = IIf(X < 0, 0, IIf(X > 3, 3, intStyle))
ReDim lblName(0 To intlbls) As String
ForeColor = QBColor(intForeColor)
BorderColor = QBColor(intBorderColor)
For j = 0 To intlbls
lblName(j) = mySection.Controls(j).NAME
Next
For j = 0 To intlbls
With mySection.Controls(lblName(j))
.Height = lngheight
.Width = lngWidth
.FontName = "Times New Roman"
intFSize = .FontSize
If intFSize < intFontSize Then
.FontSize = intFontSize
End If
.FontUnderline = False
.TextAlign = intTextAlign
.BackStyle = intBackStyle
End With
Next
mySection.Controls(lblName(intlbls)).ForeColor = ForeColor
For j = 0 To intlbls - 1
mySection.Controls(lblName(j)).ForeColor = BorderColor
Next
l = intX: t = intY
With mySection.Controls(lblName(intlbls))
.Left = l
.Top = t
End With
For j = 2 To intlbls - 1
With mySection.Controls(lblName(j))
Select Case j
Case 2
.Left = l + I
.Top = t + I
Case 3
.Left = l + I
.Top = t - I
Case 4
.Left = l - I
.Top = t + I
Case 5
.Left = l - I
.Top = t - I
End Select
End With
Next
For j = 0 To 1
With mySection.Controls(lblName(j))
'.ForeColor = 9868950
.ForeColor = 0
If j = 0 Then
Select Case intStyle
Case 0
.Left = l - (I * 3)
.Top = t - (I * 3)
Case 1
.Left = l - (I * 3)
.Top = t + (I * 3)
Case 2
.Left = l + (I * 3)
.Top = t - (I * 3)
Case 3
.Left = l + (I * 3)
.Top = t + (I * 3)
End Select
Else
Select Case intStyle
Case 0
.Left = l - (I * 2)
.Top = t - (I * 2)
Case 1
.Left = l - (I * 2)
.Top = t + (I * 2)
Case 2
.Left = l + (I * 2)
.Top = t - (I * 2)
Case 3
.Left = l + (I * 2)
.Top = t + (I * 2)
End Select
End If
End With
Next
MsgLabel
Border3D_Exit:
Exit Function
Border3D_Err:
Msgbox Err.Description,, "Border3D"
Resume Border3D_Exit
End Function
To Create the Border3D Heading Text, display the Debug Window (Immediate Window)by pressing Ctrl+G (if you are already in the Visual Basic Module otherwise press Alt+F11 to display that first) then type the following line in the Immediate Window:
Border3D 1,15,0
The Module window will flash for a moment as if it is refreshed. Minimize the VB Module Window and you will see a New Form Created and kept minimized by the Program. Restore the Form and Save it with the Heading Text.
First let us see the Values entered as Parameter to the above Function. The first two Parameters are mandatory when the function is called and if they are not used the program will show Error Message 'Parameter not optional' and the third value is optional.
Parameter Values:
First Value 1 represents the Shadow Style and Value Range is 0 - 3 for the shadow tilted to any one of the four corners of the Text. The Value 1 will place the Shadow at left Bottom Corner of the Text.
The Second Value 15 represents Border Color and the Value Range is from 0 to 15 (15 = White).
Third Value 0 or 1 is optional and if omitted, 0 is assumed and it will create a Label based Heading Text, 1 will create a TextBox based Heading.
After creating the Heading Select all the controls together by clicking outside the controls and dragging the mouse over them. Once all the controls are selected together display the Property Sheet (Press F4 or View Menu--> Property) and change the Caption to your own Text. Change the Font, Font Size, Font Style Bold or Italic. Now click somewhere on the form away from the controls to de-select them then click on the top layer of the Labels and change the ForeColor of the Heading to your choice. Now Select all of them as you did earlier press Ctrl+C to Copy them into clipboard, Open your Form or Report in Design view and Paste the Heading on it. This Form you can save it as a Template so that you can copy, modify and use it on other Forms or Reports without running the Program from the Module window.
Download Demo DatabaseBorder 2D Heading Style
Create 3D Headings
Shadow 3D Heading Style
Labels: msaccess tips















0 Comments:
Post a Comment
Note:Comments subject to Review by Blog Author before displaying.
Links to this post:
Create a Link
<< Home