Signature: Difference between revisions
Jump to navigation
Jump to search
(3 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
This control is based on an HTML Canvas element: the properties and methods of the [[PictureBox]] will also work on a Signature control. | This control is based on an HTML Canvas element: the properties and methods of the [[PictureBox]] will also work on a Signature control. | ||
The Signature control is a bit odd, since its methods are referred to by Signature1_signaturePad, not simply Signature1. This makes it impossible to have the "intellisense" pop up the methods. | |||
== Properties and Methods == | == Properties and Methods == | ||
Line 11: | Line 13: | ||
Standard [[properties and methods|properties]] are supported. | Standard [[properties and methods|properties]] are supported. | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |||
| clear() || Clear the current contents. | |||
|- | |- | ||
| getContext("2d") || Gets the drawing context. Returns the object that the PictureBox Context functions use. "2d" is currently the only valid argument. | | getContext("2d") || Gets the drawing context. Returns the object that the PictureBox Context functions use. "2d" is currently the only valid argument. | ||
Line 30: | Line 34: | ||
<pre> | <pre> | ||
Function btnSave_onclick() | Function btnSave_onclick() | ||
If Signature1_signaturePad.isEmpty() Then | |||
MsgBox "No signature entered" | |||
return | |||
End If | |||
'Get the image in a string which can be saved. | 'Get the image in a string which can be saved. | ||
Dim imageStr = | Dim imageStr = Signature1_signaturePad.toDataURL("image/jpeg") | ||
'display the string in an Image control. | 'display the string in an Image control. | ||
Line 38: | Line 47: | ||
Function btnClear_onclick() | Function btnClear_onclick() | ||
Signature1_signaturePad.clear() | |||
End Function | End Function | ||
Line 54: | Line 62: | ||
[[Category:General]] | [[Category:General]] | ||
[[Category:Common]] |
Latest revision as of 14:46, 13 February 2021
Description
The Signature control lets you capture signatures and drawings. You can save and display the results as a Base64 string.
This control is based on an HTML Canvas element: the properties and methods of the PictureBox will also work on a Signature control.
The Signature control is a bit odd, since its methods are referred to by Signature1_signaturePad, not simply Signature1. This makes it impossible to have the "intellisense" pop up the methods.
Properties and Methods
Standard properties are supported.
clear() | Clear the current contents. |
getContext("2d") | Gets the drawing context. Returns the object that the PictureBox Context functions use. "2d" is currently the only valid argument. |
lineColor | Sets the color of the line. Default is a deep blue. |
lineWidth | Sets the width of the line. Default is 1.5 pixels. |
toDataURL(type) | Returns the current picturebox in a Base64 string image. If type is not specified, it is in PNG format. Type can also be "image/jpeg" or "image/gif". |
Events
Events are handled by the control itself.
Example
The follow code initializes the signature control and shows how to save and clear it.
Function btnSave_onclick() If Signature1_signaturePad.isEmpty() Then MsgBox "No signature entered" return End If 'Get the image in a string which can be saved. Dim imageStr = Signature1_signaturePad.toDataURL("image/jpeg") 'display the string in an Image control. Image1.src = imageStr End Function Function btnClear_onclick() Signature1_signaturePad.clear() End Function