Occurs when the image data or attributes has changed.
Supported in Silverlight, Windows Phone 7
Syntax
Event Data
The event handler receives an argument of type RasterImageChangedEventArgs containing data related to this event. The following RasterImageChangedEventArgs properties provide information specific to this event.
Example
Visual Basic | Copy Code |
---|
Public Sub ChangedExample()
Dim codecs As RasterCodecs = New RasterCodecs()
Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")
' Load the image
Dim img As RasterImage = codecs.Load(srcFileName)
' Subscribe to the Changed event of this image
AddHandler img.Changed, AddressOf img_Changed
' Call a few methods and image processing commands that changes the image
Console.WriteLine("Calling FlipViewPerspective")
img.FlipViewPerspective(True)
Console.WriteLine("Calling RotateViewPerspective")
img.RotateViewPerspective(90)
Console.WriteLine("Calling FlipCommand")
Dim flip As FlipCommand = New FlipCommand(True)
flip.Run(img)
' Now disable firing the events and call the methods again
Console.WriteLine("Disabling the events")
img.DisableEvents()
Console.WriteLine("Calling FlipViewPerspective")
img.FlipViewPerspective(True)
Console.WriteLine("Calling RotateViewPerspective")
img.RotateViewPerspective(90)
Console.WriteLine("Calling FlipCommand while")
flip.Run(img)
' Re-enable the events and fire it manually
Console.WriteLine("Re-enabling the events")
img.EnableEvents()
Console.WriteLine("Firing the event manually")
Dim flags As RasterImageChangedFlags = RasterImageChangedFlags.Data Or RasterImageChangedFlags.ViewPerspective
Dim e As RasterImageChangedEventArgs = New RasterImageChangedEventArgs(flags)
img.OnChanged(e)
' Clean up
RemoveHandler img.Changed, AddressOf img_Changed
img.Dispose()
codecs.Dispose()
End Sub
Private Sub img_Changed(ByVal sender As Object, ByVal e As RasterImageChangedEventArgs)
' Show the changed flags
Console.WriteLine("Changed: {0}", e.Flags)
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class |
C# | Copy Code |
---|
public void ChangedExample()
{
RasterCodecs codecs = new RasterCodecs();
string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");
// Load the image
RasterImage img = codecs.Load(srcFileName);
// Subscribe to the Changed event of this image
img.Changed += new EventHandler<RasterImageChangedEventArgs>(img_Changed);
// Call a few methods and image processing commands that changes the image
Console.WriteLine("Calling FlipViewPerspective");
img.FlipViewPerspective(true);
Console.WriteLine("Calling RotateViewPerspective");
img.RotateViewPerspective(90);
Console.WriteLine("Calling FlipCommand");
FlipCommand flip = new FlipCommand(true);
flip.Run(img);
// Now disable firing the events and call the methods again
Console.WriteLine("Disabling the events");
img.DisableEvents();
Console.WriteLine("Calling FlipViewPerspective");
img.FlipViewPerspective(true);
Console.WriteLine("Calling RotateViewPerspective");
img.RotateViewPerspective(90);
Console.WriteLine("Calling FlipCommand while");
flip.Run(img);
// Re-enable the events and fire it manually
Console.WriteLine("Re-enabling the events");
img.EnableEvents();
Console.WriteLine("Firing the event manually");
RasterImageChangedFlags flags = RasterImageChangedFlags.Data | RasterImageChangedFlags.ViewPerspective;
RasterImageChangedEventArgs e = new RasterImageChangedEventArgs(flags);
img.OnChanged(e);
// Clean up
img.Changed -= new EventHandler<RasterImageChangedEventArgs>(img_Changed);
img.Dispose();
codecs.Dispose();
}
void img_Changed(object sender, RasterImageChangedEventArgs e)
{
// Show the changed flags
Console.WriteLine("Changed: {0}", e.Flags);
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
} |
SilverlightCSharp | Copy Code |
---|
public void ChangedExample()
{
// create a new image to work with
RasterImage img = new RasterImage(RasterMemoryFlags.Conventional, 500, 500, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, null, null, 0);
// Subscribe to the Changed event of this image
img.Changed += new EventHandler<RasterImageChangedEventArgs>(img_Changed);
// Call a few methods and image processing commands that changes the image
Debug.WriteLine("Calling FlipViewPerspective");
img.FlipViewPerspective(true);
Debug.WriteLine("Calling RotateViewPerspective");
img.RotateViewPerspective(90);
Debug.WriteLine("Calling FlipCommand");
FlipCommand flip = new FlipCommand(true);
flip.Run(img);
// Now disable firing the events and call the methods again
Debug.WriteLine("Disabling the events");
img.DisableEvents();
Debug.WriteLine("Calling FlipViewPerspective");
img.FlipViewPerspective(true);
Debug.WriteLine("Calling RotateViewPerspective");
img.RotateViewPerspective(90);
Debug.WriteLine("Calling FlipCommand while");
flip.Run(img);
// Re-enable the events and fire it manually
Debug.WriteLine("Re-enabling the events");
img.EnableEvents();
Debug.WriteLine("Firing the event manually");
RasterImageChangedFlags flags = RasterImageChangedFlags.Data | RasterImageChangedFlags.ViewPerspective;
RasterImageChangedEventArgs e = new RasterImageChangedEventArgs(flags);
img.OnChanged(e);
// Clean up
img.Changed -= new EventHandler<RasterImageChangedEventArgs>(img_Changed);
img.Dispose();
}
void img_Changed(object sender, RasterImageChangedEventArgs e)
{
// Show the changed flags
Debug.WriteLine("Changed: {0}", e.Flags);
} |
SilverlightVB | Copy Code |
---|
Public Sub ChangedExample()
' create a new image to work with
Dim img As RasterImage = New RasterImage(RasterMemoryFlags.Conventional, 500, 500, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, Nothing, Nothing, 0)
' Subscribe to the Changed event of this image
AddHandler img.Changed, AddressOf img_Changed
' Call a few methods and image processing commands that changes the image
Debug.WriteLine("Calling FlipViewPerspective")
img.FlipViewPerspective(True)
Debug.WriteLine("Calling RotateViewPerspective")
img.RotateViewPerspective(90)
Debug.WriteLine("Calling FlipCommand")
Dim flip As FlipCommand = New FlipCommand(True)
flip.Run(img)
' Now disable firing the events and call the methods again
Debug.WriteLine("Disabling the events")
img.DisableEvents()
Debug.WriteLine("Calling FlipViewPerspective")
img.FlipViewPerspective(True)
Debug.WriteLine("Calling RotateViewPerspective")
img.RotateViewPerspective(90)
Debug.WriteLine("Calling FlipCommand while")
flip.Run(img)
' Re-enable the events and fire it manually
Debug.WriteLine("Re-enabling the events")
img.EnableEvents()
Debug.WriteLine("Firing the event manually")
Dim flags As RasterImageChangedFlags = RasterImageChangedFlags.Data Or RasterImageChangedFlags.ViewPerspective
Dim e As RasterImageChangedEventArgs = New RasterImageChangedEventArgs(flags)
img.OnChanged(e)
' Clean up
RemoveHandler img.Changed, AddressOf img_Changed
img.Dispose()
End Sub
Private Sub img_Changed(ByVal sender As Object, ByVal e As RasterImageChangedEventArgs)
' Show the changed flags
Debug.WriteLine("Changed: {0}", e.Flags)
End Sub |
Remarks
Requirements
Target Platforms: Silverlight, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only), Windows Phone 7
See Also