Scribble Examples

Example 1. Save a scribble as a bitmap file.

strFilename = Form.ShowFileSaveDialog()

sgnCustomer.SaveBitmapFile(strFilename)

Note:

Example 2. Load a binary file into a scribble control.

strFilename = Form.ShowFileOpenDialog()

binaryTmp = File.LoadBinary(strFilename)

sgnCustomer.LoadBinary(binaryTmp)

Note:

Example 3. Load a bitmap file into a scribble control.

strFilename = Form.ShowFileOpenDialog()

sgnCustomer.LoadFile(strFilename)

Note:

Example 4. Load an image control into a scribble control.

scribble1 = image1

Note:

Example 5. Clear the contents of a scribble.

IF Form.MessageBox("Warning", "Do you really wish to reset ?", MB_YESNO) == IDYES

}

    sgnCustomer.Reset()

}

Note:

Example 6. Disable or enable a scribble.

IF checkboxEnable == false

{

    sgnCustomer.Disable()

}

ELSE

{

    sgnCustomer.Enable()

}

Note:

Example 7. Show or hide a scribble.

IF boolShow == false           

{

    sgnCustomer.Hide()

}

ELSE

{

    sgnCustomer.Show()

}

Note:

Example 8. Save a scribble as a JPEG file.

strFilename = Form.ShowFileSaveDialog()

sgnCustomer.SaveJPEGFile(strFilename)

Note:

Example 9. Activate SnapToGrid mode.

The scribble control may be placed in a state where instead of free drawing, start and end vector points may be defined on the canvas, based on a grid. In this mode, tapping and holding the control will specify a start point, dragging will preview the line, and releasing the tap and hold gesture will commit the line to the control.

While this mode and snap size may be specified via control properties in BrightBuilder, it may also be set programmatically via the following methods:

scribble1.EnableSnapToGrid(true)

local.vGridSize = 20

scribble1.SetGridSize(vGridSize)

Note:

Example 10. Enable and perform Undo/Redo.

Scribble controls may incorporate undo/redo functionality, such that each continuous line drawn in the control is recorded, and may be stepped through for the control. This may be activated programmatically via the following method:

scribble1.EnableUndoRedo(true)

Once activated for a scribble control, the following methods may be used to undo and redo changes to the control:

// Undo last line drawn

scribble1.Undo()

 

// Redo last line undone

scribble1.Redo()

Note: