# How can i determine if anything is written on a picture box

I have a picture box on a form that is being used to capture a signature.  How can I determine whether someone has "signed" or written anything on the pictire box?  Can I compare the picture box against a "blank" picture box?  Any suggestions would be appreciated.  Thanks.
###### Who is Participating?

Commented:
Or if you perhaps think people may try to cheat it do something like this:

Dim Ox As Long
Dim Oy As Long
Dim Weight As Long
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.PSet (X, Y), vbRed
Ox = X
Oy = Y
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Picture1.Line (Ox, Oy)-(X, Y)
If X > Picture1.ScaleWidth Or X < 0 Then GoTo 1
If Y > Picture1.ScaleHeight Or Y < 0 Then GoTo 1
Weight = Weight + Abs(Ox - X) + Abs(Oy - Y)
1
Ox = X
Oy = Y
End If
Form1.Caption = Weight
End Sub

That will make sure the weight only adds when they are inside the picture box's range.

Note that is just an example I am giving you. The caption is changed so that you can see
how it works if you put that in a project by itself. You would likely remove that for your
project.
0

Commented:
How are they drawing on it? If they draw to it then it has been written on, hasn't it?
0

Commented:
In other words, as soon as you draw to the picture, you can set a variable to state it has been drawn on.
0

Author Commented:
Exactly, however, I don't want a mouse tap to count as a signature.
0

Commented:
What would count as a signature? This is something you must know in order to create.
The best way to go about capturing what is done is to monitor it as it is done. Perhaps
a weight system? Say you have :

Dim Ox As Long
Dim Oy As Long
Dim Weight As Long
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.PSet (X, Y), vbRed
Ox = X
Oy = Y
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Picture1.Line (Ox, Oy)-(X, Y)
Weight = Weight + Abs(Ox - X) + Abs(Oy - Y)
Ox = X
Oy = Y
End If
Form1.Caption = Weight
End Sub

Now you have a weight, then you just need to define what weight will be considered valid for
a signature.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.