Peter Kiers
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi, I have change this procedure too and now it works:
procedure TForm1.ScrImage1MouseUp(Se nder: 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
procedure TForm1.ScrImage1MouseUp(Se
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
ASKER
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(Se
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