FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour No Wnd-backgrd.-image after chang. MODAL to MDI => SOLVED
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

No Wnd-backgrd.-image after chang. MODAL to MDI => SOLVED

Posted: Tue Dec 09, 2008 06:30 PM
Hello,

I changed a application from MODAL to MDI.
The background-Image isn't shown anymore.
After changing back to MODAL, everything works ok.
Maybe < oImage1:LoadBmp( "BRAINSTORM.JPG" ) >
doesn't work with MDI ( Freeimage.dll is included ) ?

//-----  From FWH-sample Testmdi4.prg ---------------//

#include "FiveWin.ch"

static oWnd

function Main()
local oBar

SET _3DLOOK ON

DEFINE WINDOW oWnd TITLE "MDIChilds from resources" MDI

DEFINE BUTTONBAR oBar _3D OF oWnd

DEFINE BUTTON OF oBar ACTION child() //( Child(), MsgInfo( oWnd:oWndClient:aWnd[ 1 ]:cCaption ) )

ACTIVATE WINDOW oWnd maximized ;
ON PAINT SHOW_PIC0( oWnd ) 

return nil

// -----------------------------------

FUNCTION  SHOW_PIC0( oWnd )
LOCAL oImage1
LOCAL aRect := GETCLIENTRECT( oWnd:hWnd )

@ 0, 0 IMAGE oImage1 SIZE aRect[4], aRect[3] OF oWnd  ADJUST   
oImage1:LoadBmp( "TEST.JPG" )

RETURN( NIL )


egards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM

No Wnd-backgrd.-image after chang. MODAL to MDI =&gt; SOLVED

Posted: Tue Dec 09, 2008 06:35 PM

I think you need to paint the client area of the mdi and not the mdi window itself.

This works for me.

ON PAINT (drawbitmap( hdc, obmp:hbitmap, 0, 0,;
oWnd:owndclient:nWidth(), oWnd:owndclient:nHeight()))

Antonio

Regards

Antonio H Ferreira
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Image-background MDI

Posted: Tue Dec 09, 2008 07:22 PM
Hello AHF,

I changed the source.
I used a JPG and it didn't work ( FREEIMAGE.dll is included )
I changed to BMP and it works.
Maybe it is possible, to use only BMP-format ?

function Main()
local oBar, oImage

SET _3DLOOK ON

DEFINE WINDOW oWnd TITLE "MDIChilds from resources" MDI

DEFINE BITMAP oImage FILE "TEST.BMP"   // TEST.JPG doesn't work

.........

ACTIVATE WINDOW oWnd maximized ;
ON PAINT (drawbitmap( hdc, oImage:hbitmap, 0, 0,; 
oWnd:owndclient:nWidth(), oWnd:owndclient:nHeight())) 

return nil


Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM

No Wnd-backgrd.-image after chang. MODAL to MDI =&gt; SOLVED

Posted: Tue Dec 09, 2008 07:56 PM

I think it should work with JPEG but i'm not familiar with freeimage functions.

Try to load the jpeg image and then replace the drawbitmap with the correspondent function from freeimage lib.

Also you may try to use it as a brush.

Antonio

Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM

No Wnd-backgrd.-image after chang. MODAL to MDI =&gt; SOLVED

Posted: Tue Dec 09, 2008 08:01 PM

Did you tried this ?

@ 0, 0 IMAGE oImage1 SIZE ownd:owndclient:nwidth(), ownd:owndclient:nheight OF oWnd:owndclient ADJUST
oImage1:LoadBmp( "TEST.JPG" )

Nevertheless you will need a process to repaint it every time the window is redimensioned.

Antonio

Regards

Antonio H Ferreira
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

MDI - Background

Posted: Tue Dec 09, 2008 08:16 PM
Hello AHF,

Thank You very much for the help.
I got it working now.

#include "FiveWin.ch"
#include "Image.ch"     //  !!!!!

static oWnd

FUNCTION Main()
Local hDC

DEFINE WINDOW oWnd TITLE "Background"  MDI MENU TMenu():New() 

// Define the Image
@ 0, 0 IMAGE oImage SIZE 150, 150 OF oWnd ADJUST  // Any Size
oImage:Progress( .f. )
oImage:LoadBmp( "TEST.JPG" )

.....

ACTIVATE WINDOW oWnd MAXIMIZED ;
ON PAINT ( DRAWBITMAP( hdc, oImage:hbitmap, 0, 0,; 
           oWnd:nWidth(), oWnd:nHeight()) ) ;
VALID MsgYesNo( "Do you want to end?" )

RETURN NIL


Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion