Mega Code Archive

 
Categories / Delphi / Examples
 

Form resize

This hint is a little surprise. So, you'd have to either read the code and understand what it does or try it out! Create a new application (select "File | New Application" from the main menu) Select the empty form and double click on it's "OnResize" event Change the generated "FormResize()" function to look like the following and run the program. procedure TForm1.FormResize( Sender: TObject ); var R : TRect; DC : HDc; Canv : TCanvas; begin R := Rect( 0, 0, Screen.Width, Screen.Height ); DC := GetWindowDC( GetDeskTopWindow ); Canv := TCanvas.Create; Canv.Handle := DC; Canvas.CopyRect( R, Canv, R ); ReleaseDC( GetDeskTopWindow, DC ); end; Doesn't do anything? Try resizing the form by dragging its top left corner while running the program.