LEADTOOLS Windows Forms (Leadtools.WinForms assembly)

AutoScrollSmallChange Property

Show in webframe
Example 





Gets or sets the amount that the scroll bar is incremented or decremented for a small scroll.
Syntax
[BrowsableAttribute(false)]
public virtual Size AutoScrollSmallChange {get;}
'Declaration
 
<BrowsableAttribute(False)>
Public Overridable ReadOnly Property AutoScrollSmallChange As Size
'Usage
 
Dim instance As RasterImageViewer
Dim value As Size
 
value = instance.AutoScrollSmallChange

            

            
[BrowsableAttribute(false)]
public:
virtual property Size AutoScrollSmallChange {
   Size get();
}

Property Value

The amount that the scroll bar is incremented or decremented.
Remarks
A small scroll (or a line scroll) occurs when the user clicks an arrow.
Example
Copy Code  
Imports Leadtools.WinForms
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.Drawing

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)

      ' 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
      Dim codecs As RasterCodecs = New RasterCodecs()
      viewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Sample1.cmp"))
      codecs.Dispose()

      viewer.AutoScroll = False
      Dim size As Size = viewer.AutoScrollMinSize

      ' Create two scrollbar controls for scrolling

      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

Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools.WinForms;
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Color;
using Leadtools.Drawing;

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 codecs = new RasterCodecs();
      viewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Sample1.cmp"));
      codecs.Dispose();

      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();
}

static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Requirements

Target Platforms

See Also

Reference

RasterImageViewer Class
RasterImageViewer Members

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.