Page 1 of 1
Possible to change Background of the Main-Wnd from Child ?
Posted: Mon Apr 07, 2008 8:19 pm
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.
Regards
Uwe[/img]
Posted: Mon Apr 07, 2008 9:57 pm
by Antonio Linares
Uwe,
How are you actually setting the background image of the main window in your code ?
Changing Background of Windows and Dialogs
Posted: Tue Apr 08, 2008 12:22 pm
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.
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
[/img][/code]
Posted: Tue Apr 08, 2008 1:57 pm
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.