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

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

Postby ukoenig » Tue Dec 09, 2008 6: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 ) ?

Code: Select all  Expand view

//-----  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 :lol:
Last edited by ukoenig on Wed Dec 10, 2008 10:40 am, edited 3 times in total.
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby AHF » Tue Dec 09, 2008 6: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Image-background MDI

Postby ukoenig » Tue Dec 09, 2008 7: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 ?

Code: Select all  Expand view

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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby AHF » Tue Dec 09, 2008 7: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby AHF » Tue Dec 09, 2008 8: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

MDI - Background

Postby ukoenig » Tue Dec 09, 2008 8:16 pm

Hello AHF,

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

Code: Select all  Expand view

#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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 102 guests