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.

Delphi

Avatar of undefined
Last Comment
Peter Kiers
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Peter Kiers
Peter Kiers
Flag of Netherlands image

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
Avatar of Peter Kiers
Peter Kiers
Flag of Netherlands image

ASKER

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
Delphi
Delphi

Delphi is the most powerful Object Pascal IDE and component library for cross-platform Native App Development with flexible Cloud services and broad IoT connectivity. It provides powerful VCL controls for Windows 10 and enables FMX development for Windows, Mac and Mobile. Delphi is your choice for ultrafast Enterprise Strong Development™. Look for increased memory for large projects, extended multi-monitor support, improved Object Inspector and much more. Delphi is 5x faster for development and deployment across multiple desktop, mobile, cloud and database platforms including 32-bit and 64-bit Windows 10.

60K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo