www.mxdraw.com
|
向控件注册一个命令,用户在命令行输入命令名这个字符串,就会触发执行命令事件 命令事件的id就是该注册时的id值。
static BOOL Mx_RegistUserCustomCommand(CString sCommandName, LONG lId);
参数 |
说明 |
CString sCommandName |
命令名称 |
LONG lId |
命令id. |
成功返回true;
例如: VB调用代码
Set param2 = New MxDrawXLib.MxDrawResbuf param2.AddString "testcommand", -10 param2.AddLong 55, -10 MxDrawX1.CallEx "Mx_RegistUserCustomCommand", param2 '或者 MxDrawX1.Call "Mx_RegistUserCustomCommand", "(""testcommand"",55)"
例如: C#调用代码
axMxDrawX1.Call("Mx_RegistUserCustomCommand", "("MyTest11",9999)"); axMxDrawX1.Focus(); // 命令 响应代码 private void axMxDrawX1_ImplementCommandEvent(object sender, AxMxDrawXLib._DMxDrawXEvents_ImplementCommandEventEvent e) { if (e.iCommandId == 9999) { MessageBox.Show("用户定义命令执行...."); } }