Print3D – Display text with 3D effect

' Display a text with 3D effect'' OBJ can be a form or a PictureBox' TEXT is the text to be displayed' X, Y are the coordinate (in twips or in current coordinate system)' SHADOWCOLOR is the color of the shadow (default is black)' SHADOWOFFSET is the distance of shadow in pixels (default is 1 pixel)'    can be negative to give different effect''Example:'    Me.FontName = "Arial Black"'    Me.FontSize = 20'    Me.ForeColor = vbWhite'    Print3D Me, "Test this", 20, 20, vbBlack, 1Sub Print3D(ByVal obj As Object, ByVal Text As String, ByVal X As Long, _    ByVal Y As Long, Optional ByVal shadowColor As Long = vbBlack, _    Optional ByVal shadowOffset As Integer = 1)    Dim saveColor As Long    Dim offset As Single        ' convert the offset into current coordinate system    offset = Me.ScaleY(shadowOffset, vbPixels, obj.ScaleMode)        ' Save current forecolor    saveColor = obj.ForeColor        ' Display the shadow first    obj.CurrentX = X + offset    obj.CurrentY = Y + offset    obj.ForeColor = shadowColor    obj.Print Text;        ' Next display the text in current forecolor    obj.ForeColor = saveColor    obj.CurrentX = X - offset    obj.CurrentY = Y - offset    obj.Print Text;End Sub

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: