BQuad(0), m_iPalette * LenB(tRGBQuad(0))
   '
End Sub

Public Sub CreatehPalette()
Dim tLP As LOGPALETTE
Dim tP As PALETTEENTRY

   ClearUp
   
   tLP.palVersion = &amp;H300
   tLP.palNumEntries = m_iPalette
   ReDim b(0 To LenB(tLP) + m_iPalette * LenB(tP) - 1) As Byte
   CopyMemoryRef b(0), tLP, LenB(tLP)
   CopyMemoryRef b(LenB(tLP)), m_tPal(1), LenB(tP) * m_iPalette
   
   m_hPal = CreatePalette(b(0))
      
End Sub

Public Property Get ClosestIndex( _
      ByVal Red As Long, _
      ByVal Green As Lon