Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.3.29
|
Leadtools.Annotations.Automation Assembly > Leadtools.Annotations.Automation Namespace > AnnAutomationManager Class : FindObjectById Method |
public AnnAutomationObject FindObjectById( int id )
'Declaration
Public Function FindObjectById( _ ByVal id As Integer _ ) As AnnAutomationObject
public AnnAutomationObject FindObjectById( int id )
-(LTAnnAutomationObject*) findObjectById:(int) anID;
public AnnAutomationObject findObjectById(int id)
function Leadtools.Annotations.Automation.AnnAutomationManager.FindObjectById( id )
The possible values for id are:
You can also use FindObject if you have an instance of AnnObject and want to find the automation object associated with its type.
This method enumerates all of the AnnAutomationObject items in the Objects collection and compares AnnAutomationObject.Id with id.
This example changes the line color of new line automation objects to blue:
using Leadtools.Annotations.Automation; using Leadtools.Annotations.Core; using Leadtools.Codecs; using Leadtools.Controls; using Leadtools.Annotations.WinForms; using Leadtools.Annotations.Rendering; [TestMethod] public void AnnAutomationManager_FindObjectById() { // find the line automation object AnnAutomationObject obj = _automation.Manager.FindObjectById(AnnObject.LineObjectId); if (obj != null) { obj.ObjectTemplate.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), LeadLengthD.Create(2)); } }
using Leadtools.Converters; using Leadtools.Annotations.Automation; using Leadtools.Controls; using Leadtools.Annotations.Core; using Leadtools.Codecs; [TestMethod] public void AnnAutomationManager_FindObjectById() { // find the line automation object AnnAutomationObject obj = _automation.Manager.FindObjectById(AnnObject.LineObjectId); if (obj != null) { obj.ObjectTemplate.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), LeadLengthDHelper.Create(2)); } }