BACKGROUND ON A WINDOW

BACKGROUND ON A WINDOW

Postby Silvio » 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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Silvio » 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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Thu Mar 06, 2008 1:03 pm

Silvio,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby mmercado » Thu Mar 06, 2008 2:29 pm

Hi Silvio:

This works for me:
Code: Select all  Expand view  RUN
      @  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

Image
Regards.

Manuel Mercado
User avatar
mmercado
 
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Postby Silvio » Fri Mar 07, 2008 9:50 am

I try this sample but not run ok

Code: Select all  Expand view  RUN
#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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby mmercado » 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
User avatar
mmercado
 
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 72 guests