`
deepfuture
  • 浏览: 4400412 次
  • 性别: Icon_minigender_1
  • 来自: 湛江
博客专栏
073ec2a9-85b7-3ebf-a3bb-c6361e6c6f64
SQLite源码剖析
浏览量:80076
1591c4b8-62f1-3d3e-9551-25c77465da96
WIN32汇编语言学习应用...
浏览量:70040
F5390db6-59dd-338f-ba18-4e93943ff06a
神奇的perl
浏览量:103353
Dac44363-8a80-3836-99aa-f7b7780fa6e2
lucene等搜索引擎解析...
浏览量:285809
Ec49a563-4109-3c69-9c83-8f6d068ba113
深入lucene3.5源码...
浏览量:15012
9b99bfc2-19c2-3346-9100-7f8879c731ce
VB.NET并行与分布式编...
浏览量:67560
B1db2af3-06b3-35bb-ac08-59ff2d1324b4
silverlight 5...
浏览量:32151
4a56b548-ab3d-35af-a984-e0781d142c23
算法下午茶系列
浏览量:45988
社区版块
存档分类
最新评论

silverlight 5开发【vb版】(6)-鼠标滚轮事件

 
阅读更多
        If e.Delta > 0 Then
            Label3.Content = Label3.Content + 1
        Else
            Label3.Content = Label3.Content - 1
        End If

 e.Delta > 0表示向上滚,否则为向下滚

 

接上节,完整代码如下:

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

    Private Sub LayoutRoot_MouseLeftButtonDown(sender As System.Object, e As System.Windows.Input.MouseButtonEventArgs) Handles LayoutRoot.MouseLeftButtonDown
        MessageBox.Show("您按了左键")
    End Sub

    Private Sub LayoutRoot_MouseRightButtonDown(sender As System.Object, e As System.Windows.Input.MouseButtonEventArgs) Handles LayoutRoot.MouseRightButtonDown
        MessageBox.Show("您按了右键")
    End Sub

    Private Sub Label3_MouseWheel(sender As System.Object, e As System.Windows.Input.MouseWheelEventArgs) Handles Label3.MouseWheel
        If e.Delta > 0 Then
            Label3.Content = Label3.Content + 1
        Else
            Label3.Content = Label3.Content - 1
        End If

    End Sub
End Class

 截图如下:



 当鼠标滚轮在label控件中活动时,事件发生,这里的例子是使label控件中的值变大或变小

整个工程代码见附件

 

  • 大小: 20.8 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics