Returns the color in the palette closest to the specified color. The closest match is defined as the color in the palette that has the minimum difference between RGB value of the specified color and its RGB value.

 public Color GetClosestColor(System.Drawing.Color color)
Public Function GetClosestColor(ByVal color As System.Drawing.Color) As Color

The desired color.

The closest color in the palette to the specified RGB value

Color clr = pal.GetClosestColor(System.Drawing.Color.Red);
Dim clr As Color = pal.GetClosestColor(System.Drawing.Color.Red)