Raises the SourceChanged event.
protected virtual void OnSourceChanged(
RoutedPropertyChangedEventArgs<ImageViewer> e
)
Protected Overridable Sub OnSourceChanged( _
ByVal e As RoutedPropertyChangedEventArgs(Of ImageViewer) _
)
protected:
virtual void OnSourceChanged(
RoutedPropertyChangedEventArgs<ImageViewer^>^ 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.
Imports Leadtools.Windows.Controls
Public Sub ImagePanViewer_SourceChanged(ByVal panViewer As ImagePanViewer)
' set up the event handlers
AddHandler panViewer.StrokeChanged, AddressOf panViewer_StrokeChanged
AddHandler panViewer.SourceChanged, AddressOf panViewer_SourceChanged
AddHandler panViewer.InnerBrushChanged, AddressOf panViewer_InnerBrushChanged
AddHandler panViewer.OuterBrushChanged, AddressOf panViewer_OuterBrushChanged
AddHandler panViewer.PositionChanged, AddressOf panViewer_PositionChanged
Dim viewerOld As ImageViewer = panViewer.Source
' fires the SourceChanged event twice
panViewer.Source = Nothing
panViewer.Source = viewerOld
' change some properties
panViewer.Stroke = Brushes.Black
panViewer.StrokeThickness = 2
panViewer.Position = New Point(20, 20)
End Sub
Private Sub panViewer_PositionChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Point))
Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
If Not panViewer Is Nothing Then
Console.WriteLine("Position Changed to " & panViewer.Position.ToString())
End If
End Sub
Private Sub panViewer_OuterBrushChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
If Not panViewer Is Nothing Then
Console.WriteLine("Inner Brush Changed to " & panViewer.OuterBrush.ToString() & "Color")
End If
End Sub
Private Sub panViewer_InnerBrushChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
If Not panViewer Is Nothing Then
Console.WriteLine("Inner Brush Changed to " & panViewer.InnerBrush.ToString() & "Color")
End If
End Sub
Private Sub panViewer_StrokeChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
If Not panViewer Is Nothing Then
Console.WriteLine("Rectangle Stroke Changed to " & panViewer.StrokeThickness.ToString() & "Thickness and to" & panViewer.Stroke.ToString() & "Color")
End If
End Sub
Private Sub panViewer_SourceChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of ImageViewer))
Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
If Not panViewer Is Nothing Then
If panViewer.Source Is Nothing Then
Console.WriteLine("There is no Viewer control associated with the ImagePanViewer Control")
Else
Console.WriteLine("A Viewer is now associated with the ImagePanViewer Control")
End If
End If
End Sub
using Leadtools.Help;
using Leadtools.Windows.Controls;
public void ImagePanViewer_SourceChanged(ImagePanViewer panViewer)
{
// set up the event handlers
panViewer.StrokeChanged += new RoutedPropertyChangedEventHandler<Brush>(panViewer_StrokeChanged);
panViewer.SourceChanged += new RoutedPropertyChangedEventHandler<ImageViewer>(panViewer_SourceChanged);
panViewer.InnerBrushChanged +=new RoutedPropertyChangedEventHandler<Brush>(panViewer_InnerBrushChanged);
panViewer.OuterBrushChanged +=new RoutedPropertyChangedEventHandler<Brush>(panViewer_OuterBrushChanged);
panViewer.PositionChanged += new RoutedPropertyChangedEventHandler<Point>(panViewer_PositionChanged);
ImageViewer viewerOld = panViewer.Source;
// fires the SourceChanged event twice
panViewer.Source = null;
panViewer.Source = viewerOld;
// change some properties
panViewer.Stroke = Brushes.Black;
panViewer.StrokeThickness = 2;
panViewer.Position = new Point(20, 20);
}
void panViewer_PositionChanged(object sender, RoutedPropertyChangedEventArgs<Point> e)
{
ImagePanViewer panViewer = (ImagePanViewer)sender;
if (panViewer != null)
Console.WriteLine("Position Changed to " + panViewer.Position.ToString());
}
void panViewer_OuterBrushChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
ImagePanViewer panViewer = (ImagePanViewer)sender;
if (panViewer != null)
Console.WriteLine("Inner Brush Changed to " + panViewer.OuterBrush.ToString() + "Color");
}
void panViewer_InnerBrushChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
ImagePanViewer panViewer = (ImagePanViewer)sender;
if (panViewer != null)
Console.WriteLine("Inner Brush Changed to " + panViewer.InnerBrush.ToString() + "Color");
}
private void panViewer_StrokeChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
ImagePanViewer panViewer = (ImagePanViewer)sender;
if(panViewer != null)
Console.WriteLine("Rectangle Stroke Changed to " + panViewer.StrokeThickness.ToString() +"Thickness and to" + panViewer.Stroke.ToString()+ "Color");
}
private void panViewer_SourceChanged(object sender, RoutedPropertyChangedEventArgs<ImageViewer> e)
{
ImagePanViewer panViewer = (ImagePanViewer)sender;
if(panViewer != null)
{
if(panViewer.Source == null)
Console.WriteLine("There is no Viewer control associated with the ImagePanViewer Control");
else
Console.WriteLine("A Viewer is now associated with the ImagePanViewer Control");
}
}
using Leadtools.Help;
using Leadtools.Windows.Controls;
public void ImagePanViewer_SourceChanged(ImagePanViewer panViewer)
{
// set up the event handlers
panViewer.StrokeChanged += new RoutedPropertyChangedEventHandler<Brush>(panViewer_StrokeChanged);
panViewer.SourceChanged += new RoutedPropertyChangedEventHandler<ImageViewer>(panViewer_SourceChanged);
panViewer.InnerBrushChanged += new RoutedPropertyChangedEventHandler<Brush>(panViewer_InnerBrushChanged);
panViewer.OuterBrushChanged += new RoutedPropertyChangedEventHandler<Brush>(panViewer_OuterBrushChanged);
panViewer.PositionChanged += new RoutedPropertyChangedEventHandler<Point>(panViewer_PositionChanged);
ImageViewer viewerOld = panViewer.Source;
// fires the SourceChanged event twice
panViewer.Source = null;
panViewer.Source = viewerOld;
// change some properties
panViewer.Stroke = new SolidColorBrush(Colors.Black);
panViewer.StrokeThickness = 2;
panViewer.Position = new Point(20, 20);
}
void panViewer_PositionChanged(object sender, RoutedPropertyChangedEventArgs<Point> e)
{
ImagePanViewer panViewer = (ImagePanViewer)sender;
if (panViewer != null)
Console.WriteLine("Position Changed to " + panViewer.Position.ToString());
}
void panViewer_OuterBrushChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
ImagePanViewer panViewer = (ImagePanViewer)sender;
if (panViewer != null)
Console.WriteLine("Inner Brush Changed to " + panViewer.OuterBrush.ToString() + "Color");
}
void panViewer_InnerBrushChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
ImagePanViewer panViewer = (ImagePanViewer)sender;
if (panViewer != null)
Console.WriteLine("Inner Brush Changed to " + panViewer.InnerBrush.ToString() + "Color");
}
private void panViewer_StrokeChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
ImagePanViewer panViewer = (ImagePanViewer)sender;
if (panViewer != null)
Console.WriteLine("Rectangle Stroke Changed to " + panViewer.StrokeThickness.ToString() + "Thickness and to" + panViewer.Stroke.ToString() + "Color");
}
private void panViewer_SourceChanged(object sender, RoutedPropertyChangedEventArgs<ImageViewer> e)
{
ImagePanViewer panViewer = (ImagePanViewer)sender;
if (panViewer != null)
{
if (panViewer.Source == null)
Console.WriteLine("There is no Viewer control associated with the ImagePanViewer Control");
else
Console.WriteLine("A Viewer is now associated with the ImagePanViewer Control");
}
}
Imports Leadtools.Windows.Controls
Public Sub ImagePanViewer_SourceChanged(ByVal panViewer As ImagePanViewer)
' set up the event handlers
AddHandler panViewer.StrokeChanged, AddressOf panViewer_StrokeChanged
AddHandler panViewer.SourceChanged, AddressOf panViewer_SourceChanged
AddHandler panViewer.InnerBrushChanged, AddressOf panViewer_InnerBrushChanged
AddHandler panViewer.OuterBrushChanged, AddressOf panViewer_OuterBrushChanged
AddHandler panViewer.PositionChanged, AddressOf panViewer_PositionChanged
Dim viewerOld As ImageViewer = panViewer.Source
' fires the SourceChanged event twice
panViewer.Source = Nothing
panViewer.Source = viewerOld
' change some properties
panViewer.Stroke = New SolidColorBrush(Colors.Black)
panViewer.StrokeThickness = 2
panViewer.Position = New Point(20, 20)
End Sub
Private Sub panViewer_PositionChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Point))
Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
If Not panViewer Is Nothing Then
Console.WriteLine("Position Changed to " & panViewer.Position.ToString())
End If
End Sub
Private Sub panViewer_OuterBrushChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
If Not panViewer Is Nothing Then
Console.WriteLine("Inner Brush Changed to " & panViewer.OuterBrush.ToString() & "Color")
End If
End Sub
Private Sub panViewer_InnerBrushChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
If Not panViewer Is Nothing Then
Console.WriteLine("Inner Brush Changed to " & panViewer.InnerBrush.ToString() & "Color")
End If
End Sub
Private Sub panViewer_StrokeChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
If Not panViewer Is Nothing Then
Console.WriteLine("Rectangle Stroke Changed to " & panViewer.StrokeThickness.ToString() & "Thickness and to" & panViewer.Stroke.ToString() & "Color")
End If
End Sub
Private Sub panViewer_SourceChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of ImageViewer))
Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
If Not panViewer Is Nothing Then
If panViewer.Source Is Nothing Then
Console.WriteLine("There is no Viewer control associated with the ImagePanViewer Control")
Else
Console.WriteLine("A Viewer is now associated with the ImagePanViewer Control")
End If
End If
End Sub
Products |
Support |
Feedback: OnSourceChanged Method (ImagePanViewer) - Leadtools.Windows.Controls |
Introduction |
Help Version 19.0.2017.3.22
|
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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.