In TImageEnView, I need to pick up the clicked color with the left or right mouse buttons separately.
Unfortunately, OnUserInteraction with ieiColorPickerClick does not work with the right mouse button.
So I tried OnMouseDown:
procedure TForm1.ImageEnView1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Button = TMouseButton.mbLeft then
begin
CodeSite.SendColor('TForm1.ImageEnView1MouseDown: LEFT', TRGB2TColor(ImageEnView1.IEBitmap.Pixels[X, Y]));
end
else if Button = TMouseButton.mbRight then
begin
CodeSite.SendColor('TForm1.ImageEnView1MouseDown: RIGHT', TRGB2TColor(ImageEnView1.IEBitmap.Pixels[X, Y]));
end
end;
But with this code I randomly get an AV in TIEBitmap.GetPixels in this line:
ie24RGB:
result := PRGB(GetSegment(y, x, 1))^;
Isn't there a better way to achieve this?