Gets and sets the viewer currently assigned for panning process by the control.
Syntax
Return Value
The viewer object, which has an image to be pan using the
RasterImagePanViewer control.
Example
This example shows how to use a pan window with a RasterImageViewer
Visual Basic | Copy Code |
---|
Private Class MyForm1 : Inherits Form
Public panViewer As RasterImagePanViewer
Public viewer As RasterImageViewer
Public Sub New(ByVal title As String)
Text = title
Size = New Size(400, 400)
viewer = New RasterImageViewer()
viewer.Size = New Size(Size.Width, Size.Height \ 2)
viewer.Dock = DockStyle.Fill
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
viewer.Image = codecs.Load("C:\program files\LEAD Technologies\LEADTOOLS 15\Images\image1.cmp")
RasterCodecs.Shutdown()
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 |
C# | Copy Code |
---|
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.Startup(); RasterCodecs codecs = new RasterCodecs(); viewer.Image = codecs.Load(@"C:\program files\LEAD Technologies\LEADTOOLS 15\Images\image1.cmp"); RasterCodecs.Shutdown(); 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(); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also