_DMxDrawX::RegistUserCustomCommand
向CAD控件注册一个命令,用户在命令行输入命令名这个字符串,就会触发执行命令事件 命令事件的id就是该注册时的id值,成功返回true。详细说明如下:
| 参数 | 说明 |
|---|---|
|
BSTR pszCommandName |
命令名称 |
|
LONG lId |
命令id |
点击按钮,向CAD控件注入自定义命令,在命令栏输入js中设置好的命令名称,就会打开打印对话框。
//设置自定义命令调用打印
if (iCmd == 600) {
mxOcx.RegistUserCustomCommand("00",111);
mxOcx.Focus();
}
else if (iCmd == 111) {
UserPrint();
}
function UserPrint() {
mxOcx.SendStringToExecute("Plot");
}点击按钮,向CAD控件注入自定义命令,在命令栏输入js中设置好的命令名称,就会弹出打开文件对话框。
if (iCmd == 601) {
mxOcx.RegistUserCustomCommand("22",222);
mxOcx.Focus();
}
else if (iCmd == 222) {
UserOpenDwg();
}function UserOpenDwg() {
mxOcx.SendStringToExecute("OpenDwg");
}