Please enable JavaScript to view this site.

IBM® SPSS® Amos™ 28

Navigation: Programming with Amos > Additional Programming Examples > Examples using the Amos Graphics classes

Use the Amos Graphics classes to change the appearance of latent variables

Scroll Prev Top Next More

Running the following Amos Graphics plugin modifies the appearance of latent variables. The Undraw and Draw methods make the changes immediately visible. The UndoToHere and UndoResume methods allow you to undo all the changes carried out by the program with one press of 387. The On Error GoTo statement is a safety measure to make sure that undo capability is restored before the program exits.

Imports Amos
Imports System.drawing
<System.ComponentModel.Composition.Export(GetType(IPlugin))>
Public Class CustomCode
    Implements IPlugin
 
    Public Function Mainsub() As Integer Implements IPlugin.Mainsub
        Dim x As PDElement
        pd.UndoToHere()
        On Error Goto ErrExit
 
        For Each x In pd.PDElements
            If x.IsLatentVariable Then
                x.Undraw()
                x.BorderColor = Color.Black.ToArgb
                x.FillColor = Color.White.ToArgb
                x.NameColor = Color.Red.ToArgb
                x.ParameterColor = Color.Green.ToArgb
                x.Fillstyle = 0
                x.Penwidth = 2
                x.Draw()
            End If
        Next
    ErrExit:
        pd.UndoResume()
    End Function
 
    Public Function Name() As String Implements IPlugin.Name
    End Function
 
    Public Function Description() As String Implements IPlugin.Description
    End Function
End Class

© 2021 Amos Development Corporation