TractBar.ValueChanged
imports System
imports System.Drawing
imports System.Windows.Forms
public class TrackBars : inherits Form
dim htbar as TrackBar
dim vtbar as TrackBar
public sub New()
Size = new Size(500,520)
htbar = new TrackBar()
htbar.Parent = me
htbar.Orientation = Orientation.Horizontal
htbar.Size = new Size(200, 10)
htbar.Location = new Point(0, 25)
htbar.TickStyle = TickStyle.BottomRight
htbar.TickFrequency = 25
htbar.Minimum = 25
htbar.Maximum = 400
htbar.SmallChange = 10
htbar.LargeChange = 25
htbar.BackColor = Color.Yellow
htbar.Value = 100
AddHandler htbar.ValueChanged, AddressOf htbar_OnValueChanged
vtbar = new TrackBar()
vtbar.Parent = me
vtbar.Orientation = Orientation.Vertical
vtbar.Size = new Size(25, 300)
vtbar.Location = new Point(25, 25)
vtbar.TickStyle = TickStyle.BottomRight
vtbar.SetRange(25,400)
vtbar.SmallChange = 10
vtbar.LargeChange = 50
vtbar.TickFrequency = CInt(vtbar.Maximum / 20)
vtbar.BackColor = Color.Pink
vtbar.Value = 200
AddHandler vtbar.ValueChanged, AddressOf vtbar_OnValueChanged
end sub ' close for constructor
private sub htbar_OnValueChanged(ByVal sender as object, _
ByVal e as EventArgs)
Console.WriteLine(htbar.Value)
end sub
private sub vtbar_OnValueChanged(ByVal sender as object, _
ByVal e as EventArgs)
Console.WriteLine(vtbar.Value)
Console.WriteLine(vtbar.LargeChange)
end sub
public shared sub Main()
Application.Run(new TrackBars())
end sub
end class
Related examples in the same category