Occurs when the image data or attributes has changed.
Syntax
Example
Visual Basic | Copy Code |
---|
Public Sub ChangedExample()
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
Dim srcFileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "Image1.cmp"
Dim img As RasterImage = codecs.Load(srcFileName)
AddHandler img.Changed, AddressOf img_Changed
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)
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)
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)
RemoveHandler img.Changed, AddressOf img_Changed
img.Dispose()
codecs.Dispose()
RasterCodecs.Shutdown()
End Sub
Private Sub img_Changed(ByVal sender As Object, ByVal e As RasterImageChangedEventArgs)
Console.WriteLine("Changed: {0}", e.Flags)
End Sub |
C# | Copy Code |
---|
public void ChangedExample() { RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); string srcFileName = LeadtoolsExamples.Common.ImagesPath.Path + "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(); RasterCodecs.Shutdown(); } void img_Changed(object sender, RasterImageChangedEventArgs e) { // Show the changed flags Console.WriteLine("Changed: {0}", e.Flags); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also