我正在使用Integration.elementhost,并在其中使用带有Image的画布(我使用opengl设备渲染到imagesource ...
我想现在处理互动的东西。 Mousemove,up und down正在工作。但是没有鼠标轮......在一个带有简单画布的原型中,它可以工作。但不是在我的主要应用中?!我需要一些特殊的鼠标轮事件吗?
这是我的代码:
public ViewControl(View theView)
{
itsZVis = theView.Vis;
itsView = theView;
itsViewCanvas = new ViewCanvas(theView);
Dock = System.Windows.Forms.DockStyle.Fill;
itsViewImage = new System.Windows.Controls.Image();
itsElementHost = new System.Windows.Forms.Integration.ElementHost();
Controls.Add(itsElementHost);
System.Windows.Controls.Canvas aBackgroundPanel = new System.Windows.Controls.Canvas();
itsElementHost.Child = aBackgroundPanel;
itsElementHost.Dock = DockStyle.Fill;
aBackgroundPanel.Children.Add(itsViewImage);
itsViewImage.MouseDown += itsViewImage_MouseDown;
itsViewImage.MouseUp += itsViewImage_MouseUp;
itsViewImage.MouseMove += itsViewImage_MouseMove;
itsViewImage.MouseWheel += itsViewImage_MouseWheel;
}
并通过遍历方法(由mousemove调用!)在创建图像后更改ImageSource:
// convert to bitmap
var Image = System.Windows.Media.Imaging.BitmapSource.Create(iWidth, iHeight, 96d, 96d, ImageFormat, null, ipRGB, iBuffer, iStride);
itsViewImage.Source = Image;