Get and set the component (property) of the selected object with code without using the property dialog.

Code Example

(1) Select an object in code and change its color.
(2) Change some properties of certain objects that meet specified conditions.

[Visual Basic.NET]

'When using Annotation function, the following property must be set to True.
ImageKit1.Edit.EditEnabled = True

'(1) Select the third object and change its line / text color to red.
ImageKit1.Edit.SelectObject(3)
ImageKit1.Edit.SelectedObjectForeColor = Color.Red

'(2) Of the multiple drawn objects, the text of the text object is acquired and stored in the array.
Dim str_list As New List(Of String)()

'In the following usage, the selected rectangle will flicker normally, but if this property
'is set to True, the selected rectangle will not be displayed, so it will not flicker.

ImageKit1.Edit.HideSelectionBorder = True

Dim i As Integer
For i = 0 To ImageKit1.Edit.NumberOfObjects
     'Select objects one by one
     ImageKit1.Edit.SelectObject(i + 1)
     'If the selected object is text, add that text to the array
     If (ImageKit1.Edit.SelectedObjectKind = Newtone.ImageKit.Win.KindOfEdit.Text) Then
          str_list.Add(ImageKit1.Edit.SelectedObjectText)
     End If
Next

'Deselect an object
ImageKit1.Edit.DeselectObjects()

[Visual C#.NET]

//When using Annotation function, the following property must be set to True.
ImageKit1.Edit.EditEnabled = true;

//(1) Select the third object and change its line / text color to red.
ImageKit1.Edit.SelectObject(3);
ImageKit1.Edit.SelectedObjectForeColor = Color.Red;

//(2) Of the multiple drawn objects, the text of the text object is acquired and stored in the array.
List<string> str_list = new List<string>();

//In the following usage, the selected rectangle will flicker normally, but if this property
//is set to True, the selected rectangle will not be displayed, so it will not flicker.


ImageKit1.Edit.HideSelectionBorder = true;

for (int i = 0; i < ImageKit1.Edit.NumberOfObjects; i++)
{
     //Select objects one by one
     ImageKit1.Edit.SelectObject(i + 1);
     //If the selected object is text, add that text to the array
     if (ImageKit1.Edit.SelectedObjectKind == Newtone.ImageKit.Win.KindOfEdit.Text)
          str_list.Add(ImageKit1.Edit.SelectedObjectText);
}

//Deselect an object
ImageKit1.Edit.DeselectObjects();

Relevant Properties

ImageKit.Edit.NumberOfObjects
ImageKit.Edit.HideSelectionBorder
ImageKit.Edit.SelectedObjectKind
ImageKit.Edit.SelectedObjectForeColor
ImageKit.Edit.SelectedObjectText

Relevant Methods

ImageKit.Edit.SelectObject
ImageKit.Edit.DeselectObjects

The ImageKit WPF is created by Newtone Corporation