FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Possible to change Background of the Main-Wnd from Child ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Possible to change Background of the Main-Wnd from Child ?
Posted: Mon Apr 07, 2008 08:19 PM
Hello,

I want to change the Background of the Main-Window
from Inside of a Child.
It checked different versions for background-setting.
It don't know, if it is possible.
Inside of the child for the dialog, there is no problem.
I want to make it possible, to do all settings with a preview.

I start a Dialog with folder as a MDI-Child, from a Office2007-Buttonbar.



Regards

Uwe[/img]
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: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Possible to change Background of the Main-Wnd from Child ?
Posted: Mon Apr 07, 2008 09:57 PM

Uwe,

How are you actually setting the background image of the main window in your code ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Changing Background of Windows and Dialogs
Posted: Tue Apr 08, 2008 12:22 PM
Antonio

I changed this part with the option < as picture or tiled >,
because i think, it is better to show window-background and
dialog-background together.



FUNCTION TILED_IMG(oBitmap,cBitmap)
LOCAL nRow := 0, nCol := 0, n

hDC := oBitmap:GETDC()

DEFINE BITMAP oImg1 FILENAME cBITMAP

nBmpWidth := oBmp:nWidth()
nBmpHeight := oBmp:nHeight()

// 200 and 280 = Resource-size
// ---------------------------------------

IF nBmpWidth > 0 .and. nBmpHeight > 0 
    DO WHILE nRow < 200
         nCol = 0
         DO WHILE nCol < 280
              PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap )
              nCol += nBmpWidth
         ENDDO
         nRow += nBmpHeight
    ENDDO
ELSE
    MsgAlert( "Not possible to use Picture " + CRLF + ;
                   cBitmap + CRLF + ; 
                   "for TILED-selection !", "ATTENTION" ) 
ENDIF

RETURN( NIL )

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

FUNCTION PICTURE_IMG(oBitmap,cBitmap)

DEFINE IMAGE oImg2 FILENAME cBitmap
PalBmpDraw( oBitmap:GETDC(), 0, 0, oImg2:hBitmap, , 280, 200 ) 

RETURN( NIL )


Thank you

Regards

Uwe :-) [/img][/code]
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: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Possible to change Background of the Main-Wnd from Child ?
Posted: Tue Apr 08, 2008 01:57 PM

Uwe,

Important: Everytime that you call to <oControl>:GETDC(), after that, you have to call <oControl>:ReleaseDC(), or you keep an unreleased hDC, thus consuming GDI resources.

I see from your code that you use a bitmap control on top of the window, to show a bitmap. You can directly use oWnd:GetDC() and paint on top of the window, so there is no need to use a @ ..., ... BITMAP there.

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion