Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB4,VB5,VB6
Expertise: Intermediate
Jan 10, 2001



Building the Right Environment to Support AI, Machine Learning and Deep Learning

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
'    Me.FontName = "Arial Black"
'    Me.FontSize = 20
'    Me.ForeColor = vbWhite
'    Print3D Me, "Test this", 20, 20, vbBlack, 1

Sub 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

Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date