本文整理汇总了VB.NET中System.Windows.Forms.TrackBar.TickStyle属性的典型用法代码示例。如果您正苦于以下问题:VB.NET TrackBar.TickStyle属性的具体用法?VB.NET TrackBar.TickStyle怎么用?VB.NET TrackBar.TickStyle使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Windows.Forms.TrackBar
的用法示例。
在下文中一共展示了TrackBar.TickStyle属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: InitializeTrackBar
'Declare a new TrackBar object.
Friend WithEvents TrackBar1 As System.Windows.Forms.TrackBar
' Initalize the TrackBar and add it to the form.
Private Sub InitializeTrackBar()
Me.TrackBar1 = New System.Windows.Forms.TrackBar
' Set the TickStyle property so there are ticks on both sides
' of the TrackBar.
TrackBar1.TickStyle = TickStyle.Both
' Set the minimum and maximum number of ticks.
TrackBar1.Minimum = 10
TrackBar1.Maximum = 100
' Set the tick frequency to one tick every ten units.
TrackBar1.TickFrequency = 10
TrackBar1.Location = New System.Drawing.Point(75, 30)
Me.Controls.Add(Me.TrackBar1)
End Sub
' Handle the TrackBar.ValueChanged event by calculating a value for
' TextBox1 based on the TrackBar value.
Private Sub TrackBar1_ValueChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles TrackBar1.ValueChanged
TextBox1.Text = System.Math.Round(TrackBar1.Value / 10)
End Sub
示例2: New
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