Mega Code Archive

 
Categories / Delphi / Graphic
 

Stretch an Image

Title: Stretch an Image Question: How to stretch an image to screen size Answer: This little piece of code stretches an image to fit the screen size: uses graphics, sysutils, classes, forms, windows; procedure Stretch( ABitmap : graphics.TBitmap ); var SrcRect : TRect; DestRect : TRect; begin SrcRect := Bounds( 0,0, ABitmap.Width, ABitmap.Height ); DestRect := Bounds( 0,0, screen.Width, screen.Height ); ABitmap.Width := screen.Width; ABitmap.Height := screen.Height; ABitmap.Canvas.CopyRect( DestRect, ABitmap.Canvas, SrcRect ); end;