LEADTOOLS Windows Forms (Leadtools.WinForms assembly)
LEAD Technologies, Inc

Viewer Property (RasterImagePanViewer)

Example 





Gets or sets the viewer currently assigned for panning process by the control.
Syntax
public RasterImageViewer Viewer {get; set;}
'Declaration
 
Public Property Viewer As RasterImageViewer
'Usage
 
Dim instance As RasterImagePanViewer
Dim value As RasterImageViewer
 
instance.Viewer = value
 
value = instance.Viewer
public RasterImageViewer Viewer {get; set;}
 get_Viewer();
set_Viewer(value);
public:
property RasterImageViewer^ Viewer {
   RasterImageViewer^ get();
   void set (    RasterImageViewer^ value);
}

Property Value

The viewer object, which has an image to be pan using the RasterImagePanViewer control.
Remarks
This property contains the RasterImageViewer object which contains an image to be pan using the RasterImagePanViewer control. Whenever the Viewer property is changed, the image displayed in the RasterImagePanViewer control is updated.
Example
 
Private Class MyForm1 : Inherits Form
      Public panViewer As RasterImagePanViewer
      Public viewer As RasterImageViewer
      Public Sub New(ByVal title As String)
         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
         Dim codecs As RasterCodecs = 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()
         AddHandler panViewer.Pan, AddressOf 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()
      End Sub

      Private Sub panViewer_Pan(ByVal sender As Object, ByVal e As RasterImagePanViewerEventArgs)
         Select Case e.Status
            Case RasterImagePanViewerStatus.Begin, RasterImagePanViewerStatus.Panning, RasterImagePanViewerStatus.End
               Text = "Pan Status = " & e.Status.ToString() & " Rectangle =" & e.Rectangle.ToString() & " Cancel = " & e.Cancel.ToString()
               Console.WriteLine(Text)
               Exit Select
         End Select
      End Sub
   End Class

   Public Sub RasterImagePanViewer_Viewer()
      Dim form As MyForm1 = New MyForm1("Test_RasterImagePanViewer_Viewer")
      form.ShowDialog()
   End Sub

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
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:\Users\Public\Documents\LEADTOOLS Images";
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

RasterImagePanViewer Class
RasterImagePanViewer Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.