我有一个RadPageView
控件,页面以垂直模式显示:
我想在向上滚动鼠标时自动选择上面的页面,在滚动鼠标时自动选择下面的页面。
怎么可能这样做?
这是VB.Net中的伪代码,但无论我是否能在C#中找到解决方案:
Private Sub RadPageView1_MouseWheel(sender As Object,e As MouseEventArgs) _
Handles RadPageView1.MouseWheel
Select Case e.Delta
Case Is > 0 ' MouseWhell scroll up.
If CurrentPageIndex > 0I Then
RadPageView1.SelectedPage = ... +1
End If
Case Else ' MouseWhell scroll down.
If CurrentPageIndex < Pages.Count Then
RadPageView1.SelectedPage = ... -1
End If
End Select
End Sub
答案 0 :(得分:0)
完成!
''' <summary>
''' Handles the MouseWheel event of the RadPageView_ActionNames control.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
Private Sub RadPageView_ActionNames_MouseWheel(sender As Object, e As MouseEventArgs) _
Handles RadPageView_ActionNames.MouseWheel
Dim ctrl As RadPageView = DirectCast(sender, RadPageView)
Dim PageIndex As Integer = ctrl.Pages.IndexOf(ctrl.SelectedPage)
Select Case e.Delta
Case Is > 0 ' MouseWhell scroll up.
If PageIndex > 0I Then
ctrl.SelectedPage = ctrl.Pages(PageIndex - 1)
End If
Case Else ' MouseWhell scroll down.
If Not PageIndex >= (ctrl.Pages.Count - 1) Then
ctrl.SelectedPage = ctrl.Pages(PageIndex + 1)
End If
End Select
End Sub