CAD向控件注册一个命令

_DMxDrawX::RegistUserCustomCommand


向控件注册一个命令,用户在命令行输入命令名这个字符串,就会触发执行命令事件 命令事件的id就是该注册时的id值,成功返回true。详细说明如下:


参数 说明

BSTR pszCommandName

命令名称

LONG lId

命令id


点击按钮,向控件注入自定义命令,在命令栏输入js中设置好的命令名称,就会打开打印对话框。


1
2
3
4
5
6
7
8
//设置自定义命令调用打印
if (iCmd == 600) {
    mxOcx.RegistUserCustomCommand("00",111);
    mxOcx.Focus();
}
else if (iCmd == 111) {
        UserPrint();
    }


1
2
3
function UserPrint() {
    mxOcx.SendStringToExecute("Plot");
}

posted on 2019-06-05 14:03  梦想CAD控件  阅读(422)  评论(0)    收藏  举报

导航