本文介绍了需要帮助-自定义画布无法生成鼠标事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我不明白为什么自定义画布无法生成鼠标事件.
我已经从Canvas继承了课程.并添加到XAML中.现在,iam无法为画布生成鼠标事件.
请帮助我现在如何为画布生成鼠标事件.
Xaml代码
Hello,
i cant understand why custom canvas is not generating mouse events.
i have inherited class from Canvas. and added in XAML . Now iam unable to generate mouse events for the canvas .
plz help me how to generate mouse events for canvas now.
Xaml Code
xmlns:local="clr-namespace:Editor1"
<local:Mycanvas
x:Name="Mycanvas"
Background="AliceBlue"
Grid.Column="1"
Grid.RowSpan="2"
Margin="-1.72235559148248E-09,30.8125,8,53.8125"
Width="auto"
Height="auto"
MouseLeftButtonDown="Mycanvas_MouseLeftButtonDown"
MouseMove="Mycanvas_MouseMove"
MouseLeftButtonUp="Mycanvas_MouseLeftButtonUp">
</local:Mycanvas>
帆布课
canvas class
public class Mycanvas:Canvas
{
// declarations
public Mycanvas()
{
// do something
}
}
尝试过不同的背景,但仍然无法正常工作?
哪里出问题了?
谢谢
tried with diiferent backgrounds but still not working?
where iam going wrong?
Thanks
推荐答案
这篇关于需要帮助-自定义画布无法生成鼠标事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!