Signature: Difference between revisions
Jump to navigation
Jump to search
Created page with "file:Signature.png == Description == The Signature control lets you capture signatures and drawings. You can save and display the results as a Base64 string. This contr..." |
|||
Line 7: | Line 7: | ||
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. | ||
== Properties == | == Properties and Methods == | ||
Standard [[properties and methods|properties]] are supported. | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| 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. | ||
|- | |||
| 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". | | 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". |
Revision as of 19:39, 12 September 2014
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.
Properties and Methods
Standard properties are supported.
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.
Sub Main() NSB.SignatureCapture("Signature1") End Function Function btnSave_onclick() 'Get the image in a string which can be saved. Dim imageStr = Signature1.toDataURL("image/png") 'display the string in an Image control. Image1.src = imageStr End Function Function btnClear_onclick() Dim context = Signature1.getContext("2d"); context.clearRect(0, 0, Signature1.width, Signature1.height) End Function