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

Contents
Prev Next

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

Remarks

See also

BackgroundColor

Long

Notes: The background color of the object on the diagram.

Set to -1 to re-set to the default color in the model.

BorderColor

Long

Notes: The border line color of the object on the diagram.

Set to -1 to re-set to the default color in the model.

BorderLineWidth

Long

Notes: The border line width of the object on the diagram.

Valid values are 1 (narrowest) to 5 (thickest); a default of 1 is applied if an invalid value is passed in.

Bottom

Long

Notes: Read/Write

The bottom edge position of the object on the diagram. Enterprise Architect uses a cartesian coordinate system, with {0,0} being the top-left corner of the diagram. For this reason, Y-axis values (Top and Bottom) should always be negative.

DiagramID

Long

Notes: Read/Write

The ID of the associated diagram.

ElementDisplayMode

Long

Notes: Indicates how to adjust the element features if the element is resized.

     1 = Resize to longest feature

     2 = Wrap features

     3 = Truncate features

Defaults to 1 if an invalid value is supplied.

ElementID

Long

Notes: Read/Write

The ElementID of the object instance in this diagram.

FeatureStereotypesTo
Hide

String

Notes: Lists the stereotypes to hide on the object on the diagram.

FontBold

Boolean

Notes: Get or Set the status of the object text font as Bold.

FontColor

Long

Notes: The color of the font of the object text on the diagram.

FontItalic

Boolean

Notes: Get or Set the status of the object text font as Italic.

FontName

String

Notes: The name of the font used for the object text.

FontSize

String

Notes: The size of the font used for the object text.

FontUnderline

Boolean

Notes: Get or Set the status of the object text font as Underlined.

InstanceGUID

String

Notes: The instance GUID for the object on the diagram (the DUID).

InstanceID

Long

Notes: Read

Holds the connector identifier for the current model.

IsSelectable

Boolean

Notes: Indicates whether this object on the diagram can be selected.

Left

Long

Notes: Read/Write

The left edge position of the object on the diagram.

ObjectType

ObjectType

Notes: Read only

Distinguishes objects referenced through a Dispatch interface.

ObjectType

Right

Long

Notes: Read/Write

The right edge position of the object on the diagram.

Sequence

Long

Notes: 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.

ShowComposedDiagram

Boolean

Notes: Indicates whether the object's composite diagram should be displayed by default when the object is selected.

ShowConstraints

Boolean

Notes: Show constraints for this object on the diagram.

ShowFormattedNotes

Boolean

Notes: Show any formatting applied to the notes, for this object on the diagram. ShowNotes must be True for the formatted notes to be displayed.

ShowFullyQualifiedTags

Boolean

Notes: Show fully qualified Tagged Values for this object on the diagram.

ShowInheritedAttributes

Boolean

Notes: Show inherited attributes for this object on the diagram.

ShowInheritedConstraints

Boolean

Notes: Show inherited constraints for this object on the diagram.

ShowInheritedOperations

Boolean

Notes: Show inherited operations for this object on the diagram.

ShowInherited Responsibilities

Boolean

Notes: Show inherited responsibilities for this object on the diagram.

ShowInheritedTags

Boolean

Notes: Show inherited Tagged Values for this object on the diagram.

ShowNotes

Boolean

Note: Show the notes for this object on the diagram.

ShowPackageAttributes

Boolean

Notes: Show Package attributes for this object on the diagram.

ShowPackageOperations

Boolean

Notes: Show Package operations for this object on the diagram.

ShowPortType

Boolean

Notes: Show the Port type.

ShowPrivateAttributes

Boolean

Notes: Show private attributes for this object on the diagram.

ShowPrivateOperations

Boolean

Notes: Show private operations for this object on the diagram.

ShowProtectedAttributes

Boolean

Notes: Show protected attributes for this object on the diagram.

ShowProtectedOperations

Boolean

Notes: Show protected operations for this object on the diagram.

ShowPublicAttributes

Boolean

Notes: Show public attributes for this object on the diagram.

ShowPublicOperations

Boolean

Notes: Show public operations for this object on the diagram.

ShowResponsibilities

Boolean

Notes: Show responsibilities for this object on the diagram.

ShowRunstates

Boolean

Notes: Show Runstates for this object on the diagram.

ShowStructuredCompartments

Boolean

Note: Indicates whether to display the Structure Compartments for this object on the diagram.

ShowTags

Boolean

Notes: Show Tagged Values for this object on the diagram.

Style

Variant

Notes: 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.

See Setting the Style.

TextAlign

Long

Notes: Indicates the alignment of text on a Text element on the diagram.

     1 = Left aligned

     2 = Center aligned

     3 = Right aligned

Defaults to 1 if an invalid value is supplied.

Top

Long

Notes: Read/Write

The top edge position of the object on the diagram. Enterprise Architect uses a cartesian coordinate system, with {0,0} being the top-left corner of the diagram. For this reason, Y-axis values (Top and Bottom) should always be negative.

DiagramObject Methods

Method

Remarks

See also

GetLastError()

String

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

ResetFont

Notes: Resets the font of the object text on the diagram back to the model default.

SetFontStyle(FontName, FontSize, Bold, Italic, Underline)

Boolean

Notes: Sets the font of the object text on the diagram to the specified values.

SetStyleEx(string Parameter, string Value)

Void

Notes: Sets an individual parameter of the Style string.

Parameters:

  • Parameter: String - the name of the style parameter to modify; for example:
         "BCol" = background color
         "BFol" = font color
         "LCol" = line color
         "LWth" = line width
  • Value: String - the new value for the style parameter

Update()

Boolean

Notes: 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 contains various settings that affect the appearance of a DiagramObject. However, it is not recommended to directly edit this attribute string. Instead, use either the SetStyleEx method or one of the individual DiagramObject attributes such as BackgroundColor, FontColor or BorderColor.

For example, the Style string might contain a series of values in a format such as:

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

where:

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

The value assigned to each of the Style color properties is a decimal representation of the hex RGB value, where Red=FF, Green=FF00 and Blue=FF0000.

This code snippet shows how you might change the style settings for all of the objects in the current diagram, changing the background color to red (FF=255) and the font and line colors to yellow (FFFF=65535):

     For Each aDiagObj In aDiag.DiagramObjects

             aDiagObj.BackgroundColor=255

             aDiagObj.FontColor=65535

             aDiagObj.BorderColor=65535

             aDiagObj.BorderLineWidth=1

             aDiagObj.Update

             aRepos.ReloadDiagram aDiagObj.DiagramID

     Next