Solved

Resize Image when resizing Form

Posted on 2009-05-18
4
172 Views
Last Modified: 2012-05-07
Hi I'd like to be able to resize an image1 while still keeping its aspect, when I resize the form.

so when I expand the form the image also expands, when I shrink the form the image also shrinks :)
0
Comment
Question by:eNarc
  • 2
4 Comments
 
LVL 8

Expert Comment

by:BdLm
ID: 24418871
do you need to change the pixel size ?  There are many options for resize an image, from fast algo with low quality until excellent results using long calc time.

the cheap option is the stretch option in the image property
0
 
LVL 5

Author Comment

by:eNarc
ID: 24420104
mostly its just the image1.height and image1.width that need changing because if I was to change the image draw on resize it would amount so much memory that it would probly stall the computer.


like how we would keep that of a panel in line with the rest of the form, neeting an image to remain in aspect at the same time staying within the form as it moves :)
0
 
LVL 8

Expert Comment

by:BdLm
ID: 24420380
you my try that code, fast procedure,

how to use:  

         MynewBitMap := ResizeBMP(OldBMP, newh, neww);



function ResizeBMP(FromBit:  TBitmap; new_h, new_w  :  Integer) : TBitMap;

var    Target   :  TBitmap;

begin
 
 

   Target:=TBitmap.Create;
 

   Target.PixelFormat := pf24bit;
 

   if ((new_h>10)  and (new_w >10)) then

      begin

          Target.Height  :=  new_h;
 

          Target.Width   :=  new_w;
 

          Target.Canvas.StretchDraw(Rect(0, 0, Target.Width, Target.Height), FromBit);
 

      end;
 

   result := Target;

end ;

Open in new window

0
 
LVL 1

Accepted Solution

by:
sidneye earned 500 total points
ID: 24422364
On your Timage set Proportional=True, Stretch=True, Align=alClient.  You may need to move other components to a panel that you align to an edge but this is all you need.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

706 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now