FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Wallpaper as background in a window
Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Wallpaper as background in a window
Posted: Sun Mar 31, 2019 12:06 AM

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

Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Re: Wallpaper as background in a window
Posted: Sun Mar 31, 2019 12:07 AM

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.

Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Wallpaper as background in a window
Posted: Sun Mar 31, 2019 12:28 AM
Hi.
Maybe, something like this?

Code (fw): Select all Collapse
   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.
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Wallpaper as background in a window
Posted: Sun Mar 31, 2019 03:04 AM
We recommend
Code (fw): Select all Collapse
#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.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion