Silverlight 窗口加载后检测鼠标位置
我正在运行一个网页,其中有一个 SL“框”。
我知道如何使用 MouseEnter 和 MouseLeave 来检测鼠标是否已进入 SL 框或离开它。
我的问题是,当鼠标刚刚加载时,如何检测鼠标是在 SL 盒内部还是外部。
谢谢。
吉拉德.
I'm running a web page that has a SL 'box' in it.
I know how to use the MouseEnter and MouseLeave to detect if the mouse has entered the SL box or left it.
My question is how to detect if the mouse is inside or outside the SL box when it has just loaded.
Thanks.
Gilad.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是构建 Silverlight 应用程序的分步帖子,该应用程序在实例化时检测鼠标是否位于 Silverlight 控件上方。
第 1 步:使用 Visual Studio 创建示例 Silverlight 应用程序(文件/新建项目/Silverlight 应用程序)
第 2 步:编辑 MainPage.xaml,并将以下代码放入UserControl 的网格:
第 3 步:编辑 MainPage.cs,并用以下代码替换 MainPage 类:
第 4 步:构建并运行!尝试将鼠标悬停在 Silverlight 控件的中心和控件外部以查看结果!
Here is a step-by-step post for building a Silverlight app that detects whether the mouse is over the Silverlight control when it is instantiated.
Step 1: Create a sample Silverlight application with Visual Studio (File / New Project / Silverlight Application)
Step 2: Edit the MainPage.xaml, and place the following code inside the UserControl's Grid:
Step 3: Edit the MainPage.cs, and replace the MainPage class with the following code:
Step 4: Build and Run! Try it with the mouse over the center of the Silverlight control and outside of the control to see the results!