Possible to change Background of the Main-Wnd from Child ?

Post Reply
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Possible to change Background of the Main-Wnd from Child ?

Post by ukoenig »

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.

Image

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.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Uwe,

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

Antonio Linares
www.fivetechsoft.com
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Changing Background of Windows and Dialogs

Post by ukoenig »

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.

Image

Code: Select all


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 :lol: [/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.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
Post Reply