HScroll Property

Summary

Gets a value indicating whether the horizontal scroll bar is visible.

Syntax

C#
C++/CLI
C++
public bool HScroll { get; } 
[BrowsableAttribute(false)] 
public: 
property bool HScroll { 
   bool get(); 
} 
public:  
   property bool HScroll 
   { 
      bool get() 
   } 

Property Value

true if the horizontal scroll bar is visible; false otherwise.

Example

C#
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"; 
} 

Requirements

Target Platforms

See Also

Reference

RasterImageViewer Class

RasterImageViewer Members

Help Version 22.0.2023.2.9
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.WinForms Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.