[英]Vb.net equivalent of C#
What is the equivalent vb.net code of the corresponding MouseDown event shown below (C#)? 下面显示的相应MouseDown事件的等效vb.net代码是什么(C#)? How should I implement this event in vb.net? 我应该如何在vb.net中实现此事件?
Thank you in advance, Goicox 预先感谢您,Goicox
var model = new PlotModel("MouseDown HitTestResult", "Reports the index of the nearest point.");
var s1 = new LineSeries();
s1.Points.Add(new DataPoint(0, 10));
s1.Points.Add(new DataPoint(10, 40));
s1.Points.Add(new DataPoint(40, 20));
s1.Points.Add(new DataPoint(60, 30));
model.Series.Add(s1);
s1.MouseDown += (s, e) =>
{
model.Subtitle = "Index of nearest point in LineSeries: " + Math.Round(e.HitTestResult.Index);
model.InvalidatePlot(false);
};
Simple convertion should do it : 简单的转换应该做到这一点:
Dim model = New PlotModel("MouseDown HitTestResult", "Reports the index of the nearest point.")
Dim s1 = New LineSeries()
s1.Points.Add(New DataPoint(0, 10))
s1.Points.Add(New DataPoint(10, 40))
s1.Points.Add(New DataPoint(40, 20))
s1.Points.Add(New DataPoint(60, 30))
model.Series.Add(s1)
s1.MouseDown += Function(s, e)
model.Subtitle = "Index of nearest point in LineSeries: " & Math.Round(e.HitTestResult.Index)
model.InvalidatePlot(False)
End Function
Sources : http://www.developerfusion.com/tools/convert/csharp-to-vb/ 资料来源: http : //www.developerfusion.com/tools/convert/csharp-to-vb/
You'll need to use a VB 'Sub' lambda (available in VS 2010 and beyond): 您需要使用VB'Sub'lambda(在VS 2010及更高版本中可用):
AddHandler s1.MouseDown, Sub(s, e)
model.Subtitle = "Index of nearest point in LineSeries: " & Math.Round(e.HitTestResult.Index)
model.InvalidatePlot(False)
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.