RasterImagePanViewer Class

Summary

Represents a Leadtools RasterImagePanViewer control for displaying a scaled view of an image.

Syntax

C#
C++/CLI
C++
[ToolboxItemAttribute(false)] 
public class RasterImagePanViewer : UserControl 
[ToolboxItemAttribute(ToolboxItemType=, ToolboxItemTypeName="")] 
public ref class RasterImagePanViewer : public System.Windows.Forms.UserControl, System.ComponentModel.IComponent, System.ComponentModel.ISynchronizeInvoke, System.IDisposable, System.Windows.Forms.IBindableComponent, System.Windows.Forms.IContainerControl, System.Windows.Forms.IDropTarget, System.Windows.Forms.IWin32Window   
public: 
   [ToolboxItemAttribute(false)] 
   ref class RasterImagePanViewer : UserControl 

Remarks

The RasterImagePanViewer is used to display a scaled view of an image, which is also being displayed in the RasterImageViewer control at a size that would require scrolling. The RasterImagePanViewer will maintain the images aspect ratio. In the RasterImagePanViewer, a colored Pan rect will be displayed to indicate the portion of the image currently being displayed in the RasterImageViewer associated with this PanViewer control. When a user clicks inside the RasterImagePanViewer and moves the mouse, while holding down the button, the Pan rect will move with the mouse pointer. Set the Viewer property to a RasterImageViewer object to be panned.

Example

C#
using Leadtools.WinForms; 
using Leadtools; 
using Leadtools.Codecs; 
 
class MyForm1 : Form 
{ 
   public RasterImagePanViewer panViewer; 
   public RasterImageViewer viewer; 
   public MyForm1(string title) 
   { 
      Text = title; 
 
      // Set the size of the form 
      Size = new Size(400, 400); 
 
      // Create the viewer 
      viewer = new RasterImageViewer(); 
      viewer.Size = new Size(Size.Width, Size.Height / 2); 
      viewer.Dock = DockStyle.Fill; 
 
      // Load an image 
      RasterCodecs codecs = new RasterCodecs(); 
      viewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "image1.cmp")); 
 
      panViewer = new RasterImagePanViewer(); 
      panViewer.Dock = DockStyle.Top; 
      panViewer.BackColor = Color.Bisque; 
      panViewer.ClipCursor = true; 
      panViewer.BorderStyle = BorderStyle.Fixed3D; 
      panViewer.BringToFront(); 
      panViewer.Pan += new EventHandler<RasterImagePanViewerEventArgs>(panViewer_Pan); 
      panViewer.RectangleColor = Color.Blue; 
      panViewer.ImageColor = Color.FromArgb(128, 0, 0, 0); 
      panViewer.Cursor = Cursors.Hand; 
      panViewer.Viewer = viewer; 
 
      Controls.Add(panViewer); 
      Controls.Add(viewer); 
      viewer.BringToFront(); 
   } 
 
   private void panViewer_Pan(object sender, RasterImagePanViewerEventArgs e) 
   { 
      switch (e.Status) 
      { 
         case RasterImagePanViewerStatus.Begin: 
         case RasterImagePanViewerStatus.Panning: 
         case RasterImagePanViewerStatus.End: 
            { 
               Text = "Pan Status = " + e.Status.ToString() + " Rectangle =" + e.Rectangle.ToString() + " Cancel = " + e.Cancel.ToString(); 
               Console.WriteLine(Text); 
               break; 
            } 
      } 
   } 
} 
 
public void RasterImagePanViewer_Viewer() 
{ 
   MyForm1 form = new MyForm1("Test_RasterImagePanViewer_Viewer"); 
   form.ShowDialog(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 

Requirements

Target Platforms

See Also

Reference

RasterImagePanViewer Members

Leadtools.WinForms Namespace

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.