本文整理汇总了VB.NET中System.Windows.Forms.ScrollBar.Value属性的典型用法代码示例。如果您正苦于以下问题:VB.NET ScrollBar.Value属性的具体用法?VB.NET ScrollBar.Value怎么用?VB.NET ScrollBar.Value使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Windows.Forms.ScrollBar
的用法示例。
在下文中一共展示了ScrollBar.Value属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: HandleScroll
Private Sub HandleScroll(ByVal sender As [Object], ByVal e As ScrollEventArgs) _
Handles vScrollBar1.Scroll, hScrollBar1.Scroll
'Create a graphics object and draw a portion of the image in the PictureBox.
Dim g As Graphics = pictureBox1.CreateGraphics()
Dim xWidth As Integer = pictureBox1.Width
Dim yHeight As Integer = pictureBox1.Height
Dim x As Integer
Dim y As Integer
If (e.ScrollOrientation = ScrollOrientation.HorizontalScroll) Then
x = e.NewValue
y = vScrollBar1.Value
Else 'e.ScrollOrientation == ScrollOrientation.VerticalScroll
y = e.NewValue
x = hScrollBar1.Value
End If
'First Rectangle: Where to draw the image.
'Second Rectangle: The portion of the image to draw.
g.DrawImage(pictureBox1.Image, _
New Rectangle(0, 0, xWidth, yHeight), _
New Rectangle(x, y, xWidth, yHeight), _
GraphicsUnit.Pixel)
pictureBox1.Update()
End Sub