Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

DiagramObject Class

The DiagramObject Class stores presentation information that indicates what is displayed in a diagram and how it is shown.

Associated table in .EAP file     t_diagramobjects

DiagramObject Attributes

Attribute

Type

Notes

See also

Bottom

Long

Read/Write

The bottom edge position of the element.

 

 

DiagramID

Long

Read/Write

The ID of the associated diagram.

 

 

ElementID

Long

Read/Write

The ElementID of the object instance in this diagram.

 

 

InstanceID

Long

Read

The attribute that holds the connector identifier for the current model.

 

 

Left

Long

Read/Write

The left edge position of the element.

 

 

ObjectType

ObjectType

Read only

Distinguishes objects referenced through a Dispatch interface.

 

ObjectType

Right

Long

Read/Write

The right edge position of the element.

 

 

Sequence

Long

Read/Write

The sequence position when loading the object into the diagram (this affects its Z order).

The Z-order is one-based and the lowest value is in the foreground.

 

 

Style

Variant

Read/Write

The style information for this object. Returns a semi-colon delimited string that defines the current style settings. Changing a value will completely overwrite the previously existing value, so caution is advised to avoid losing existing style information that you want to keep.

 

Setting the Style

Top

Long

Read/Write

The top edge position of the element.

 

 

DiagramObject Methods

Method

Type

Notes

GetLastError ()

String

Returns a string value describing the most recent error that occurred in relation to this object.

 

Update ()

Boolean

Updates the current DiagramObject after modification or appending a new item

If false is returned, check the GetLastError function for more information.

 

Setting the Style

The Style attribute is used for setting the appearance of a DiagramObject; it is set with a string value in the format:

BCol=n;BFol=n;LCol=n;LWth=n;

 

where:

·BCol = Background Color
·BFol = Font Color
·LCol = Line Color
·LWth = Line Width

 

The color value is a decimal representation of the hex RGB value, where Red=FF, Green=FF00 and Blue=FF0000

 

DiagObj.Style = "BCol=35723;BFol=9342520;LCol=9342520;LWth=1;"

 

The following code snippet shows how you might change the style settings for all of the objects in the current diagram, in this case changing everything to red:

 

For Each aDiagObj In aDiag.DiagramObjects

           aDiagObj.Style = "BCol=255;BFol=9342520;LCol=9342520;LWth=1;"

           aDiagObj.Update

           aRepos.ReloadDiagram aDiagObj.DiagramID

Next