Link to home
Start Free TrialLog in
Avatar of Peter Kiers
Peter KiersFlag for Netherlands

asked on

Make a "rubber band rectangle", part 3

Dear Experts,

I have a little programm that uses a canvas. When the user selects
menu-item Test FillBuf, the canvas will be filled with characters. There
are 2 ways to select the whole canvas, first is menu-item SelectAll
and that works fine. And second is by selecting the text with the mouse
(creating a "rubberband rectangle"). With the second way I have a ques-
tion.

I have put 2 pictures on my site to let you see what my programm does
    when you select the text on the canvas.
   
The left picture is what I have now and the right picture is what it should be.

The 2 pictures and the example programm are on my site:

http://members.home.nl/peterkiers/

Who can help me fix that.

ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Peter Kiers

ASKER

Hi Kretschmar,

I have tried your example, it doesn't show the selection lines
anymore while the mouse button is pressed, but when I release
it the selection lines appears, I think this procedure has to be changed
also.

procedure TForm1.ScrImage1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Bounding then
  begin
    Bounding := False;
    Canvas.Pen.Mode := pmNot;
    Canvas.Brush.Style := bsClear;
    Canvas.Rectangle(AnchorX, AnchorY, CurX, CurY);
    CopyRect(AnchorX, AnchorY, CurX, CurY);
  end;
end;

peter
Hi, I have change this procedure too and now it works:

procedure TForm1.ScrImage1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Bounding then
  begin
    Bounding := False;
    CurX := X;
    CurY := Y;
  end;
end;

500p. comming your way.

Greetings,

Peter Kiers