←Select platform

OnChanged Method

Summary
Raises the Changed event.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public void OnChanged( 
   RasterImageChangedEventArgs e 
) 
-(void)onChanged:(LTRasterImageChangedFlags)flags; 
public void onChanged( 
   RasterImageChangedEvent e 
); 
public: 
void OnChanged(  
   RasterImageChangedEventArgs^ e 
)  
def OnChanged(self,e): 

Parameters

e
A RasterImageChangedEventArgs that contains the event data.

Remarks

Raising an event invokes the event handler through a delegate.

The OnChanged 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 OnChanged in a derived class, be sure to call the base class's OnChanged method so that registered delegates receive the event.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Core; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Dicom; 
using Leadtools.Drawing; 
using Leadtools.Controls; 
using Leadtools.Svg; 
 
 
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:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.5.16
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.