eNarc
asked on
Resize Image when resizing Form
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 :)
so when I expand the form the image also expands, when I shrink the form the image also shrinks :)
ASKER
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 :)
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 :)
you my try that code, fast procedure,
how to use:
MynewBitMap := ResizeBMP(OldBMP, newh, neww);
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 ;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
the cheap option is the stretch option in the image property