Leadtools.Annotations.Core Namespace > AnnContainer Class : Resources Property |
public AnnResources Resources {get; set;}
Public Property Resources As AnnResources
public AnnResources Resources {get; set;}
@property (nonatomic) LTAnnResources* resources;
public AnnResources getResources() public void setResources(AnnResources resources)
get_Resources();
set_Resources(value);
Object.defineProperty('Resources');
The annotations resources are images and rubber stamps used through the toolkit. Typically, you create one global AnnResources object and assign it to each container in your application.
using Leadtools.Annotations.Automation; using Leadtools.Annotations.Core; using Leadtools.Codecs; public void AnnContainer_Resources() { // Assume Assets\Point.png is the picture you want to use with Point objects // Create a new instance of AnnResources if the container does not already have one AnnResources resources = _automation.Container.Resources; if (resources == null) { resources = new AnnResources(); _automation.Container.Resources = resources; } // Get the images collection IList<AnnPicture> imagesResources = resources.Images; // Add our picture to it imagesResources.Add(new AnnPicture(@"ms-appx:///Assets/Point.png")); int pictureIndex = imagesResources.Count - 1; // Get the container and set the resources into it AnnContainer container = _automation.Container; container.Resources = resources; double inch = 720.0; // Add a point object at 1in,1in AnnPointObject pointObj = new AnnPointObject(); pointObj.Points[0] = LeadPointD.Create(1 * inch, 1 * inch); // Set the picture pointObj.DefaultPicture = pictureIndex; // Add it to the container container.Children.Add(pointObj); // Select it _automation.SelectObject(pointObj); }
using Leadtools.Converters; using Leadtools.Annotations.Automation; using Leadtools.Controls; using Leadtools.Annotations.Core; using Leadtools.Codecs; [TestMethod] public void AnnContainer_Resources() { // Assume Assets\Point.png is the picture you want to use with Point objects // Create a new instance of AnnResources if the container does not already have one AnnResources resources = _automation.Container.Resources; if (resources == null) { resources = new AnnResources(); _automation.Container.Resources = resources; } // Get the images collection IList<AnnPicture> imagesResources = resources.Images; // Add our picture to it imagesResources.Add(new AnnPicture(@"ms-appx:///Assets/Point.png")); int pictureIndex = imagesResources.Count - 1; // Get the container and set the resources into it AnnContainer container = _automation.Container; container.Resources = resources; double inch = 720.0; // Add a point object at 1in,1in AnnPointObject pointObj = new AnnPointObject(); pointObj.Points[0] = LeadPointDHelper.Create(1 * inch, 1 * inch); // Set the picture pointObj.DefaultPicture = pictureIndex; // Add it to the container container.Children.Add(pointObj); // Select it _automation.SelectObject(pointObj); }