<%@ Page Theme="Default" Language="vb" AutoEventWireup="true"  %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="../Common/styles.css" rel="stylesheet" type="text/css" />
    <link href="styles.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container size-wide">
        <telerik:RadEditor RenderMode="Lightweight" runat="server" ID="RadEditor1" Width="800px">
            <Tools>
                <telerik:EditorToolGroup>
                    <telerik:EditorTool Name="InsertSignatureVB" Text="Insert Handwritten Signature"></telerik:EditorTool>
                </telerik:EditorToolGroup>
                <telerik:EditorToolGroup>
                    <telerik:EditorTool Name="Bold"></telerik:EditorTool>
                    <telerik:EditorTool Name="Italic"></telerik:EditorTool>
                    <telerik:EditorTool Name="Underline"></telerik:EditorTool>
                </telerik:EditorToolGroup>
            </Tools>
            <Content>
                To sign up, simply click on the pencil icon above and use your mouse to handwrite your signature and insert it here.
            </Content>
        </telerik:RadEditor>
        <asp:HiddenField ID="hiddenField1" runat="server" />
        <script>
            // Add custom command to the RadEditor command list
            Telerik.Web.UI.Editor.CommandList['InsertSignatureVB'] = function (commandName, editor, args) {
                // Callback function to handle signature insertion after the dialog is closed
                var myCallbackFunction = function (sender, args) {
                    // Insert signature image HTML into the editor
                    editor.pasteHtml(String.format('<img src=\'{0}\' border=\'0\' style=\'width:50%;height:50%;\'  /> ', args.src));
                };
                // Show signature dialog as an external dialog
                editor.showExternalDialog(
                    'InsertSignatureVB.aspx',
                    null,
                    540,
                    450,
                    myCallbackFunction,
                    null,
                    'Draw and Insert Signature',
                    true,
                    Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
                    false,
                    true);
            };
        </script>
    </div>
    </form>
</body>
</html>