Page 1 of 1

Wallpaper as background in a window

Posted: Sun Mar 31, 2019 12:06 am
by rhlawek
I have been using small graphics via drawtiled() for some time, it works great. But now I have a wallpaper size file that I need to automatically scale to the size of the window, scale to fit basically, not tiled. I don't see how to this, and anybody point me in the right direction.

Thanks.

Robb

Re: Wallpaper as background in a window

Posted: Sun Mar 31, 2019 12:07 am
by rhlawek
To be a bit more clear, I can use the wallpaper as the background, it is the scaling part that I don't know how to do.

Re: Wallpaper as background in a window

Posted: Sun Mar 31, 2019 12:28 am
by FranciscoA
Hi.
Maybe, something like this?

Code: Select all

   oWnd:bPainted := { | hDC | PongaBmp( hDC , oBmp , oWnd ) }

   ACTIVATE WINDOW oWnd MAXIMIZED 

//-----------------------------------------//
STATIC FUNCTION PongaBmp( hDC, oBmp, oWnd )
   PalBmpDraw( hDC, 0, 0,oBmp:hBitmap,, oWnd:oWndClient:nWidth, oWnd:oWndClient:nHeight,, .t.)
return nil

 
Regards.

Re: Wallpaper as background in a window

Posted: Sun Mar 31, 2019 3:04 am
by nageswaragunupudi
We recommend

Code: Select all

#include "fivewn.ch"

function Main()

   local oWnd, oBrush
   local cImage   := "c:\fwh\bitmaps\sea.bmp" // or your image file

   DEFINE BRUSH oBrush FILE cImage STRETCH // or RESIZE
   DEFINE WINDOW oWnd BRUSH oBrush
   ACTIVATE WINDOW oWnd
   RELEASE BRUSH oBrush

return nil
 
Try both the clauses STRETCH and RESIZE and choose what you like.

Works from versions FWH 11.05 onwards.