ImageEn, unit iexColorPalette

TIEColorPalette.IndexAtPos

TIEColorPalette.IndexAtPos


Declaration

function IndexAtPos(X, Y: integer) : integer;


Description

Returns the index of the color cell at position X, Y in the component. Result is -1 if there is not cell at the position.

Note: IndexAtPos takes scrolling into account, i.e. IndexAtPos( 0, 0 ) will return a different result if the control has been scrolled


Example

procedure TForm1.ColorPalette1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
  idx: Integer;
begin
  // Same as ColorPalette1.IndexUnderCursor
  idx := ColorPalette1.IndexUnderCursor( X, Y );
  lblIndex.Caption := 'Index under cursor: ' + IntToStr( idx );
end;