Raises the SourceChanged event.
protected virtual void OnSourceChanged(
RoutedPropertyChangedEventArgs<ImageSource> e
)
Protected Overridable Sub OnSourceChanged( _
ByVal e As RoutedPropertyChangedEventArgs(Of ImageSource) _
)
protected:
virtual void OnSourceChanged(
RoutedPropertyChangedEventArgs<ImageSource^>^ e
)
e
A RoutedPropertyChangedEventArgs that contains the event data.
Raising an event invokes the event handler through a delegate.
The OnSourceChanged method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
Notes to Inheritors: When overriding OnSourceChanged in a derived class, be sure to call the base class's OnSourceChanged method so that registered delegates receive the event.
using Leadtools.Help;
using Leadtools.Windows.Controls;
private void viewer_SourceChanged(object sender, RoutedEventArgs e)
{
ImageViewer viewer = sender as ImageViewer;
string s = string.Format("SourceChanged Event: {0}", viewer.Source.ToString());
MessageBox.Show(s);
}
public void BitmapSourceViewer_SourceChanged(ImageViewer viewer)
{
viewer.SourceChanged += new RoutedPropertyChangedEventHandler<ImageSource>(viewer_SourceChanged);
viewer.Source = new BitmapImage(new Uri(Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg")));
viewer.SourceChanged -= new RoutedPropertyChangedEventHandler<ImageSource>(viewer_SourceChanged);
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Imports Leadtools.Windows.Controls
Private Sub viewer_SourceChanged(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim viewer As ImageViewer = TryCast(sender, ImageViewer)
Dim s As String = String.Format("SourceChanged Event: {0}", viewer.Source.ToString())
MessageBox.Show(s)
End Sub
Public Sub BitmapSourceViewer_SourceChanged(ByVal viewer As ImageViewer)
AddHandler viewer.SourceChanged, AddressOf viewer_SourceChanged
viewer.Source = New BitmapImage(New Uri(Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg")))
RemoveHandler viewer.SourceChanged, AddressOf viewer_SourceChanged
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools.Help;
using Leadtools.Windows.Controls;
private void viewer_SourceChanged(object sender, RoutedEventArgs e)
{
ImageViewer viewer = sender as ImageViewer;
string s = string.Format("SourceChanged Event: {0}", viewer.Source.ToString());
MessageBox.Show(s);
}
public void BitmapSourceViewer_SourceChanged(ImageViewer viewer)
{
viewer.SourceChanged += new RoutedPropertyChangedEventHandler<ImageSource>(viewer_SourceChanged);
viewer.Source = new BitmapImage(new Uri(LeadtoolsExamples.Common.ImagesPath.Path + "cannon.jpg"));
viewer.SourceChanged -= new RoutedPropertyChangedEventHandler<ImageSource>(viewer_SourceChanged);
}
Imports Leadtools
Imports Leadtools.Windows.Controls
Private Sub viewer_SourceChanged(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim viewer As ImageViewer = TryCast(sender, ImageViewer)
Dim s As String = String.Format("SourceChanged Event: {0}", viewer.Source.ToString())
MessageBox.Show(s)
End Sub
Public Sub BitmapSourceViewer_SourceChanged(ByVal viewer As ImageViewer)
AddHandler viewer.SourceChanged, AddressOf viewer_SourceChanged
viewer.Source = New BitmapImage(New Uri(LeadtoolsExamples.Common.ImagesPath.Path & "cannon.jpg"))
RemoveHandler viewer.SourceChanged, AddressOf viewer_SourceChanged
End Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET