本文介绍了创建鼠标事件参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码.在该代码中,我在突出显示的地方遇到了问题.在突出显示的代码'e'中.问题如下
"委托 TreeNodeAdvMouseEventArgs需要表达式或lambda表达式的地址作为其构造函数的唯一参数
"delegate TreeNodeAdvMouseEventArgs requires an address of expression or lambda expression as the only argument to its constructor
我声明了 TreeNodeAdvMouseEventArgs 作为公共委托子TreeNodeAdvMouseEventArgs(ByVal e作为MouseEventArgs)
I declare the TreeNodeAdvMouseEventArgs as Public Delegate Sub TreeNodeAdvMouseEventArgs(ByVal e As MouseEventArgs)
我无法解决此问题.请帮助我,并向我解释代码中我做错了什么.
i am not able solve this. please help me and explain me what i did wrong in the code.
Private Function CreateMouseArgs(ByVal e As MouseEventArgs) As TreeNodeAdvMouseEventArgs
Dim args As New TreeNodeAdvMouseEventArgs(e) With { _
.ViewLocation = New Point((e.X + Me.OffsetX), ((e.Y + Me._rowLayout.GetRowBounds(Me.FirstVisibleRow).Y) - Me.ColumnHeaderHeight)), _
.ModifierKeys = Control.ModifierKeys, _
.Node = Me.GetNodeAt(e.Location) _
}
Dim nodeControlInfoAt As NodeControlInfo = Me.GetNodeControlInfoAt(args.Node, e.Location)
args.ControlBounds = nodeControlInfoAt.Bounds
args.Control = nodeControlInfoAt.Control
Return args
End Function
推荐答案
VB不是C#,它会在后台自动创建委托.
VB is not C#, it has an automatic creation of delegates behind the scene.
这篇关于创建鼠标事件参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!