Gets or sets the amount that the scroll bar is incremented or decremented for a small scroll.
Syntax
Visual Basic (Declaration) | |
---|
<BrowsableAttribute(False)>
Public Overridable ReadOnly Property AutoScrollSmallChange As Size |
Visual Basic (Usage) | Copy Code |
---|
Dim instance As RasterImageViewer
Dim value As Size
value = instance.AutoScrollSmallChange
|
Managed Extensions for C++ | |
---|
[BrowsableAttribute(false)]
public: __property virtual Size get_AutoScrollSmallChange(); |
Return Value
The amount that the scroll bar is incremented or decremented.
Example
This example hides the RasterImageViewer control scroll bars
and creates two custom scrollbars.
Visual Basic | Copy Code |
---|
Private Class MyForm3 : Inherits Form
Public viewer As RasterImageViewer
Private panel As Panel
Private myHScroll As HScrollBar
Private myVScroll As VScrollBar
Public Sub New(ByVal title As String)
Text = title
Me.Size = New Size(750, 450)
panel = New Panel()
panel.Dock = DockStyle.Fill
Controls.Add(panel)
viewer = New RasterImageViewer()
viewer.Dock = DockStyle.Fill
viewer.Width = 500
viewer.DoubleBuffer = True
panel.Controls.Add(viewer)
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
viewer.Image = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Sample1.cmp")
codecs.Dispose()
RasterCodecs.Shutdown()
viewer.AutoScroll = False
Dim size As Size = viewer.AutoScrollMinSize
myHScroll = New HScrollBar()
myHScroll.Location = New Point(100, 50)
myHScroll.Dock = DockStyle.Top
myHScroll.Height *= 2
myHScroll.Minimum = 0
myHScroll.Maximum = viewer.Image.Width
AddHandler myHScroll.ValueChanged, AddressOf hScroll_ValueChanged
panel.Controls.Add(myHScroll)
myHScroll.BringToFront()
myVScroll = New VScrollBar()
myVScroll.Dock = DockStyle.Left
myVScroll.Location = New Point(100, 100)
myVScroll.Width *= 2
myVScroll.Minimum = 0
myVScroll.Maximum = viewer.Image.Height
AddHandler myVScroll.ValueChanged, AddressOf vScroll_ValueChanged
panel.Controls.Add(myVScroll)
myVScroll.BringToFront()
viewer.BringToFront()
OnSizeChanged(EventArgs.Empty)
End Sub
Private Sub vScroll_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
viewer.ScrollPosition = New Point(myHScroll.Value, myVScroll.Value)
End Sub
Private Sub hScroll_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
viewer.ScrollPosition = New Point(myHScroll.Value, myVScroll.Value)
End Sub
Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
If (Not myHScroll Is Nothing) AndAlso (Not myVScroll Is Nothing) Then
myHScroll.SmallChange = viewer.AutoScrollSmallChange.Width
myHScroll.LargeChange = viewer.AutoScrollLargeChange.Width
myVScroll.SmallChange = viewer.AutoScrollSmallChange.Height
myVScroll.LargeChange = viewer.AutoScrollLargeChange.Height
Console.WriteLine("AutoScrollSmallChange {0}", viewer.AutoScrollSmallChange)
Console.WriteLine("AutoScrollLargeChange {0}", viewer.AutoScrollLargeChange)
Console.WriteLine("AutoScrollMinSize {0}", viewer.AutoScrollMinSize)
Console.WriteLine("SmallScrollChangeRatio {0}", viewer.SmallScrollChangeRatio)
Console.WriteLine("HScroll {0}", viewer.HScroll)
Console.WriteLine("VScroll {0}", viewer.VScroll)
Console.WriteLine("")
myHScroll.Enabled = viewer.HScroll
myVScroll.Enabled = viewer.VScroll
End If
MyBase.OnSizeChanged(e)
End Sub
End Class
Public Sub RasterImageViewer_HScroll(ByVal title As String)
Dim form As MyForm3 = New MyForm3(title)
form.ShowDialog()
End Sub |
C# | Copy Code |
---|
class MyForm3 : Form { public RasterImageViewer viewer; Panel panel; HScrollBar hScroll; VScrollBar vScroll; public MyForm3(string title) { Text = title; Size = new Size(750, 450); panel = new Panel(); panel.Dock = DockStyle.Fill; Controls.Add(panel); // Create the raster viewer viewer = new RasterImageViewer(); viewer.Dock = DockStyle.Fill; viewer.Width = 500; viewer.DoubleBuffer = true; panel.Controls.Add(viewer); // Load an image into the viewer RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); viewer.Image = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Sample1.cmp"); codecs.Dispose(); RasterCodecs.Shutdown(); viewer.AutoScroll = false; Size size = viewer.AutoScrollMinSize; // Create two scrollbar controls for scrolling hScroll = new HScrollBar(); hScroll.Location = new Point(100, 50); hScroll.Dock = DockStyle.Top; hScroll.Height *= 2; hScroll.Minimum = 0; hScroll.Maximum = viewer.Image.Width; hScroll.ValueChanged += new EventHandler(hScroll_ValueChanged); panel.Controls.Add(hScroll); hScroll.BringToFront(); vScroll = new VScrollBar(); vScroll.Dock = DockStyle.Left; vScroll.Location = new Point(100, 100); vScroll.Width *= 2; vScroll.Minimum = 0; vScroll.Maximum = viewer.Image.Height; vScroll.ValueChanged += new EventHandler(vScroll_ValueChanged); panel.Controls.Add(vScroll); vScroll.BringToFront(); viewer.BringToFront(); OnSizeChanged(EventArgs.Empty); } void vScroll_ValueChanged(object sender, EventArgs e) { viewer.ScrollPosition = new Point(hScroll.Value, vScroll.Value); } void hScroll_ValueChanged(object sender, EventArgs e) { viewer.ScrollPosition = new Point(hScroll.Value, vScroll.Value); } protected override void OnSizeChanged(EventArgs e) { if((hScroll != null) && (vScroll != null)) { hScroll.SmallChange = viewer.AutoScrollSmallChange.Width; hScroll.LargeChange = viewer.AutoScrollLargeChange.Width; vScroll.SmallChange = viewer.AutoScrollSmallChange.Height; vScroll.LargeChange = viewer.AutoScrollLargeChange.Height; Console.WriteLine("AutoScrollSmallChange {0}", viewer.AutoScrollSmallChange); Console.WriteLine("AutoScrollLargeChange {0}", viewer.AutoScrollLargeChange); Console.WriteLine("AutoScrollMinSize {0}", viewer.AutoScrollMinSize); Console.WriteLine("SmallScrollChangeRatio {0}", viewer.SmallScrollChangeRatio); Console.WriteLine("HScroll {0}", viewer.HScroll); Console.WriteLine("VScroll {0}", viewer.VScroll); Console.WriteLine(""); hScroll.Enabled = viewer.HScroll; vScroll.Enabled = viewer.VScroll; } base.OnSizeChanged(e); } } public void RasterImageViewer_HScroll(string title) { MyForm3 form = new MyForm3(title); form.ShowDialog(); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also