?
Solved

Resize image with mousehandler

Posted on 2003-02-23
11
Medium Priority
?
199 Views
Last Modified: 2010-04-04
Hello,

I want to place a bounding box around an image and resize it.  I would like to put points on the corners to resize with preserved aspect ratio.  Thanks in advance.

-Gabe
0
Comment
Question by:fibdev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 3
11 Comments
 
LVL 5

Expert Comment

by:msa2003
ID: 8003743
Maybe, there is something what you need: http://www.serge.dsip.net/downloads/ResizeImage.zip

This sample (Delphi 6) lets user modify image size and aspect ratio by dragging the points in the corners of the image. I had written this specially for you.

Best regards.
0
 
LVL 5

Expert Comment

by:msa2003
ID: 8003749
0
 
LVL 5

Expert Comment

by:msa2003
ID: 8003883
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:fibdev
ID: 8004687
msa2003,

It doesn't compile.  I have Delphi 5 Standard :(  Can't afford to go all the way at this time.
0
 
LVL 5

Expert Comment

by:msa2003
ID: 8009474
Ok, I'll tell when I'll remake it for Delphi 5. You still can use *.pas source.
0
 
LVL 5

Expert Comment

by:msa2003
ID: 8009506
Or, you may try to remove all files in the project directory except *.dpr, *.dfm and *.pas and compile the project in this state. If the compiler will return errors, place them here.
0
 
LVL 5

Accepted Solution

by:
msa2003 earned 800 total points
ID: 8020008
OK, here is Delphi 5 source code: http://www.serge.dsip.net/downloads/ImageResize5.zip
0
 
LVL 3

Author Comment

by:fibdev
ID: 8029971
Thank you msa,

That will do.  It does flicker and I was wondering if there was a way to prevent that.  I'm going to go ahead and give you the comment as answer but if you want to fallow up I'd appreciate it.

Thanks
0
 
LVL 5

Expert Comment

by:msa2003
ID: 8034619
It does flicker because of usage of TImage component and Repaint method. You may decrease flicker effect but the program will be much more complex.
0
 
LVL 3

Author Comment

by:fibdev
ID: 8038174
Thanks
0
 
LVL 5

Expert Comment

by:msa2003
ID: 8043497
No thanks. It is really complex to avoid flicker. The good way is to use double buffering. But as I noted before, this way is complex enough. You should use a memory bitmap (TBitmap is good for it) and paint stretched image on it's canvas (TBitmap.Canvas.StretchDraw). Then, you should paint this bitmap on the form's canvas (TForm.Canvas.Draw). This way doesn't let you use visual components such as TImage to represent pictures.
Another way is simpler and used by early versions of Windows GUI. You may drag the contour of the image and paint the image only when mouse button is released. Use Form.Canvas.FrameRect to draw, repaint and to hide contour.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question