Print3D – Display text with 3D effect

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


About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist