I couldn't find any problems.
Can You test these 2 samples ?
From WINDOWS
Code: Select all
#include 'fivewin.ch'
#include 'ord.ch'
#include 'xbrowse.ch'
REQUEST DBFCDX
static oSysFont, cBmpPath := '..\bitmaps\'
FUNCTION MAIN()
local oWnd, oBar, oBrw
oSysFont := TFont():New("Arial",0,-14,.F.,.T.,0,0,0,.T. )
USE CUSTOMER SHARED
DEFINE WINDOW oWnd TITLE 'XBrowse BackGrounds ( WINDOWS )'
@ 0, 0 XBROWSE oBrw OF oWnd ;
PIXEL FONT oSysFont ;
ALIAS 'CUSTOMER' AUTOCOLS ;
CELL LINES ;
COLOR CLR_WHITE, CLR_BLUE
// obrw:acols[2]:cdatatype := 'P'
DEFINE BUTTONBAR oBar OF oWnd SIZE 100,32 2007
DEFINE BUTTON OF oBar PROMPT 'Image' ;
ACTION BckFromImage( oBrw ) FONT oSysfont TOOLTIP "Load new Image ..."
DEFINE BUTTON OF oBar PROMPT 'Paste' ;
ACTION BckPaste( oBrw ) FONT oSysfont TOOLTIP "Paste Image ..."
DEFINE BUTTON OF oBar PROMPT 'Clear' ;
ACTION oBrw:SetBackGround() FONT oSysfont TOOLTIP "Clear Background ..."
DEFINE BUTTON OF oBar PROMPT 'Tiled' GROUP ;
ACTION oBrw:SetBackGround( nil, BCK_TILED ) FONT oSysfont TOOLTIP "Show TILED Image ..."
DEFINE BUTTON OF oBar PROMPT 'Stretch' ;
ACTION oBrw:SetBackGround( nil, BCK_STRETCH ) FONT oSysfont TOOLTIP "Show STRETCHED Image ..."
DEFINE BUTTON OF oBar PROMPT 'Fill' ;
ACTION oBrw:SetBackGround( nil, BCK_FILL ) FONT oSysfont TOOLTIP "FILL Background with Image ..."
DEFINE BUTTON OF oBar PROMPT 'Quit' GROUP ;
ACTION oWnd:End() FONT oSysfont TOOLTIP "QUIT xBrowse-test ..."
SET MESSAGE OF oWnd TO FWVERSION 2007
oBrw:SetBackGround( '..\bitmaps\olga1.jpg', BCK_FILL )
oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd MAXIMIZED
oSysfont:End()
RETURN NIL
// --------------
STATIC FUNCTION BCKFROMIMAGE( oBrw )
local cImage
IF ! Empty( cImage := cGetFile( "Image File (*.bmp,jpg,png)|*.bmp;*.png;*.jpg|", ;
"Select Image file ",, '..\bitmaps\' ) )
oBrw:SetBackGround( cImage )
ENDIF
RETURN NIL
// ---------------
STATIC FUNCTION BCKPASTE( oBrw )
local oClp, hBmp
DEFINE CLIPBOARD oClp OF oBrw FORMAT BITMAP
hBmp := oClp:GetBitmap()
IF hBmp == 0
MsgInfo( 'No image in clipboard' )
ELSE
oBrw:SetBackGround( hBmp )
oClp:Clear()
ENDIF
oClp:End()
RETURN NIL
From DIALOG ( Nowait )
Code: Select all
#include 'fivewin.ch'
#include 'ord.ch'
#include 'xbrowse.ch'
REQUEST DBFCDX
static oSysFont, cBmpPath := '..\bitmaps\'
FUNCTION MAIN()
local oWnd, oDlg, oBar, oBrw
oSysFont := TFont():New("Arial",0,-14,.F.,.T.,0,0,0,.T. )
USE CUSTOMER SHARED
DEFINE WINDOW oWnd TITLE 'XBrowse BackGrounds ( DIALOG )'
DEFINE DIALOG oDlg FROM 50, 50 TO 500, 700 OF oWnd PIXEL ;
TITLE 'XBrowse BackGrounds ( Dialog-test )' ;
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
@ 0, 0 XBROWSE oBrw OF oDlg ;
SIZE 400, 300 PIXEL FONT oSysFont ;
ALIAS 'CUSTOMER' AUTOCOLS ;
CELL LINES ;
COLOR CLR_WHITE, CLR_BLUE
// obrw:acols[2]:cdatatype := 'P'
DEFINE BUTTONBAR oBar OF oWnd SIZE 100,32 2007
DEFINE BUTTON OF oBar PROMPT 'Image' ;
ACTION BckFromImage( oWnd, oBrw ) FONT oSysfont TOOLTIP "Load new Image ..."
DEFINE BUTTON OF oBar PROMPT 'Brush' ;
ACTION BckFromBrush( oWnd, oBrw ) FONT oSysfont TOOLTIP "Load new Brush ..."
DEFINE BUTTON OF oBar PROMPT 'Paste' ;
ACTION BckPaste( oBrw ) FONT oSysfont TOOLTIP "Paste Image ..."
DEFINE BUTTON OF oBar PROMPT 'Clear' ;
ACTION oBrw:SetBackGround() FONT oSysfont TOOLTIP "Clear Background ..."
DEFINE BUTTON OF oBar PROMPT 'Tiled' GROUP ;
ACTION oBrw:SetBackGround( nil, BCK_TILED ) FONT oSysfont TOOLTIP "Show TILED Image ..."
DEFINE BUTTON OF oBar PROMPT 'Stretch' ;
ACTION oBrw:SetBackGround( nil, BCK_STRETCH ) FONT oSysfont TOOLTIP "Show STRETCHED Image ..."
DEFINE BUTTON OF oBar PROMPT 'Fill' ;
ACTION oBrw:SetBackGround( nil, BCK_FILL ) FONT oSysfont TOOLTIP "FILL Background with Image ..."
DEFINE BUTTON OF oBar PROMPT 'Quit' GROUP ;
ACTION ( oDlg:End(), oWnd:End() ) FONT oSysfont TOOLTIP "QUIT xBrowse-test ..."
SET MESSAGE OF oWnd TO FWVERSION 2007
oBrw:SetBackGround( '..\bitmaps\olga1.jpg', BCK_FILL )
oBrw:CreateFromCode()
oDlg:oClient := oBrw
ACTIVATE DIALOG oDlg NOWAIT CENTERED ;
ON INIT oBrw:Move( 0, 0, oDlg:nWidth -5, oDlg:nHeight - 25, .T. )
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT W_BACKGRD( oWnd, 2, , cBmpPath + 'olga1.jpg' )
oSysfont:End()
RETURN NIL
// -------------------------
STATIC FUNCTION BCKFROMIMAGE( oWnd, oBrw )
local cImage
IF ! Empty( cImage := cGetFile( "Image File (*.bmp,jpg,png)|*.bmp;*.png;*.jpg|", ;
"Select Image file ",, '..\bitmaps\' ) )
oBrw:SetBackGround( cImage )
W_BACKGRD( oWnd, 2, , cImage )
ENDIF
RETURN NIL
// -------------------------
STATIC FUNCTION BCKFROMBRUSH( oWnd, oBrw )
local cImage
IF ! Empty( cImage := cGetFile( "Image File (*.bmp,jpg,png)|*.bmp;*.png;*.jpg|", ;
"Select Image file ",, '..\bitmaps\backgrnd\' ) )
oBrw:SetBackGround( cImage, BCK_TILED )
W_BACKGRD( oWnd, 1, , cImage )
ENDIF
RETURN NIL
// ------------------
STATIC FUNCTION BCKPASTE( oBrw )
local oClp, hBmp
DEFINE CLIPBOARD oClp OF oBrw FORMAT BITMAP
hBmp := oClp:GetBitmap()
IF hBmp == 0
MsgInfo( 'No image in clipboard' )
ELSE
oBrw:SetBackGround( hBmp )
oClp:Clear()
ENDIF
oClp:End()
RETURN NIL
// -------- WINDOW - Background Modal ---------------
FUNCTION W_BACKGRD( oWnd, nStyle, cBrush, cImage )
local oBrush
IF nStyle = 1 // BMP-BRUSH
DEFINE BRUSH oBrush FILE cImage
ENDIF
IF nStyle = 2 // Image ADJUSTED
DEFINE IMAGE oImage FILE cImage
oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap, oWnd:nWidth, oWnd:nHeight , .T. ) )
oImage:End()
ENDIF
oWnd:SetBrush( oBrush )
oBrush:End()
RETURN( NIL )
Best Regards
Uwe