Print3D




Option Explicit

Private Declare Function BeginPath Lib "gdi32" _
(ByVal hDC As Long) As Long

Private Declare Function EndPath Lib "gdi32" _
(ByVal hDC As Long) As Long

Private Declare Function StrokeAndFillPath Lib "gdi32" _
(ByVal hDC As Long) As Long

Private Sub Picture1_Paint()
Const Hi = "Hi - If you like this"
Const tv = "then vote . . ."
With Picture1
'set picture box properties

.ScaleMode = vbPixels
.FontName = "comic sans ms" ' "times new roman" "arial"
.FontBold = True
.FontSize = 48
.Width = .TextWidth(Hi) * 15 + 120
.Height = .TextHeight(Hi) * 30 + 120
.BackColor = vbWhite
.ForeColor = vbBlack
.FillStyle = vbSolid
'print some text

.FontName = "comic sans ms" ' "times new roman" '"arial"
Print3D Hi, 0, 0, &H8080&, &HFFFF&
Print3D tv, 120, .CurrentY, &H808000, &HFFFF00
End With
End Sub

Private Sub Print3D(Txt As String, x As Long, y As Long, _
ShadowColor As Long, ForegroundColor As Long)

With Picture1
'print shadow

.FillColor = ShadowColor
.CurrentX = x + 4
.CurrentY = y + 4
BeginPath .hDC
Picture1.Print Txt;
EndPath .hDC
StrokeAndFillPath .hDC
'print foreground

.FillColor = ForegroundColor
.CurrentX = x
.CurrentY = y
BeginPath .hDC
Picture1.Print Txt
EndPath .hDC
StrokeAndFillPath .hDC
End With
End Sub










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