Defines an annotation picture along with its transparency information.
[SerializableAttribute()]public class AnnPicture : System.ICloneable, System.IDisposable, System.Runtime.Serialization.ISerializable
<SerializableAttribute()>Public Class AnnPictureImplements System.ICloneable, System.IDisposable, System.Runtime.Serialization.ISerializable
[SerializableAttribute()]public ref class AnnPicture : public System.ICloneable, System.IDisposable, System.Runtime.Serialization.ISerializable
This example creates an image that has a blue ellipse inside a red rectangle.
using Leadtools;using Leadtools.Annotations;using Leadtools.Codecs;using Leadtools.WinForms;private void AnnPicture_AnnPicture(Graphics graphics){using (Bitmap btmp = new Bitmap(100, 100, PixelFormat.Format32bppArgb)){using (Graphics graphicsImage = Graphics.FromImage(btmp)){graphicsImage.FillRectangle(Brushes.Red, new Rectangle(0, 0, 100, 100));graphicsImage.FillEllipse(Brushes.Blue, new Rectangle(0, 0, 100, 100));graphicsImage.Dispose();}// initialize a new AnnPicture class for this imageAnnPicture pic = new AnnPicture(btmp);// draw the picture with no transparencyRectangle rc = new Rectangle(10, 10, pic.Image.Width, pic.Image.Height);ImageAttributes ia = pic.ImageAttributes;if (ia != null){graphics.DrawImage(pic.Image, rc, 0, 0, pic.Image.Width, pic.Image.Height, GraphicsUnit.Pixel, ia);ia.Dispose();}else{if (rc.Width > 1 && rc.Height > 1)graphics.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 = Color.Blue;ia = pic.ImageAttributes;if (ia != null){graphics.DrawImage(pic.Image, rc, 0, 0, pic.Image.Width, pic.Image.Height, GraphicsUnit.Pixel, ia);ia.Dispose();}else{if (rc.Width > 1 && rc.Height > 1)graphics.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;ia = pic.ImageAttributes;if (ia != null){graphics.DrawImage(pic.Image, rc, 0, 0, pic.Image.Width, pic.Image.Height, GraphicsUnit.Pixel, ia);ia.Dispose();}else{if (rc.Width > 1 && rc.Height > 1)graphics.DrawImage(pic.Image, rc);}}}
Imports LeadtoolsImports Leadtools.AnnotationsImports Leadtools.CodecsImports Leadtools.WinFormsPrivate Sub AnnPicture_AnnPicture(ByVal g As Graphics)Dim btmp As Bitmap = New Bitmap(100, 100, PixelFormat.Format32bppArgb)TryDim graphicsImage As Graphics = Graphics.FromImage(btmp)TrygraphicsImage.FillRectangle(Brushes.Red, New Rectangle(0, 0, 100, 100))graphicsImage.FillEllipse(Brushes.Blue, New Rectangle(0, 0, 100, 100))graphicsImage.Dispose()FinallyCType(graphicsImage, IDisposable).Dispose()End Try' initialize a new AnnPicture class for this imageDim pic As AnnPicture = New AnnPicture(btmp)' draw the picture with no transparencyDim rc As Rectangle = New Rectangle(10, 10, pic.Image.Width, pic.Image.Height)Dim ia As ImageAttributes = pic.ImageAttributesIf Not ia Is Nothing Theng.DrawImage(pic.Image, rc, 0, 0, pic.Image.Width, pic.Image.Height, GraphicsUnit.Pixel, ia)ia.Dispose()ElseIf rc.Width > 1 AndAlso rc.Height > 1 Theng.DrawImage(pic.Image, rc)End IfEnd If' draw the picture without the ellipse (make transparent color = blue)rc.Offset(0, pic.Image.Height + 10)pic.TransparentMode = AnnPictureTransparentMode.UseColorpic.TransparentColor = Color.Blueia = pic.ImageAttributesIf Not ia Is Nothing Theng.DrawImage(pic.Image, rc, 0, 0, pic.Image.Width, pic.Image.Height, GraphicsUnit.Pixel, ia)ia.Dispose()ElseIf rc.Width > 1 AndAlso rc.Height > 1 Theng.DrawImage(pic.Image, rc)End IfEnd If' 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.TopLeftPixelia = pic.ImageAttributesIf Not ia Is Nothing Theng.DrawImage(pic.Image, rc, 0, 0, pic.Image.Width, pic.Image.Height, GraphicsUnit.Pixel, ia)ia.Dispose()ElseIf rc.Width > 1 AndAlso rc.Height > 1 Theng.DrawImage(pic.Image, rc)End IfEnd IfFinallyCType(btmp, IDisposable).Dispose()End TryEnd Sub
|
Products |
Support |
Feedback: AnnPicture Class - Leadtools.Annotations |
Introduction |
Help Version 19.0.2017.6.20
|

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.