Get HScrollBar Value : ScrollBar « GUI « VB.Net






Get HScrollBar Value

Get HScrollBar Value
Imports System
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Text
Imports System.Drawing.Imaging

Public Class MainClass

  Shared Sub Main()
     Dim form1 As Form1 = new Form1
     Application.Run(form1)
  End Sub
  
End Class




Public Class Form1
  Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

  Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    AlphaScroll.Minimum = 20
    AlphaScroll.Maximum = 245
    AlphaScroll.SmallChange = 5
    AlphaScroll.LargeChange = 5

    GammaScroll.Minimum = 1
    GammaScroll.Maximum = 50
    GammaScroll.SmallChange = 1
    GammaScroll.LargeChange = 5


  End Sub

  Friend WithEvents GammaScroll As System.Windows.Forms.HScrollBar
  Friend WithEvents AlphaScroll As System.Windows.Forms.HScrollBar

  'Required by the Windows Form Designer
  Private components As System.ComponentModel.IContainer

  'NOTE: The following procedure is required by the Windows Form Designer
  'It can be modified using the Windows Form Designer.  
  'Do not modify it using the code editor.
  <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.GammaScroll = New System.Windows.Forms.HScrollBar()
    Me.AlphaScroll = New System.Windows.Forms.HScrollBar()
    Me.SuspendLayout()
    '
    'GammaScroll
    '
    Me.GammaScroll.Location = New System.Drawing.Point(32, 24)
    Me.GammaScroll.Name = "GammaScroll"
    Me.GammaScroll.Size = New System.Drawing.Size(96, 16)
    Me.GammaScroll.TabIndex = 0
    '
    'AlphaScroll
    '
    Me.AlphaScroll.Location = New System.Drawing.Point(32, 136)
    Me.AlphaScroll.Name = "AlphaScroll"
    Me.AlphaScroll.Size = New System.Drawing.Size(96, 16)
    Me.AlphaScroll.TabIndex = 1
    '
    'Form1
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(292, 273)
    Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.AlphaScroll, Me.GammaScroll})
    Me.Name = "Form1"
    Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
    Me.Text = "Form1"
    Me.ResumeLayout(False)

  End Sub

#End Region


  Private Sub Form1_Load(ByVal sender As System.Object, _
                         ByVal e As System.EventArgs) _
                         Handles MyBase.Load

  End Sub

  Private Sub GammaScroll_Scroll(ByVal sender As System.Object, _
                          ByVal e As System.Windows.Forms.ScrollEventArgs) _
                          Handles GammaScroll.Scroll
    
    Console.WriteLine( CType(GammaScroll.Value / 10, Single) )

  End Sub

  Private Sub AlphaScroll_Scroll(ByVal sender As System.Object, _
                          ByVal e As System.Windows.Forms.ScrollEventArgs) _
                          Handles AlphaScroll.Scroll
    Console.WriteLine( AlphaScroll.Value )

  End Sub
End Class

           
       








Related examples in the same category

1.Get Value from Vertical Scroll BarGet Value from Vertical Scroll Bar
2.Use Scroll Bar to set rotate, X position and repaintUse Scroll Bar to set rotate, X position and repaint
3.ScrollBar Demo: get valueScrollBar Demo: get value