Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Oct 5, 1998

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 Sub
Sub 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 Text1
End Sub
' example of usage:
Call Fonts3d(Picture1, "WELCOME TO T.T.T.I.", _
  50, 150, 5, 6, 11, 12)
Atmabodh Hande
 
Comment and Contribute

 

 

 

 

 


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

 

 

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