Mr. Rao,
I added a new Group to the Ribbonbar.
Now it is possible to place a Thumbnail on the MDI-frame of any defined Background ( 3 Groups ).
The Screenshot shows the Button-group with selected < transparent >
The Thumbnail shows the Image, that would be the Background, if < Image > is selected.
To paint a Thumbnail on a MDI-frame, I used :
- Code: Select all Expand view
// from the Ribbonbar :
...
...
// At Startup : lBmpActive := .F.
// --------- THUMBNAILS ----------------------
// --------------------------------------------------
// --------------------------------------------------
ADD GROUP oGroup9 RIBBON oRibbon TO OPTION 9 PROMPT "Background - Thumbnails" WIDTH 1000 FONT oFONT2
oGroup9:SetFont( oFont1 )
oGroup9:Refresh()
@ 10, 10 SELEX oSelex8 VAR nOption8 OF oGroup9 PIXEL SIZE 320, 70 ;
GRADIENT OUTTRACK { { 0.5, 16770250, 16312263 }, ;
{ 0.5, 16312263, 16770250 } };
GRADIENT INTRACK { { 0.5, 14853684, 16312263 }, ;
{ 0.5, 16312263, 14853684 } };
ITEMS "Color", "Gradient", "Brush", "Image", "???" ;
COLOR THUMB 8388608 ;
COLORTEXT 128, 32768 ;
THUMBSIZE 30, 25 ROUNDSIZE 5 ;
FONT oFont1 ;
TITLE "MDI-frame" TOP ;
COLORTITLE 0 ;
ACTION ( CLOSE_DLG(), ;
IIF( nOption8 < 5, ( SHOW_THUMB(1,nOption8), lBmpActive := .T.) , NIL ) )
oSelex8:Setoption( 5 )
...
...
// --- Test for a opened Child -----------
FUNCTION CLOSE_DLG()
IF lBmpActive = .T.
lBmpActive := .F.
oWndThumb:End()
ENDIF
RETURN( NIL )
// ----------------------------
FUNCTION SHOW_THUMB(nGroup,nSelect)
LOCAL hDC, oBmp
DEFINE WINDOW oWndThumb MDICHILD OF oWndMain FROM 50, 250 TO 200, 450 PIXEL ;
NOSYSMENU ;
NOICONIZE ;
NOCAPTION
//BORDER NONE ;
@ 0, 0 BITMAP oBMP FILENAME c_Path + "\bitmaps\32x32\Exit.bmp" ADJUST OF oWndThumb
IF nGroup = 1
IF nSelect = 1
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 1, nColor1a, 0, 0, .F., "") }
ENDIF
IF nSelect = 2
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 2, nColor1a, nColor1b, nMove1, lDirect1, "") }
ENDIF
IF nSelect = 3
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 3, 0, 0, 0, .F., cBrush1) }
ENDIF
IF nSelect = 4
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 5, 0, 0, 0, .F., cImage1) }
ENDIF
ENDIF
IF nGroup = 2
IF nSelect = 1
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 1, nColor2a, 0, 0, .F., "") }
ENDIF
IF nSelect = 2
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 2, nColor2a, nColor2b, nMove2, lDirect2, "") }
ENDIF
IF nSelect = 3
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 3, 0, 0, 0, .F., cBrush2) }
ENDIF
IF nSelect = 4
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 5, 0, 0, 0, .F., cImage2) }
ENDIF
ENDIF
IF nGroup = 3
IF nSelect = 1
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 1, nColor3a, 0, 0, .F., "") }
ENDIF
IF nSelect = 2
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 2, nColor3a, nColor3b, nMove3, lDirect3, "") }
ENDIF
IF nSelect = 3
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 3, 0, 0, 0, .F., cBrush3) }
ENDIF
IF nSelect = 4
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 5, 0, 0, 0, .F., cImage3) }
ENDIF
ENDIF
ACTIVATE WINDOW oWndThumb ;
ON INIT oBmp:Move( 0, 0, 200, 150, .T. )
RETURN( NIL )
FUNCTION DRAW_BRUSH( oBitmap, hDC, nStyle, nVColor, nBColor, nMove, lDirect, cImage )nStyle : selected 1 = Color, 2 = Gradient, 3 = Brush (tiled), 4 = Brush (adjusted), 5 = Image
nVColor := 1. Gradient-color or Color
nBColor : 2. Gradient-color
nMove := 2. Gradient-color-position
lDirect := Vertical, horizontal
cImage := Brush or Image
from Code :1. Color Preview :@ 100, 100 BITMAP oBMP FILENAME c_Path + "\bitmaps\32x32\Exit.bmp" ADJUST OF oWndThumb
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 1, nColor1, 0, 0, .F., "") }
2. Gradient Preview :@ 100, 100 BITMAP oBMP FILENAME c_Path + "\bitmaps\32x32\Exit.bmp" ADJUST OF oWndThumb
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 2, nColor1, nColor2, nMove, .F., "") }
3. Brush Preview ( tiled ) :@ 100, 100 BITMAP oBMP FILENAME c_Path + "\bitmaps\32x32\Exit.bmp" ADJUST OF oWndThumb
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 3, 0, 0, 0, .F., cBrush) }
4. Brush Preview ( adjusted ) :@ 100, 100 BITMAP oBMP FILENAME c_Path + "\bitmaps\32x32\Exit.bmp" ADJUST OF oWndThumb
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 4, 0, 0, 0, .F., cBrush) }
5. Image Preview :@ 100, 100 BITMAP oBMP FILENAME c_Path + "\bitmaps\32x32\Exit.bmp" ADJUST OF oWndThumb
oBMP:bPainted := {|hDC| DRAW_BRU( oBMP, hDC, 5, 0, 0, 0, .F., cImage) }
// Define BMP-size and Position using ON INIT !!!!
// --------------------------------------------------------
ACTIVATE WINDOW oWnd ;
ON INIT oBmp:Move( 50, 50, 250, 200, .T. )
from Resource :REDEFINE BITMAP oBMP ID 100 ADJUST RESOURCE "Blanc" OF oDlg // any small BMP from Resource or File
oBMP:bPainted := {|hDC| DRAW_BRU(oBMP, hDC, 1, nColor1, 0, 0, .F., "") }
- Code: Select all Expand view
// ---------- IMAGE / BMP-BRUSH ( Color, Gradient, Brush, Image ) ------------
FUNCTION DRAW_BRUSH( oBitmap, hDC, nStyle, nVColor, nBColor, nMove, lDirect, cImage )
LOCAL oNewBrush, nRow := 0, nCol := 0, n
LOCAL aGrad := { { nMove, nVColor, nBColor }, { nMove, nBColor, nVColor } }
LOCAL aRect := GETCLIENTRECT( oBitmap:hWnd )
IF nStyle = 1 // Color
aRect := GETCLIENTRECT( oBitmap:hWnd )
DEFINE BRUSH oNewbrush COLOR nVColor
FillRect( oBitmap:hDC, aRect, oNewbrush:hBrush )
RELEASE BRUSH oNewbrush
ENDIF
IF nStyle = 2 // Gradient
DEFINE BRUSH oNewBrush COLOR GradientFill( hDC, 0, 0, aRect[3], aRect[4], aGrad, lDirect )
FillRect( hDC, aRect, oNewBrush:hBrush )
oBitmap:ReleaseDC()
RELEASE BRUSH oNewbrush
ENDIF
IF nStyle = 3 // Brush ( tiled )
DEFINE BITMAP oNewbrush FILENAME cImage
nHeight := oNewbrush:nHeight
nWidth := oNewbrush:nWidth
IF aRect[3] > 0
DO WHILE nRow < aRect[3]
nCol = 0
DO WHILE nCol < aRect[4]
PalBmpDraw( hDC, nRow, nCol, oNewbrush:hBitmap )
nCol += nHeight
ENDDO
nRow += nWidth
ENDDO
ENDIF
ENDIF
IF nStyle = 4 // Brush ( stretched )
DEFINE BITMAP oNewbrush FILENAME cImage
PalBmpDraw( hDC, 0, 0, oBitmap:hBitmap, , aRect[4], aRect[3] )
ENDIF
IF nStyle = 5 // Image
DEFINE IMAGE oNewbrush FILENAME cImage
PalBmpDraw( hDC, 0, 0, oNewbrush:hBitmap, , aRect[4], aRect[3] )
ENDIF
RETURN( NIL )
Best Regards
Uwe