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



type
An AnnRubberStampType value that represents the type of the rubber stamp.
type
An AnnRubberStampType value that represents the type of the rubber stamp.
Gets the default picture for an AnnRubberStampObject type.

Syntax

Visual Basic (Declaration) 
Public Shared Function GetDefaultPicture( _
   ByVal type As AnnRubberStampType _
) As AnnPicture
Visual Basic (Usage)Copy Code
Dim type As AnnRubberStampType
Dim value As AnnPicture
 
value = AnnRubberStampObject.GetDefaultPicture(type)
C# 
public static AnnPicture GetDefaultPicture( 
   AnnRubberStampType type
)
C++/CLI 
public:
static AnnPicture^ GetDefaultPicture( 
   AnnRubberStampType type
) 

Parameters

type
An AnnRubberStampType value that represents the type of the rubber stamp.

Return Value

An AnnPicture class that defines the picture for the AnnRubberStampType specified by type.

Example

This sample does the following:

  1. displays the default rubberstamp picture and displays it
  2. restores original rubberstamp picture and displays
  3. changes to new style and displays

Visual BasicCopy Code
Public Sub AnnRubberStampObject_GetDefaultPicture(ByVal dc As DrawingContext, ByVal filenameNewPicture As String)
  Dim type As AnnRubberStampType = AnnRubberStampType.Important
  ' first draw the original picture for the Important rubber stamp
  Dim rc As Rect = New Rect(0, 0, 240, 120)
  DrawRubberStampPicture(dc, rc, type)
  ' now change the picture to one of our own and redraw it
  Dim img As BitmapSource = New BitmapImage(New Uri(filenameNewPicture))
  Dim picture As AnnPicture = New AnnPicture(img)
  picture.TransparentMode = AnnPictureTransparentMode.None
  AnnRubberStampObject.SetDefaultPicture(type, picture)

  ' at this point, all new AnnRubberStampObject with Type = Important will use this new picture
  rc.Offset(0, rc.Height + 10)
  DrawRubberStampPicture(dc, rc, type)

  ' finally, set the picture back to the original value and redraw it
  AnnRubberStampObject.SetUseOriginalPicture(type, True)
  rc.Offset(0, rc.Height + 10)
  DrawRubberStampPicture(dc, rc, type)
End Sub

Private Sub DrawRubberStampPicture(ByVal dc As DrawingContext, ByVal rc As Rect, ByVal type As AnnRubberStampType)
  ' get the default picture for the rubber stamp
  Dim pic As AnnPicture = AnnRubberStampObject.GetDefaultPicture(type)

  ' draw it
  If Not pic.Image Is Nothing Then
    dc.DrawImage(pic.Image, rc)
  End If
End Sub
C#Copy Code
public void AnnRubberStampObject_GetDefaultPicture(DrawingContext dc, string filenameNewPicture) 

   AnnRubberStampType type = AnnRubberStampType.Important; 
   // first draw the original picture for the Important rubber stamp 
   Rect rc = new Rect(0, 0, 240, 120); 
   DrawRubberStampPicture(dc, rc, type); 
   // now change the picture to one of our own and redraw it 
   BitmapSource img = new BitmapImage(new Uri(filenameNewPicture)); 
   AnnPicture picture = new AnnPicture(img); 
   picture.TransparentMode = AnnPictureTransparentMode.None; 
   AnnRubberStampObject.SetDefaultPicture(type, picture); 
 
   // at this point, all new AnnRubberStampObject with Type = Important will use this new picture 
   rc.Offset(0, rc.Height + 10); 
   DrawRubberStampPicture(dc, rc, type); 
 
   // finally, set the picture back to the original value and redraw it 
   AnnRubberStampObject.SetUseOriginalPicture(type, true); 
   rc.Offset(0, rc.Height + 10); 
   DrawRubberStampPicture(dc, rc, type); 

 
private void DrawRubberStampPicture(DrawingContext dc, Rect rc, AnnRubberStampType type) 

   // get the default picture for the rubber stamp 
   AnnPicture pic = AnnRubberStampObject.GetDefaultPicture(type); 
 
   // draw it 
   if(pic.Image != null) 
   { 
      dc.DrawImage(pic.Image, rc); 
   } 
}

Remarks

Use the AnnRubberStampObject.SetDefaultPicture method to change the default picture used by the AnnRubberStampObject objects. Use the AnnRubberStampObject.GetUseOriginalPicture and AnnRubberStampObject.SetUseOriginalPicture methods to control whether an AnnRubberStampObject will use the default or original picture for a certain type.

Requirements

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

See Also

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