Change Border Selection Color with Mouse

Asked

Viewed 254 times

1

Hello, I have the following function below in which I select (with the mouse) a certain coordinate of an image and save it. It turns out that when it’s a very CLEAR or WHITE image I can’t see the space I’m selecting!

Is there any way to change the color of the "edge" of the selection I’m making in the image?

I will save only the part that selects the image.

procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if IsDown then
  begin
    Canvas.Pen.Style := psDot;
    Canvas.Pen.Mode := pmNotXor;
    Canvas.Rectangle(OldStartX, OldStartY, OldEndX, OldEndY);
    OldEndX := X;
    OldEndY := Y;
    Canvas.Rectangle(StartX, StartY, X, Y);
  end;
end;

Here is a PRINT explaining exactly which EDGE I want to change: http://prntscr.com/9bgj90

1 answer

2


It has as yes friend, however, as the edge line is very thin, it is likely that you will need to make some adjustments.

Add this property below pmNotXor:

Canvas.Pen.Color := clRed; //ou a cor de sua escolha

If you need to let the edge more expessa you can use:

Canvas.Pen.Width := 2; //ou qualquer tamanho de sua escolha

But for the estate Width look cool, you will have to choose some line styles to look cool.

I await the Feedback!

  • Perfect @Junior Moreira, thank you so much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.