0
我想在窗體中使用畫布,並縮放和平移那個畫布,首先我把元素主機,然後把畫布放在裏面,然後把畫框放在畫布上,然後試圖放大帆布我嘗試了各種方法,但不執行任何控制的情況下我也寫所有的鼠標滾輪事件,但沒有人執行,所以請給我建議的解決方案下面是我添加控件和鼠標滾輪事件代碼鼠標滾輪事件沒有得到執行
elementHost1.Height = picVarify.Height;
elementHost1.Width = picVarify.Width;
elementHost1.Location = picVarify.Location;
touchcanvas = new System.Windows.Controls.Canvas();
WindowsFormsHost hst = new WindowsFormsHost();
hst.Name = "Host";
hst.Child = picVarify;
hst.Height = picVarify.Height;
hst.Width = picVarify.Width;
touchcanvas.Height = picVarify.Height;
touchcanvas.Width = picVarify.Width;
touchcanvas.Children.Add(hst);
zm = new ZoomAndPan.ZoomAndPanControl();
zm.Name = "zm";
zm.Content = touchcanvas;
zm.MouseWheel += new System.Windows.Input.MouseWheelEventHandler(zoomAndPanControl_MouseWheel);
elementHost1.Child = zm;
touchcanvas.MouseWheel += new System.Windows.Input.MouseWheelEventHandler(touchcanvas_MouseWheel);
hst.MouseWheel += new System.Windows.Input.MouseWheelEventHandler(hst_MouseWheel);
picVarify.MouseWheel += new MouseEventHandler(picverify_MouseWheel);
用於在畫布上,你將不得不設置其背景屬性試試這個背景= Brushes.Transparent射擊鼠標滾輪事件;並讓我知道它是否工作? –
仍然沒有開火 – user3269550