Leadtools.Windows.Annotations Requires Document/Medical license. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
AnnPicture Class
See Also  Members   Example 
Leadtools.Windows.Annotations Namespace : AnnPicture Class





Defines an annotation picture along with its transparency information.

Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Class AnnPicture 
   Inherits DependencyObject
Visual Basic (Usage)Copy Code
Dim instance As AnnPicture
C# 
[SerializableAttribute()]
public class AnnPicture : DependencyObject 
C++/CLI 
[SerializableAttribute()]
public ref class AnnPicture : public DependencyObject 
XAML Object Element Usage 

<AnnPicture .../>

XAML Object Element Usage 

<AnnPicture .../>

Example

For XAML example, refer to AnnGroupObject.

This example creates an image that has a blue ellipse inside a red rectangle.

Visual BasicCopy Code
Private Sub AnnPicture_AnnPicture(ByVal dc As DrawingContext)
   Dim pic As AnnPicture = Nothing
   Dim dv As DrawingVisual = New DrawingVisual()
   Using dvc As DrawingContext = dv.RenderOpen()
      'Bitmap btmp = new Bitmap(100, 100, PixelFormat.Format32bppArgb))
      dvc.DrawRectangle(Brushes.Red, Nothing, New Rect(0, 0, 100, 100))
      dvc.DrawEllipse(Brushes.Red, Nothing, New System.Windows.Point(50, 50), 100, 100)
      dvc.Close()
      Dim btmp As RenderTargetBitmap = New RenderTargetBitmap(100, 100, 96, 96, PixelFormats.Pbgra32)
      btmp.Render(dv)

      ' initialize a new AnnPicture class for this image
      pic = New AnnPicture(btmp)
   End Using

   If Not pic Is Nothing AndAlso Not pic.Image Is Nothing Then
      ' draw the picture with no transparency
      Dim rc As Rect = New Rect(10, 10, pic.Image.Width, pic.Image.Height)
      dc.DrawImage(pic.Image, rc)

      ' draw the picture without the ellipse (make transparent color = blue)
      rc.Offset(0, pic.Image.Height + 10)
      pic.TransparentMode = AnnPictureTransparentMode.UseColor
      pic.TransparentColor = Colors.Blue


      dc.DrawImage(pic.Image, rc)

      ' draw the picture without the rectangle (use the top left pixel as the transparent color)
      rc.Offset(0, pic.Image.Height + 10)
      pic.TransparentMode = AnnPictureTransparentMode.TopLeftPixel

      dc.DrawImage(pic.Image, rc)
   End If
End Sub
C#Copy Code
private void AnnPicture_AnnPicture(DrawingContext dc) 

   AnnPicture pic = null; 
   DrawingVisual dv = new DrawingVisual(); 
   using(DrawingContext dvc = dv.RenderOpen()) 
   //Bitmap btmp = new Bitmap(100, 100, PixelFormat.Format32bppArgb)) 
   { 
      dvc.DrawRectangle(Brushes.Red, null, new Rect(0, 0, 100, 100)); 
      dvc.DrawEllipse(Brushes.Red, null, new Point(50, 50), 100, 100); 
      dvc.Close(); 
      RenderTargetBitmap btmp = new RenderTargetBitmap(100, 100, 96, 96, PixelFormats.Pbgra32); 
      btmp.Render(dv); 
 
      // initialize a new AnnPicture class for this image 
      pic = new AnnPicture(btmp); 
   } 
 
   if(pic != null && pic.Image != null) 
   { 
      // draw the picture with no transparency 
      Rect rc = new Rect(10, 10, pic.Image.Width, pic.Image.Height); 
      dc.DrawImage(pic.Image, rc); 
 
      // draw the picture without the ellipse (make transparent color = blue) 
      rc.Offset(0, pic.Image.Height + 10); 
      pic.TransparentMode = AnnPictureTransparentMode.UseColor; 
      pic.TransparentColor = Colors.Blue; 
 
 
      dc.DrawImage(pic.Image, rc); 
 
      // draw the picture without the rectangle (use the top left pixel as the transparent color) 
      rc.Offset(0, pic.Image.Height + 10); 
      pic.TransparentMode = AnnPictureTransparentMode.TopLeftPixel; 
 
      dc.DrawImage(pic.Image, rc); 
   } 
}

Inheritance Hierarchy

System.Object
   System.Windows.Threading.DispatcherObject
      System.Windows.DependencyObject
         Leadtools.Windows.Annotations.AnnPicture

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003 family

See Also

AnnPicture requires a Document/Medical product license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features and Unlocking Special LEAD Features.