GetColorCount Example for Visual Basic

This example displays a message box showing the number of unique colors in the control's current bitmap.

' Declare local variables.
Dim RasterProc As New LEADRasterProcess
Dim szMessage As String ' Buffer for the MessageBox string
Dim NumberOfColors As Long ' Number of colors in the bitmap
' Get the number of colors in the bitmap.
NumberOfColors = RasterProc.GetColorCount(LEADRasterView1.Raster)
' Display the result in a message.
szMessage = "The bitmap has " + CStr(NumberOfColors) + " colors"
MsgBox szMessage, 0, "Notice"