FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour BACKGROUND ON A WINDOW
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
BACKGROUND ON A WINDOW
Posted: Thu Mar 06, 2008 11:52 AM

I must insert an image jpg as background in a window
but I know this only for bitmap and not run for jpg

sample

define OSFONDO "D48.JPG"

...
DEFINE BITMAP oBmpSFONDO SFONDO FILENAME OSFONDO

...

ACTIVATE WINDOW oWChld MAXIMIZED;
ON PAINT (showBitmaps( oWnd, hDC, oBmpSFONDO:hBitmap,oBmpSFONDO ) )

// this is good for BMPs

STAT FUNC shwBitmaps( oWnd, hDC, hBmp, oBitmap )
LOCAL nTop := 0
LOCAL nLeft := 0
LOCAL nWidth := oWnd:nWidth()
LOCAL nHeight := oWnd:nHeight()
Local oSay
IF hBmp = 0
RETURN NIL
ENDIF
PalBmpDraw( hDC, nTop, nLeft, hBmp , , nWidth, nHeight )
Return NIL

How I can make to show a jpg ?

Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
BACKGROUND ON A WINDOW
Posted: Thu Mar 06, 2008 11:58 AM

I made also this :

oBmpSFONDO = TImage():Define( , OSFONDO )

oWnd:oWndClient:bPainted := {|hDC| PalBmpDraw( hDC, 0, 0,oBmpSFONDO:hBitmap,,;
oWnd:oWndClient:nWidth, oWnd:oWndClient:nHeight,, .T.) }

but not run

Best Regards, Saludos



Falconi Silvio
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
BACKGROUND ON A WINDOW
Posted: Thu Mar 06, 2008 01:03 PM

Silvio,

Do MsgInfo( oBmpSFONDO:hBitmap ) to check that you have a valid handle there.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 782
Joined: Wed Dec 19, 2007 07:50 AM
BACKGROUND ON A WINDOW
Posted: Thu Mar 06, 2008 02:29 PM
Hi Silvio:

This works for me:
      @  0,  0 IMAGE oImg FILENAME C:\MG\IMAGES\MGLogom.jpg" OF oWnd:oWndClient ;
               SIZE GetSysMetrics( 0 ), GetSysMetrics( 17 ) - GetSysMetrics( 15 ) - oBar:nHeight() - ;
                    oWnd:oMsgBar:nHeight() PIXEL ADJUST


Regards.

Manuel Mercado
manuelmercado at prodigy dot net dot mx
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
BACKGROUND ON A WINDOW
Posted: Fri Mar 07, 2008 09:50 AM
I try this sample but not run ok

#include "FiveWin.ch"



#define OSFONDO   "D48.JPG"


  static oWnd



function Main()

   local oBar

   DEFINE WINDOW oWnd TITLE "Test" MDI ;
      MENU BuildMenu()

 DEFINE BUTTONBAR oBar 3DLOOK BUTTONSIZE 39,39 OF oWnd 2007


SET MESSAGE OF oWnd TO "test image" NOINSET 2007

   ACTIVATE WINDOW oWnd

return nil

function BuildMenu()

   local oMenu

   MENU oMenu
      MENUITEM "Test"
      MENU
         MENUITEM "Beach" ACTION Beach()
      ENDMENU
      oMenu:AddMdi()
   ENDMENU

return oMenu

function beach()
 LOCAL oWChld

DEFINE WINDOW oWChld OF oWnd MDICHILD  ;
TITLE 'Beach Plan'


@  0,  0 IMAGE oImg FILENAME OSFONDO OF  oWChld:oWndClient ;
               SIZE GetSysMetrics( 0 ), GetSysMetrics( 17 ) - GetSysMetrics( 15 ) - oWnd:oBar:nHeight() - ;
      oWnd:oMsgBar:nHeight() PIXEL ADJUST

          cRegistro := "OMBRELLONI : "
          cAutore   := "Liberi  : "
          cSyst     := "Occupati : "

 SET MESSAGE OF  oWChld TO "" NOINSET
 DEFINE MSGITEM OF  oWChld:oMSGBAR  prompt cregistro  size 150 ACTION    nil
 DEFINE MSGITEM OF  oWChld:oMSGBAR  prompt  cAutore  size 150 ACTION    nil
 DEFINE MSGITEM OF  oWChld:oMSGBAR  prompt cSyst  size 150 ACTION    nil

ACTIVATE WINDOW oWChld MAXIMIZED

 return nil

to try you can download the image from www.bpascal.it/d48.jpg
Best Regards, Saludos



Falconi Silvio
Posts: 782
Joined: Wed Dec 19, 2007 07:50 AM
BACKGROUND ON A WINDOW
Posted: Fri Mar 07, 2008 11:25 AM
Hi Silvio:
Silvio wrote:I try this sample but not run ok

For a MDICHILD try this:

@0,0 IMAGE oImg FILENAME OSFONDO OF oWChld SIZE oWChld:nWidth, oWChld:nHeight PIXEL ADJUST

Just remember that oImg is not a brush of oWChld, then other controls for this child window should belong to oImg instead of oWChld

Regards

Manuel Mercado
manuelmercado at prodigy dot net dot mx

Continue the discussion