0
我有,我用下面的代码代替鼠标光标与csuomt Silverlight应用程序:Silverlight的鼠标事件停止工作,如果自定义光标使用
用户控件:CustomC.xaml
<UserControl...>
<Canvas>
<Image x:Name="EGCursor" Visibility="Collapsed"></Image>
</Canvas>
</UserControl>
用户控件:CustomC.xaml.cs
public void SetSource(string resource)
{
EGCursor.Source = new BitmapImage(new Uri(resource, UriKind.Relative));
EGCursor.Stretch = Stretch.None;
}
public void MoveTo(Point pt)
{
EGCursor.Visibility = Visibility.Visible;
EGCursor.SetValue(Canvas.LeftProperty, pt.X - 13);
MyCursor.SetValue(Canvas.TopProperty, pt.Y - 12);
}
个MainWindow.xaml
<UserControl x:Class="SL.MainPage"... Cursor="None">
...
</UserControl>
MainWindow.xaml.cs
MainWindow()
{
CustomC = new CustomC();
CustomC.SetSource("GlowingCur.png");
LayoutRoot.Children.Add(CustomC);
}
void MainPage_MouseMove(object sender, MouseEventArgs e)
{
CustomC.MoveTo(e.GetPosition(null));
}
在做好上面的自定义光标,在我的Silverlight MouseLeave
,MouseClick
等点击事件的所有停止工作。我该如何纠正这种行为,以便只更换鼠标光标,并且其他已经编码的事件工作相同?