Yes Dear Friend.
Perhaps even refer to the application itself!
Is it possible?
Marco
I knew this and also I thought this could be fixed. If in principle, this is taking us in the right direction avoiding re-reading data from source atleast when repainting in non-focused state, then we can proceed further to improve this.
Saving and restoring the bitmap is painting the saved image one pixel off from the original position. This can be fixed.
#include "fivewin.ch"
#xtranslate DelObj <o> => If <o> != nil; DeleteObject( <o> ); endif; <o> := nil
REQUEST HB_GT_GUI_DEFAULT
ANNOUNCE RDDSYS
STATIC oDlg
FUNCTION MAIN()
LOCAL oBrw
LOCAL oGet , cGet := " "
LOCAL aRec := {}
LOCAL nIni
LOCAL nRig
LOCAL nFin
LOCAL nCur := 1
SET DELETED ON
SET EXCLUSIVE OFF
USE customer
SET INDEX TO customer
nRig := 20
nIni := 1
nFin := 1
DEFINE DIALOG oDlg FROM 1 , 1 TO 600 , 800 PIXEL
@ 1 , 1 GET oGet VAR cGet OF oDlg
oBrw := TXBR3():new( 2 , 1 , 800 , 600 )
oDlg:nStyle = NOR( oDlg:nStyle, WS_THICKFRAME, WS_MAXIMIZEBOX , WS_MINIMIZEBOX )
oDlg:bResized = { || Ridim( oDlg, oBrw ) }
ACTIVATE DIALOG oDlg ON INIT ridim( oDlg , obrw )
RETURN NIL
FUNCTION RIDIM( oDlg, oBrw )
LOCAL aInfo := oDlg:DispBegin()
oBrw:nWidth = oDlg:nWidth - 20
oBrw:nHeight = oDlg:nHeight - 120
oDlg:DispEnd( aInfo )
oBrw:lForcepaint := .T.
oBrw:Paint()
RETURN NIL
CLASS TXBR3 FROM TWBROWSE
CLASSDATA lRegistered AS LOGICAL // used internally
DATA hSaveScr
DATA lForcePaint
METHOD Paint()
METHOD Destroy()
ENDCLASS
METHOD PAINT() CLASS TXBR3
LOCAL aInfo
IF ::lForcePaint
DelObj ::hSaveScr
Super:Paint()
::lForcePaint := .F.
ELSE
IF ::hSaveScr != nil .and. GetFocus() != ::hWnd
aInfo := ::DispBegin()
DrawBitmap( ::hDC, ::hSaveScr, -2, -2 )
::DispEnd( aInfo )
ELSE
Super:Paint()
DelObj ::hSaveScr
::hSaveScr := WndBitMap( ::hWnd )
ENDIF
ENDIF
return nil
METHOD Destroy() CLASS TXBR3
DelObj ::hSaveScr
return Super:Destroy()
INIT PROCEDURE RddInit
REQUEST DBFFPT
REQUEST DBFCDX
rddSetDefault( "DBFCDX" )
#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"
void DrawBitmap( HDC hdc, HBITMAP hbm, int wCol, int wRow, WORD wWidth,
WORD wHeight, DWORD dwRaster )
{
HDC hDcMem, hDcMemX;
BITMAP bm, bmx;
HBITMAP hBmpOld, hbmx, hBmpOldX;
if( !hdc || !hbm )
return;
hDcMem = CreateCompatibleDC( hdc );
hBmpOld = ( HBITMAP ) SelectObject( hDcMem, hbm );
if( ! dwRaster )
dwRaster = SRCCOPY;
GetObject( hbm, sizeof( BITMAP ), ( LPSTR ) &bm );
if( ! wWidth || ! wHeight )
BitBlt( hdc, wRow, wCol, bm.bmWidth, bm.bmHeight, hDcMem, 0, 0, dwRaster );
else
{
hDcMemX = CreateCompatibleDC( hdc );
bmx = bm;
bmx.bmWidth = wWidth;
bmx.bmHeight = wHeight;
bmx.bmWidthBytes = ( bmx.bmWidth * bmx.bmBitsPixel + 15 ) / 16 * 2;
hbmx = CreateBitmapIndirect( &bmx );
hBmpOldX = ( HBITMAP ) SelectObject( hDcMemX, hbmx );
StretchBlt( hDcMemX, 0, 0, wWidth, wHeight, hDcMem, 0, 0,
bm.bmWidth, bm.bmHeight, dwRaster );
BitBlt( hdc, wRow, wCol, wWidth, wHeight, hDcMemX, 0, 0, dwRaster );
SelectObject( hDcMemX, hBmpOldX );
DeleteDC( hDcMemX );
DeleteObject( hbmx );
}
SelectObject( hDcMem, hBmpOld );
DeleteDC( hDcMem );
}
HB_FUNC( DRAWBITMAP ) // hDC, hBitmap, nRow, nCol, nWidth, nHeight, nRaster
{
DrawBitmap( ( HDC ) hb_parnl( 1 ), ( HBITMAP ) hb_parnl( 2 ),
( int ) hb_parni( 3 ), ( int ) hb_parni( 4 ),
( WORD ) hb_parni( 5 ), ( WORD ) hb_parni( 6 ), hb_parnl( 7 ) );
}
#pragma ENDDUMP
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 69 guests