我遇到鼠标事件问题!ILNumerics鼠标事件
我订阅了事件MouseEnter和MouseLeave。 如果我的鼠标光标示例位于面板的中心,MouseEnter和MouseLeave事件触发,为什么?
我的目标是感知,从鼠标光标位于3D PlotCube上的时候开始,当不在时。
代码:
scene.MouseEnter += ILSurface_MouseEnter;
scene.MouseLeave += ILSurface_MouseLeave;
我遇到鼠标事件问题!ILNumerics鼠标事件
我订阅了事件MouseEnter和MouseLeave。 如果我的鼠标光标示例位于面板的中心,MouseEnter和MouseLeave事件触发,为什么?
我的目标是感知,从鼠标光标位于3D PlotCube上的时候开始,当不在时。
代码:
scene.MouseEnter += ILSurface_MouseEnter;
scene.MouseLeave += ILSurface_MouseLeave;
的曲线立方体捕捉事件的ScreenRect矩形的整个区域。在标准设置中,这个矩形被设置为(0,0,1,1),其填充整个面板。所以,除非在面板上有多个绘图立方体/相机,否则鼠标基本上总是在绘图立方体上。
为了显示MouseEnter和MouseLeave事件的功能,我会发布一个例子,它将在剧情立方体内作用于剧情。当鼠标输入图表时,它在窗体的标题栏中写入“On Plot”。只要鼠标离开绘图,就会写入“关闭绘图”。
开始与这里示出的新鲜面板和设置ILNumerics如:为了http://ilnumerics.net/visualization-api-quick-start-guide.html
将一个ILPanel到1并双击它切换到自动的代码生成ilPanel1_Load事件处理程序。用下面的代码替换处理:
private void ilPanel1_Load(object sender, EventArgs e) {
var surfPlot = new ILSurface(ILMath.tosingle(ILSpecialData.sincf(50, 40))) {
Colormap = Colormaps.Prism
};
var pc = ilPanel1.Scene.Add(new ILPlotCube(twoDMode: false) {
surfPlot
});
surfPlot.MouseEnter += (_s, _a) => {
if (!_a.DirectionUp)
Text = "On Plot - Target: " + _a.Target.ToString();
};
surfPlot.MouseLeave += (_s, _a) => {
if (!_a.DirectionUp)
Text = "Off Plot - Target: " + _a.Target.ToString();
};
}
这将产生类似于下面的图像的结果:
形式的标题现在反映,如果鼠标在情节或者不是。请注意,无论图形的旋转/形状如何,这都可以工作。 ILNumerics中有关鼠标事件处理的完整文档可以在这里找到:http://ilnumerics.net/mouse-events.html
你在说什么语言?我无法从您的问题中猜出 –
您是否阅读过文档? http://ilnumerics.net/mouse-events.html - 请发布最小(!但完整)的代码示例,并准确描述您期望的内容以及您的观点。谢谢! –