devxlogo

Show 3-D Text Messages

Show 3-D Text Messages

If you want to print text on an object with 3-D effects, use this subroutine to convert fonts into 3-D fonts with borders. In this routine, the user can define shadow length, shadow color, font color, border color, and position of text on the object. Note that all color values are in the range of 0-15 because they are used as arguments for the QBColor function:

 Sub Fonts3d(Print_Object As Object, Text1 As _	String, postx As Single, Posty As _	Single, Shadow_Length As Integer, _	FontsColor As Integer, ShadowColor As _	Integer, BorderColor As Integer)	Dim I As Integer, Prev_Scale_Mode As Integer	Prev_Scale_Mode = Print_Object.ScaleMode	If postx = -1 Then 'for center align		postx = (Print_Object.ScaleWidth - _			Print_Object.TextWidth(Text1)) / 2	End If	Print_Object.ForeColor = QBColor(ShadowColor)	'Generate shadow	For I = 1 To Shadow_Length * 16 Step 8		Call PrintText(Print_Object, _			postx + I, Posty + I, Text1)	Next I	'Print border	Print_Object.ForeColor = QBColor(BorderColor)	Call PrintText(Print_Object, postx - 15, Posty, Text1)	Call PrintText(Print_Object, postx + 15, Posty, Text1)	Call PrintText(Print_Object, postx, Posty - 15, Text1)	Call PrintText(Print_Object, postx, Posty + 15, Text1)	Print_Object.ForeColor = QBColor(FontsColor)	Call PrintText(Print_Object, postx, Posty, Text1)End SubSub PrintText(Print_Object As Object, _	Xposition As Single, Yposition As _	Single, Text1 As String)	Print_Object.CurrentX = Xposition	Print_Object.CurrentY = Yposition	'Print text on object	Print_Object.Print Text1End Sub' example of usage:Call Fonts3d(Picture1, "WELCOME TO T.T.T.I.", _  50, 150, 5, 6, 11, 12)
devxblackblue

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