Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.5.10
|
Leadtools.WinForms Namespace > RasterImagePanViewer Class : ViewerChanged Event |
public event EventHandler ViewerChanged
'Declaration Public Event ViewerChanged As EventHandler
'Usage Dim instance As RasterImagePanViewer Dim handler As EventHandler AddHandler instance.ViewerChanged, handler
public: event EventHandler^ ViewerChanged
This example displays events when various properties of the RasterImagePanViewer changed
Imports Leadtools.WinForms Imports Leadtools Imports Leadtools.Codecs Public Sub RasterImagePanViewer_ViewerChanged(ByVal panViewer As RasterImagePanViewer) ' set up the event handlers AddHandler panViewer.RectangleColorChanged, AddressOf panViewer_RectColorChanged AddHandler panViewer.ImageColorChanged, AddressOf panViewer_ImageColorChanged AddHandler panViewer.ClipCursorChanged, AddressOf panViewer_ClipCursorChanged AddHandler panViewer.ViewerChanged, AddressOf panViewer_ViewerChanged Dim viewerOld As RasterImageViewer = panViewer.Viewer ' fires the ViewerChanged event twice panViewer.Viewer = Nothing panViewer.Viewer = viewerOld ' change some properties If panViewer.BorderStyle <> BorderStyle.None Then panViewer.BorderStyle = BorderStyle.None End If panViewer.RectangleColor = Color.Black panViewer.ImageColor = Color.Red panViewer.ClipCursor = False panViewer.Refresh() End Sub Private Sub panViewer_RectColorChanged(ByVal sender As Object, ByVal e As EventArgs) Dim panViewer As RasterImagePanViewer = CType(sender, RasterImagePanViewer) If Not panViewer Is Nothing Then Console.WriteLine("Rectangle Color Changed to " & panViewer.RectangleColor.ToString()) End If End Sub Private Sub panViewer_ImageColorChanged(ByVal sender As Object, ByVal e As EventArgs) Dim panViewer As RasterImagePanViewer = CType(sender, RasterImagePanViewer) If Not panViewer Is Nothing Then Console.WriteLine("Image Color Changed to " & panViewer.ImageColor.ToString()) End If End Sub Private Sub panViewer_ClipCursorChanged(ByVal sender As Object, ByVal e As EventArgs) Dim panViewer As RasterImagePanViewer = CType(sender, RasterImagePanViewer) If Not panViewer Is Nothing Then Console.WriteLine("Clip Cursor changed to " & panViewer.ClipCursor.ToString()) End If End Sub Private Sub panViewer_ViewerChanged(ByVal sender As Object, ByVal e As EventArgs) Dim panViewer As RasterImagePanViewer = CType(sender, RasterImagePanViewer) If Not panViewer Is Nothing Then If panViewer.Viewer Is Nothing Then Console.WriteLine("There is no Viewer control associated with the RasterImagePanViewer Control") Else Console.WriteLine("A Viewer is now associated with the RasterImagePanViewer Control") End If End If End Sub
using Leadtools.WinForms; using Leadtools; using Leadtools.Codecs; public void RasterImagePanViewer_ViewerChanged(RasterImagePanViewer panViewer) { // set up the event handlers panViewer.RectangleColorChanged += new EventHandler(panViewer_RectColorChanged); panViewer.ImageColorChanged += new EventHandler(panViewer_ImageColorChanged); panViewer.ClipCursorChanged += new EventHandler(panViewer_ClipCursorChanged); panViewer.ViewerChanged += new EventHandler(panViewer_ViewerChanged); RasterImageViewer viewerOld = panViewer.Viewer; // fires the ViewerChanged event twice panViewer.Viewer = null; panViewer.Viewer = viewerOld; // change some properties if(panViewer.BorderStyle != BorderStyle.None) { panViewer.BorderStyle = BorderStyle.None; } panViewer.RectangleColor = Color.Black; panViewer.ImageColor = Color.Red; panViewer.ClipCursor = false; panViewer.Refresh(); } private void panViewer_RectColorChanged(object sender, EventArgs e) { RasterImagePanViewer panViewer = (RasterImagePanViewer)sender; if (panViewer != null) Console.WriteLine("Rectangle Color Changed to " + panViewer.RectangleColor.ToString()); } private void panViewer_ImageColorChanged(object sender, EventArgs e) { RasterImagePanViewer panViewer = (RasterImagePanViewer)sender; if(panViewer != null) Console.WriteLine("Image Color Changed to " + panViewer.ImageColor.ToString()); } private void panViewer_ClipCursorChanged(object sender, EventArgs e) { RasterImagePanViewer panViewer = (RasterImagePanViewer)sender; if(panViewer != null) Console.WriteLine("Clip Cursor changed to " + panViewer.ClipCursor.ToString()); } private void panViewer_ViewerChanged(object sender, EventArgs e) { RasterImagePanViewer panViewer = (RasterImagePanViewer)sender; if(panViewer != null) { if(panViewer.Viewer == null) Console.WriteLine("There is no Viewer control associated with the RasterImagePanViewer Control"); else Console.WriteLine("A Viewer is now associated with the RasterImagePanViewer Control"); } }