(Leadtools.Controls)

Invalidate Method

Show in webframe
Example 





Invalidates the entire surface of the control and causes the control to be redrawn.
Syntax
public virtual void Invalidate()
Public Overridable Sub Invalidate() 
public virtual void Invalidate()
-(void)invalidate;
@Override public void invalidate()
 function Leadtools.Controls.ImageViewer.Invalidate()
Remarks

Calling Invalidate will cause the viewer to re-render the content of its canvas.

Example
Copy Code  
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Controls;

//method to listen to transform Change Event
[TestClass]
void TransformExample()
{
   //listen to Transform Change event
   _viewer.TransformChanged += _Viewer_TransformChanged;
}
//event handler method
[TestClass]
void _Viewer_TransformChanged(object sender, EventArgs e)
{
   //  clear imageViewer InteractiveMode canvas from all objects
   _viewer.InteractiveModeCanvas.Children.Clear();


   //Fixed Rectangle 
   LeadRectD rc1 = LeadRectDHelper.Create(20, 20, 50, 50);

   LeadMatrix matrix = new LeadMatrix(_viewer.Transform.M11, _viewer.Transform.M12,
         _viewer.Transform.M21, _viewer.Transform.M22,
         _viewer.Transform.OffsetX, _viewer.Transform.OffsetY);

   //transformed Rectangle Rectangle 
   LeadRectD rc2 = matrix.TransformRect(rc1);


   // add the fixed blue rectangle at 50, 50 (do not use the viewer transform)
   Rectangle rect = new Rectangle
   {
      Width = rc1.Width,
      Height = rc1.Height,
      Fill = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 0, 255)),
   };

   // Draw the red rectangle. This will be at 50, 50 as well, but will scroll and zoom
   // with the viewer
   Rectangle rect2 = new Rectangle
   {
      Width = rc2.Width,
      Height = rc2.Height,
      Fill = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 255, 0)),
   };


   Canvas.SetLeft(rect, rc1.X);
   Canvas.SetTop(rect, rc1.Y);

   Canvas.SetLeft(rect2, rc2.X);
   Canvas.SetTop(rect2, rc2.Y);

   //add the two rectangles to interactive service canvas
   _viewer.InteractiveModeCanvas.Children.Add(rect);
   _viewer.InteractiveModeCanvas.Children.Add(rect2);
}
Requirements

Target Platforms

See Also

Reference

ImageViewer Class
ImageViewer Members

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.