CopyTo Method
Syntax
CWIMAQPalette.CopyTo DestPalette
Purpose
Copies all data from one palette to another. This includes user-defined palette entries as well as the current palette type.
Parameters
DestPalette As CWIMAQPalette
The destination palette.
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