Gets the default picture for an AnnRubberStampObject type.
public static Leadtools.Windows.Annotations.AnnPicture GetDefaultPicture(Leadtools.Windows.Annotations.AnnRubberStampType type)
Public Shared Function GetDefaultPicture( _ByVal type As Leadtools.Windows.Annotations.AnnRubberStampType _) As Leadtools.Windows.Annotations.AnnPicture
public:static Leadtools.Windows.Annotations.AnnPicture^ GetDefaultPicture(Leadtools.Windows.Annotations.AnnRubberStampType type)
type
An AnnRubberStampType value that represents the type of the rubber stamp.
An AnnPicture class that defines the picture for the AnnRubberStampType specified by
Use the SetDefaultPicture method to change the default picture used by the AnnRubberStampObject objects. Use the GetUseOriginalPicture and SetUseOriginalPicture methods to control whether an AnnRubberStampObject will use the default or original picture for a certain type.
This sample does the following:
Imports Leadtools.Windows.ControlsImports Leadtools.Windows.AnnotationsPublic 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 stampDim rc As Rect = New Rect(0, 0, 240, 120)DrawRubberStampPicture(dc, rc, type)' now change the picture to one of our own and redraw itDim img As BitmapSource = New BitmapImage(New Uri(filenameNewPicture))Dim picture As AnnPicture = New AnnPicture(img)picture.TransparentMode = AnnTransparentMode.NoneAnnRubberStampObject.SetDefaultPicture(type, picture)' at this point, all new AnnRubberStampObject with Type = Important will use this new picturerc.Offset(0, rc.Height + 10)DrawRubberStampPicture(dc, rc, type)' finally, set the picture back to the original value and redraw itAnnRubberStampObject.SetUseOriginalPicture(type, True)rc.Offset(0, rc.Height + 10)DrawRubberStampPicture(dc, rc, type)End SubPrivate Sub DrawRubberStampPicture(ByVal dc As DrawingContext, ByVal rc As Rect, ByVal type As AnnRubberStampType)' get the default picture for the rubber stampDim pic As AnnPicture = AnnRubberStampObject.GetDefaultPicture(type)' draw itIf Not pic.Image Is Nothing Thendc.DrawImage(pic.Image, rc)End IfEnd Sub
using Leadtools.Windows.Controls;using Leadtools.Windows.Annotations;using Leadtools.Demos;using Leadtools.Help;public void AnnRubberStampObject_GetDefaultPicture(DrawingContext dc, string filenameNewPicture){AnnRubberStampType type = AnnRubberStampType.Important;// first draw the original picture for the Important rubber stampRect rc = new Rect(0, 0, 240, 120);DrawRubberStampPicture(dc, rc, type);// now change the picture to one of our own and redraw itBitmapSource img = new BitmapImage(new Uri(filenameNewPicture));AnnPicture picture = new AnnPicture(img);picture.TransparentMode = AnnTransparentMode.None;AnnRubberStampObject.SetDefaultPicture(type, picture);// at this point, all new AnnRubberStampObject with Type = Important will use this new picturerc.Offset(0, rc.Height + 10);DrawRubberStampPicture(dc, rc, type);// finally, set the picture back to the original value and redraw itAnnRubberStampObject.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 stampAnnPicture pic = AnnRubberStampObject.GetDefaultPicture(type);// draw itif(pic.Image != null){dc.DrawImage(pic.Image, rc);}}
using Leadtools.Windows.Controls;using Leadtools.Windows.Annotations;using Leadtools.Examples;public void AnnRubberStampObject_GetDefaultPicture(WriteableBitmap wb, string filenameNewPicture){AnnRubberStampType type = AnnRubberStampType.Important;// first draw the original picture for the Important rubber stampRect rc = new Rect(0, 0, 240, 120);DrawRubberStampPicture(ref wb, rc, type);// now change the picture to one of our own and redraw itBitmapSource img = new BitmapImage(new Uri(filenameNewPicture));AnnPicture picture = new AnnPicture(img);picture.TransparentMode = AnnTransparentMode.None;AnnRubberStampObject.SetDefaultPicture(type, picture);// at this point, all new AnnRubberStampObject with Type = Important will use this new picturerc.Y += rc.Height + 10;DrawRubberStampPicture(ref wb, rc, type);// finally, set the picture back to the original value and redraw itAnnRubberStampObject.SetUseOriginalPicture(type, true);rc.Y += rc.Height + 10;DrawRubberStampPicture(ref wb, rc, type);}private void DrawRubberStampPicture(ref WriteableBitmap wb, Rect rc, AnnRubberStampType type){// get the default picture for the rubber stampAnnPicture pic = AnnRubberStampObject.GetDefaultPicture(type);// draw itif (pic.Image != null){Canvas cvs = new Canvas();cvs.RenderTransformOrigin = new Point(rc.X, rc.Y);cvs.Width = rc.Width;cvs.Height = rc.Height;wb = new WriteableBitmap(pic.Image);wb.Render(cvs, null);}}
Imports Leadtools.Windows.ControlsImports Leadtools.Windows.AnnotationsPublic Sub AnnRubberStampObject_GetDefaultPicture(ByVal wb As WriteableBitmap, ByVal filenameNewPicture As String)Dim type As AnnRubberStampType = AnnRubberStampType.Important' first draw the original picture for the Important rubber stampDim rc As Rect = New Rect(0, 0, 240, 120)DrawRubberStampPicture(wb, rc, type)' now change the picture to one of our own and redraw itDim img As BitmapSource = New BitmapImage(New Uri(filenameNewPicture))Dim picture As AnnPicture = New AnnPicture(img)picture.TransparentMode = AnnTransparentMode.NoneAnnRubberStampObject.SetDefaultPicture(type, picture)' at this point, all new AnnRubberStampObject with Type = Important will use this new picturerc.Y += rc.Height + 10DrawRubberStampPicture(wb, rc, type)' finally, set the picture back to the original value and redraw itAnnRubberStampObject.SetUseOriginalPicture(type, True)rc.Y += rc.Height + 10DrawRubberStampPicture(wb, rc, type)End SubPrivate Sub DrawRubberStampPicture(ByRef wb As WriteableBitmap, ByVal rc As Rect, ByVal type As AnnRubberStampType)' get the default picture for the rubber stampDim pic As AnnPicture = AnnRubberStampObject.GetDefaultPicture(type)' draw itIf Not pic.Image Is Nothing ThenDim cvs As Canvas = New Canvas()cvs.RenderTransformOrigin = New Point(rc.X, rc.Y)cvs.Width = rc.Widthcvs.Height = rc.Heightwb = New WriteableBitmap(pic.Image)wb.Render(cvs, Nothing)End IfEnd Sub
|
Products |
Support |
Feedback: GetDefaultPicture Method - Leadtools.Windows.Annotations |
Introduction |
Help Version 19.0.2017.3.22
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.