Gets or sets the minimum size for the auto-scroll region.
public virtual Size AutoScrollMinSize { get; }
public:
virtual property Size AutoScrollMinSize {
Size get();
}
public:
virtual property Size^ AutoScrollMinSize
{
Size^ get()
}
The minimum size of the area that can be scrolled if scrollbars are shown.
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:\LEADTOOLS22\Resources\Images";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document