关于事件与委托的关联
下面c#的代码,请高手改成vb的public delegate bool DoMouseMove(int X, int Y);
private event DoMouseMove MouseMove;
这是我改的代码,不过提示如下:错误 25 事件不能用具有返回类型的委托类型声明。 Public Delegate Function DoMouseMove(ByVal X As Integer, ByVal Y As Integer) As Boolean
Private Event MouseMove As DoMouseMove
我在构造函数要调用的api函数 Public Declare Auto Function SetCursorPos Lib "user32.dll " (ByVal X As Integer, ByVal Y As Integer) As Boolean
Public Sub New()
AddHandler MouseButton, AddressOf Api.mouse_event
AddHandler MouseMove, AddressOf Api.SetCursorPos
End Sub --------------------编程问答-------------------- 很明显,你的DoMouseMove不能返回bool,而应该是void
--------------------编程问答-------------------- 不返回bool,我不就不能调用api函数了吗? --------------------编程问答--------------------
public delegate void DoMouseMove(int X,int Y);--------------------编程问答-------------------- 不行呀,同样不能调用那个api函数了。
private event DoMouseMove MouseMove;
--------------------编程问答-------------------- 声明事件的委托类型是不能有返回值的。 --------------------编程问答-------------------- 我现在也知道,现在就是问怎样改? --------------------编程问答-------------------- 接分先!
补充:.NET技术 , .NET技术前瞻