欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

silverlight 5开发【vb版】(3)-简单鼠标事件处理

程序员文章站 2022-03-02 11:47:06
...


silverlight 5开发【vb版】(3)-简单鼠标事件处理
            
    
    博客分类: .net&silverlight  
 代码如下:

 

Partial Public Class MainPage
    Inherits UserControl
    Private currentlocation As Point
    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
        Label1.Content = "您好," & TextBox1.Text & "!"
    End Sub

    Private Sub LayoutRoot_MouseMove(sender As System.Object, e As System.Windows.Input.MouseEventArgs) Handles LayoutRoot.MouseMove
        currentlocation = e.GetPosition(LayoutRoot)
        Label2.Content = "现在鼠标的坐标是:(" & currentlocation.X.ToString() & "," & currentlocation.Y.ToString() & ")"
    End Sub
End Class

 

移动发生在MouseMove事件中,而单击发生在Button1_Click中,click事件只适用于button控件

  • silverlight 5开发【vb版】(3)-简单鼠标事件处理
            
    
    博客分类: .net&silverlight  
  • 大小: 22.2 KB