Dear Sir/Madam,

I want to draw a word/sentence over form by coding as like as pencil is drawing in Paint Programe. But in Paint Programe Pencil is handle by user, here i want it to draw automatically. (like somebody is writing his name by Pen/Pencil)

Please guide me.

I know the effect you are looking for, and I know how to accomplish part of what you want if I interpret "over" correctly. Meaning, you don't want to draw to the form that is displayed, instead, you want to use transparency on another form and have the text hover either over your form or even the desktop or another program. And if that is not what you mean by over, but instead mean that you want the text to look like it is hovering over the form and casting a shadow, well I know how to do that also and can easily point you in the write (pun right) direction...

and that would be the call for you to use your friends (yahoo, google, ask, answers, bing) to search for the following...

vb6 form transparency
vb6 region transparency
vb6 text drop shadow
vb6 floating text

and search for form over at planetsourcecode.com after you select visual basic and set up your search preferences or else you will end up with a bunch of .net code that will be meaningless to you...

However, the actual animation of writing something out, well I have never tried that before, nor have I seen anyone else do something like that. But I have seen examples that mimic as if someone was typing...

Now, I do know of a way that this could be accomplished with the above code you will find with those searches, but the number of graphics you would have to use would make your project HUGE!!!

So hopefully, someone else can come along and perhaps give you a hint as to how to accomplish the animation sequence that does not involve many, many graphic files, but until then, happy searching...

Good Luck

Hi P.manidas,

This sample code may be just a starting point: form1 allows drawing of signature and saving to file, form2 redraws signature. Obviously, this is a rough example, but from here, you could let your imagination run wild. All things are possible, just a matter of how much time you are willing to donate.

Regards

'*** Start of Form1 Code
Option Explicit

Dim FirstName As String
Dim DrawNow As Integer
Dim ff As Integer

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
    DrawNow = -1
    CurrentX = x
    CurrentY = Y
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
    If DrawNow = -1 Then
        Circle (x, Y), 50
        Print #ff, x & "|" & Y  'write each x,y coordinate to file
    End If
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
    DrawNow = 0
End Sub

Private Sub OpenSignatureFile(sName As String)
    FirstName = App.Path & "\" & sName & ".csv"
    ff = FreeFile
    Open FirstName For Output As #ff
End Sub

Private Sub Form_Load()
    FirstName = InputBox("Please enter your first name?", "Put UR John Henry here!", "YourName-NoSpacesPlease!")
    DrawNow = 0
    OpenSignatureFile (FirstName)
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Close #ff
End Sub

'You should probably add a button to let them clear the screen and start over

'Sub Command1_Click()
    'DrawNow = 0
    'Me.Cls 'clear window
    'Close #ff 'close already opened file
    'OpenSignatureFile (sName) 'reopen file
'End Sub
'*** End of Form1 code


'*** Start of Form2 code
'Make both forms same height and width
Option Explicit

Dim FirstName As String

Public Sub DrawSignature(sName As String)
Dim fn As Integer
Dim fName As String
Dim x() As Variant
Dim Params As Integer
Dim xyPos As Integer
Dim Textline As String
Dim strTemp As String
Dim PauseTime, StartTime

On Error Resume Next
    fName = sName
    fn = FreeFile
    If Dir(fName) = "" Then
        MsgBox "File not found"
        Exit Sub
    End If
    Open fName For Input As #fn
    Do While Not EOF(fn)
        Line Input #fn, Textline
        Textline = Trim(Textline) + "|"
        ReDim x(0)
        strTemp = Textline
        xyPos = InStr(1, strTemp, "|", 1)
        Params = 0
        While xyPos > 0
            xyPos = InStr(1, strTemp, "|", 1)
            If strTemp <> "" And xyPos > 0 Then
                x(Params) = Mid(strTemp, 1, xyPos - 1)
            End If
            Params = Params + 1
            strTemp = Mid(strTemp, xyPos + 1, Len(strTemp))
            ReDim Preserve x(Params)
        Wend
        Circle (Val(x(0)), Val(x(1))), 50
        PauseTime = 0.005 'Experiment with this value for smoothness of playback
        StartTime = Timer
        Do While Timer < (StartTime + PauseTime)
            DoEvents
        Loop
    Loop
    Close #fn
    Erase x
End Sub

Private Sub Form_Load()
    Me.AutoRedraw = True
    FirstName = InputBox("Please enter signature name?", "View Signature!", "YourName-NoSpacesPlease!")
    Me.Caption = "Welcome " & FirstName
    Me.Show
    DrawSignature App.Path & "\" & FirstName & ".csv"
End Sub
'****End of Form2 Code
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.