关于应用DLL中事件的方法,在VB中可用,在C#中怎样触发事件?
‘VB代码
Option Explicit
Implements IXDictGrabSink //引用DLL中的方法
Private gp As GrabProxy //DLL中的属性
Private Sub Form_Load()
Set gp = New GrabProxy
With gp
.GrabEnabled = True
.GrabInterval = 30
.GrabMode = XDictGrabMouse
.AdviseGrab Me ’激活事件,不知在C#中怎样使用
End With
End Sub
Private Function IXDictGrabSink_QueryWord(ByVal WordString As String, ByVal lCursorX As Long, ByVal lCursorY As Long, ByVal SentenceString As String, lLoc As Long, lStart As Long) As Long
Label1.Caption = SentenceString
End Function
现在要用C#来完成上诉代码,关键是在
gp.AdviseGrab Me
在C#中怎样用?
请指点!谢谢!
------解决方案--------------------gp.AdviseGrab(this);
------解决方案--------------------孟子的正解。Vb.NET里的Me在C#中用this来表示。
------解决方案--------------------gp.AdviseGrab(this);
------解决方案--------------------public partial class Form1 : Form, XDICTGRB.IXDictGrabSink
{
public void QueryWord(string, int, int, string, ref int, ref int)
{}
------解决方案--------------------XDICTGRB.IXDictGrabSink这是个接口,该接口的这个方法QueryWord(string, int, int, string, ref int, ref int)你没有实现,接口中的方法必须要实现的,那怕是空实现