VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Add an affect to a text box. You can also use this code in a splash form.

by Hisham Shaaban (1 Submission)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 11th August 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Add an affect to a text box. You can also use this code in a splash form.

API Declarations


'The following constants u can change them
Const Str = "Visual Basic 6.0"
Const fntSize = 72
'*****************************************

Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" _
(ByVal hdc As Long, ByVal x As Long, ByVal y As Long, _
ByVal lpString As String, ByVal nCount As Long) As Long
Dim i%

Rate Add an affect to a text box. You can also use this code in a splash form.



'EMAIL: [email protected]
'This code add a cool efeect foa a text
' you can use this code in splash form
'Follow these steps:
'1- Open a standardEXE project
'2- Rename the form to frmCool_Effect
'3- Add four timers;
    'tmrStart...... Enabled=True & Interval=200
    'tmrEffect...... Enabled=False & Interval=10
    'tmrEffect2...... Enabled=False & Interval=10
    'tmrWait...... Enabled=False & Interval=50
'4-COPY PASTE THE FOLLOWING CODE

Private Sub Form_DblClick()
    Unload Me
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 27 And Shift = 0 Then Unload Me 'press Esc to exit
End Sub

Private Sub Form_Load()
    AutoRedraw = True
    KeyPreview = True
    FontName = "Book Antiqua"
    FontBold = True
    FontSize = fntSize
    BackColor = vbWhite
    BorderStyle = 0   'No Border
    Caption = "Cool Effect"
End Sub

Private Sub Form_Resize()
    Width = TextWidth(Str)
    Height = TextHeight(Str)
    With Screen
        Left = (.Width - Width) / 2
        Top = (.Height - Height) / 2
    End With
End Sub
Private Sub tmrStart_Timer()
    i = 255
    tmrEffect.Enabled = True
    tmrStart.Enabled = False
End Sub

Private Sub tmrEffect_Timer()
    Static b%
    Cls
    'Print a red shadow for the text
        ForeColor = RGB(255 - i, 0, 0)
        TextOut hdc, 2, 2, Str, b
    '*************************************
    'To make the text appears letter by letter
        If i Mod 5 = 0 Then _
            If b < Len(Str) Then b = b + 1
    'Print a the text
        ForeColor = RGB(i, i, i)
        TextOut hdc, 0, 0, Str, b
    '*************************************
    i = i - 10
    If i < 0 Then tmrEffect.Enabled = False: b = 0: tmrEffect2.Enabled = 1: i = 0
End Sub
Private Sub tmrEffect2_Timer()
    Cls
    'Print a red shadow for the text
        ForeColor = RGB(255, 255 - i, 255 - i)
        TextOut hdc, 2, 2, Str, Len(Str)
    '*************************************
    'Print a the text
        ForeColor = RGB(i, i, i)
        TextOut hdc, 0, 0, Str, Len(Str)
    '*************************************
    i = i + 50
    If i > 255 Then tmrEffect2.Enabled = 0: tmrWait.Enabled = True: i = 255
End Sub

Private Sub tmrWait_Timer()
    tmrStart.Enabled = 1
    tmrWait.Enabled = False
End Sub


Download this snippet    Add to My Saved Code

Add an affect to a text box. You can also use this code in a splash form. Comments

No comments have been posted about Add an affect to a text box. You can also use this code in a splash form.. Why not be the first to post a comment about Add an affect to a text box. You can also use this code in a splash form..

Post your comment

Subject:
Message:
0/1000 characters