<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Word.aspx.cs" Inherits="WordHandDraw_Word" %>

<%@ Register Assembly="PageOffice, Version=4.0.0.1, Culture=neutral, PublicKeyToken=1d75ee5788809228"
    Namespace="PageOffice" TagPrefix="po" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>手写批注接口演示</title>

    <script type="text/JavaScript">
        //保存
        function Save() {
            document.getElementById("PageOfficeCtrl1").WebSave();
        }
        
        //开始手写
        function StartHandDraw() {
            document.getElementById("PageOfficeCtrl1").HandDraw.Start();
        }
        //设置线宽
        function SetPenWidth() {
            document.getElementById("PageOfficeCtrl1").HandDraw.SetPenWidth(5);
        }
        //设置颜色
        function SetPenColor() {

            document.getElementById("PageOfficeCtrl1").HandDraw.SetPenColor(5292104);
        }
        //设置笔型
        function SetPenType() {

            document.getElementById("PageOfficeCtrl1").HandDraw.SetPenType(1);
        }
        //设置缩放
        function SetPenZoom() {

            document.getElementById("PageOfficeCtrl1").HandDraw.SetPenZoom(50);
        }
        //撤销最近一次手写
        function UndoHandDraw() {

            document.getElementById("PageOfficeCtrl1").HandDraw.Undo();
        }
        //退出手写
        function ExitHandDraw() {

            document.getElementById("PageOfficeCtrl1").HandDraw.Exit();
        }
        //访问手写集合
        function GetHandDrawList() {

            var handDrawList = null;
            var handDraw = null;
            handDrawList = document.getElementById("PageOfficeCtrl1").HandDraw;
            handDrawList.Refresh();
            document.getElementById("PageOfficeCtrl1").Alert("本文档共有 " + handDrawList.Count + " 个手写批示。");
            var i = 0; //索引从0开始
            for (i = 0; i < handDrawList.Count; i++) {
                handDraw = handDrawList.Item(i);
                handDraw.Locate();
                document.getElementById("PageOfficeCtrl1").Alert("第" + handDraw.PageNumber + "页" + ", " + handDraw.UserName + ", " + handDraw.DateTime);
            }

        }
    </script>

</head>
<body>
    <div style="font-size: 12px; line-height: 20px; border-bottom: dotted 1px #ccc; border-top: dotted 1px #ccc;
        padding: 5px;">
        <span style="color: red;">操作说明：</span>若想提前设置线宽、颜色、笔型、缩放等，可先点击自定义工具栏上的相应按钮，然后点击“开始手写”按钮。在尚未关闭手写工具栏时，点“撤销最近一次手写”按钮，可撤销最近一次的手写；点击“退出手写”按钮，可退出手写；还可点“设置线宽”、“设置颜色”等按钮对手写批注的颜色、线宽等进行再次设置。<br />
        关键代码：点右键，选择“查看源文件”，看js函数
        <br />
        <input id="Button3" type="button" value="设置线宽" onclick="SetPenWidth()" /><input
            id="Button4" type="button" onclick="SetPenColor()" value="设置颜色" />
        <input id="Button1" type="button" value="撤销最近一次手写" onclick="UndoHandDraw()" /><input
            id="Button2" type="button" onclick="ExitHandDraw()" value="退出手写" />
        <span style="background-color: Yellow;"></span>
    </div>
    <br />
    <form id="form1" runat="server">
    <div style="height: 700px; width: auto;">
        <po:PageOfficeCtrl ID="PageOfficeCtrl1" runat="server">
        </po:PageOfficeCtrl>
    </div>
    </form>
</body>
</html>
