Effect3D (2)




Sub FormBevelLines (FormFrame As Form, side, wid, color)
' This Sub is called by FormInner/Outer Bevel to draw the

' lines for FormInnerBevel and FormOuterBevel

Dim X1, Y1, X2, Y2 As Integer
Dim rightX, bottomY
Dim dx1, dx2, dy1, dy2 As Integer
Dim i
rightX = FormFrame.ScaleWidth - 1
bottomY = FormFrame.ScaleHeight - 1
Select Case side
Case 0 'Left side
X1 = 0: dx1 = 1
X2 = 0: dx2 = 1
Y1 = 0: dy1 = 1
Y2 = bottomY + 1: dy2 = -1
Case 1 'Right side
X1 = rightX: dx1 = -1
X2 = X1: dx2 = dx1
Y1 = 0: dy1 = 1
Y2 = bottomY + 1: dy2 = -1
Case 2 'Top side
X1 = 0: dx1 = 1
X2 = rightX: dx2 = -1
Y1 = 0: dy1 = 1
Y2 = 0: dy2 = 1
Case 3 'Bottom side
X1 = 1: dx1 = 1
X2 = rightX + 1: dx2 = -1
Y1 = bottomY: dy1 = -1
Y2 = Y1: dy2 = dy1
End Select
For i = 1 To wid
FormFrame.Line (X1, Y1)-(X2, Y2), color
X1 = X1 + dx1
X2 = X2 + dx2
Y1 = Y1 + dy1
Y2 = Y2 + dy2
Next i
End Sub

'Here are the 2 main routines:

Sub FormOuterBevel (FormFrame As Form, BevelWidth As Integer)
' This sub draws raised bevels on a Form

'

' Parameters Type Comments

' FormFrame Form the Form to bevel

' BevelWidth integer width of bevel in pixels


FormFrame.ScaleMode = 3 ' Pixels

FormBevelLines FormFrame, 0, BevelWidth, QBColor(15) 'White
FormBevelLines FormFrame, 1, BevelWidth, QBColor(8) 'D.Gray
FormBevelLines FormFrame, 2, BevelWidth, QBColor(15) 'White
FormBevelLines FormFrame, 3, BevelWidth, QBColor(8) 'D.Gray
End Sub

' Example:

' In the Form_Paint event:


FormOuterBevel Form1, 3 '3 pixels in width
Sub FormInnerBevel (FormFrame As Form, BevelWidth As Integer)
' This sub draws recessed bevels on a Form

'

' Parameters Type Comments

' FormFrame Form the Form to bevel

' BevelWidth integer width of bevel in pixels

'


FormFrame.ScaleMode = 3 ' Pixels

FormBevelLines FormFrame, 0, BevelWidth, QBColor(8) 'D.Gray
FormBevelLines FormFrame, 1, BevelWidth, QBColor(15) 'White
FormBevelLines FormFrame, 2, BevelWidth, QBColor(8)
FormBevelLines FormFrame, 3, BevelWidth, QBColor(15)
End Sub

' Example:

' Call from the Form_Paint event


FormInnerBevel Form1, 3 '3 pixels in width
How to fill a listbox with files, directories and drives.
Note:
This has only been tested with VB 3 & VB 4-16, if you convert
this for use with other versions please let me know.-Burt Abreu
Create A 3D Raised or Recessed Bevel On A Form
Add the rountine below:










( effect3d2.html )- by Paolo Puglisi - Modifica del 17/12/2023