基本上是按QTP的帮助文档描述,以及它提供的一个小例子来写的。如果完全按其在NETExtensibility.chm文件中的“Example of a Control Definition XML File”这一节的例子来写则完全不能进行录制方面的扩展,它的例子如下:
<?xml version="1.0" encoding="UTF-8"?>
<Customization>
<Record>
<Events>
<Event name="MouseUp" enabled="true">
<RecordedCommand name="SetValue">
<Parameter>
Sender.Value
</Parameter>
<Parameter lang="C#">
String xy;
xy = EventArgs.X + ";" + EventArgs.Y;
Parameter = xy;
</Parameter>
</RecordedCommand>
</Event>
</Events>
</Record>
<Replay>
<Methods>
<Method name="SetValue">
<Parameters>
<Parameter type="int" name="Value"/>
<Parameter type="String" name="MousePosition"/>
</Parameters>
<MethodBody>
RtObject.Value = Value;
System.Windows.Forms.MessageBox.Show(MousePosition,"Mouse Position at Record Time");
</MethodBody>
</Method>
</Methods>
</Replay>
</Customization>