Entries Property

NI Vision for Visual Basic

Entries Property

Syntax

CWIMAQPalette.Entries

Data Type

Variant

Purpose

Palette values, represented as integers. The integers are a combined representation of the R, G, and B components of color values.

Remarks

After setting this property, Type is set to cwimaqPaletteUserDefined.

Example

Private Sub Run_Click()
    Dim CurrentPalette As Variant
    Dim InversePalette(0 To 255) As Long
    Dim Red As Integer
    Dim Green As Integer
    Dim Blue As Integer
    Dim I As Integer
    
    'Get the current user-defined palette entries
    CurrentPalette = CWIMAQViewer1.Palette.Entries
       
    'Create an inverted palette
    For I = 0 To 255
        'Get the red, green, and blue components of the current palette entry
        Red = CurrentPalette(I) And &HFF&
        Green = (CurrentPalette(I) And &HFF00&) / &H100
        Blue = (CurrentPalette(I) And &HFF0000) / &H10000
        'Create an entry in the inverse palette
        InversePalette(I) = RGB(255 - Red, 255 - Blue, 255 - Green)
    Next I
    
    'Set the palette into viewer1
    CWIMAQViewer1.Palette.Entries = InversePalette
    
    'Copy the palette from viewer1 to viewer2
    CWIMAQViewer1.Palette.CopyTo CWIMAQViewer2.Palette
End Sub

See Also

Type