Sub btnSignature_Click
Dialog.ButtonsFont = XUI.CreateFontAwesome(20)
Dim rs As ResumableSub = Dialog.ShowTemplate(SignatureTemplate, Chr(0xF00C), "", Chr(0xF00D))
Dialog.GetButton(XUI.DialogResponse_Positive).TextColor = XUI.Color_Green
Dialog.GetButton(XUI.DialogResponse_Cancel).TextColor = XUI.Color_Red
Dialog.ButtonsFont = XUI.CreateDefaultBoldFont(15) 'return it to the default font. It will no longer affect the current dialog
Wait For (rs) Complete (Result As Int)
If Result = XUI.DialogResponse_Positive Then
ImageView1.SetBitmap(SignatureTemplate.Bitmap.Resize(ImageView1.Width, ImageView1.Height, True))
Private cvs As B4XCanvas
cvs.Initialize(Pane1)
Private cvsRect As B4XRect
cvsRect.Initialize(0dip, 0dip, Pane1.Width, Pane1.Height)
cvs.DrawBitmap(SignatureTemplate.Bitmap.Resize(ImageView1.Width, ImageView1.Height, True), cvsRect)
Private f As B4XFont
f = XUI.CreateDefaultFont(10)
cvs.DrawText("Hola", 10, 10, f, XUI.Color_Cyan, "LEFT")
cvs.DrawText("Caracola", 10, 22, f, XUI.Color_Red, "LEFT")
Dim out As OutputStream = File.OpenOutput(File.DirApp, "signature.png", False) 'don't use File.DirApp in real applications
SignatureTemplate.Bitmap.WriteToStream(out, 100, "PNG")
out.Close
End If
End Sub