La cuestion es que utilizo PalBmpDraw() con el Raster "SRCAND" para, de cierta manera, fundir un grafico BMP (con fondo blanco) con el color de fondo del Dialogo. Todo bien, ya lo he hecho varias veces. La cuestion es que cuando intento variar el tamaño del grafico, entonces "SRCAND" no actúa. Lo mismo ocurre con otros valor de Raster. SCRPAINT, ETC
¿alguna sugerencia?
¿Con xHarbour si lo haría?
Gracias
PalBmpDraw()
PalBmpDraw()
Nos Gusta Programar
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
El caso es que de esa forma saldría tranparente, yo quiero una coisa más traslucida.
Al final lo he solucionado con el siguiente código:
PRG de FW
-------------
DEFINE BITMAP oBmp NAME ...
*
hCDc := CreateCDC(hDc)
SelectObject(hCDC,oBmp:hBitmap)
StretchBmp(hDc,10,20,nNeoWidth,nNeoHeight,hCDC,0,0,hBmp:nWidth,hBmp:nHeight, raster)
DeleteDc(hCDc)
DLL32 FUNCTION StretchBmp( hdc AS LONG,x AS LONG,y AS LONG,nWidth AS LONG,nHeight AS LONG, ;
hSrcDC AS LONG,xSrc AS LONG,ySrc AS LONG,nSrcWidth AS LONG,nSrcHeight AS LONG,dwRop AS LONG ) AS LONG ;
PASCAL FROM "StretchBlt" LIB "gdi32.dll"
en C:
-----
CLIPPER StretchMBitmap( PARAMS ) // ( HDC hdc, HBITMAP hBmp, RECT aRect, WORD raster )
{
HDC hdc = ( HDC ) _parnl( 1 ) ;
HDC hDcTemp = CreateCompatibleDC( hdc ) ;
HBITMAP hOld = ( HBITMAP ) SelectObject( hDcTemp, ( HBITMAP ) _parnl( 2 ) ) ;
DWORD raster = IF( PCOUNT() == 4, _parnl( 4 ), 0 ) ;
RECT rct ;
BITMAP bmp ;
rct.top = _parnl( 3, 1 ) ;
rct.left = _parnl( 3, 2 ) ;
rct.bottom = _parnl( 3, 3 ) ;
rct.right = _parnl( 3, 4 ) ;
GetObject( ( HGDIOBJ ) _parnl( 2 ), sizeof( BITMAP ), ( LPSTR ) &bmp ) ;
StretchBlt( hdc, rct.top, rct.left, rct.right-rct.left+1, rct.bottom-rct.top+1, hDcTemp, 0, 0, bmp.bmWidth, bmp.bmHeight, raster ) ;
DeleteObject( SelectObject(hDcTemp, hOld) ) ;
DeleteDC(hDcTemp) ;
}
Sin embargo, es curioso que el código FW no funciona en XP (o al menos en el mio) pero el escrito en C si funciona.
Al final lo he solucionado con el siguiente código:
PRG de FW
-------------
DEFINE BITMAP oBmp NAME ...
*
hCDc := CreateCDC(hDc)
SelectObject(hCDC,oBmp:hBitmap)
StretchBmp(hDc,10,20,nNeoWidth,nNeoHeight,hCDC,0,0,hBmp:nWidth,hBmp:nHeight, raster)
DeleteDc(hCDc)
DLL32 FUNCTION StretchBmp( hdc AS LONG,x AS LONG,y AS LONG,nWidth AS LONG,nHeight AS LONG, ;
hSrcDC AS LONG,xSrc AS LONG,ySrc AS LONG,nSrcWidth AS LONG,nSrcHeight AS LONG,dwRop AS LONG ) AS LONG ;
PASCAL FROM "StretchBlt" LIB "gdi32.dll"
en C:
-----
CLIPPER StretchMBitmap( PARAMS ) // ( HDC hdc, HBITMAP hBmp, RECT aRect, WORD raster )
{
HDC hdc = ( HDC ) _parnl( 1 ) ;
HDC hDcTemp = CreateCompatibleDC( hdc ) ;
HBITMAP hOld = ( HBITMAP ) SelectObject( hDcTemp, ( HBITMAP ) _parnl( 2 ) ) ;
DWORD raster = IF( PCOUNT() == 4, _parnl( 4 ), 0 ) ;
RECT rct ;
BITMAP bmp ;
rct.top = _parnl( 3, 1 ) ;
rct.left = _parnl( 3, 2 ) ;
rct.bottom = _parnl( 3, 3 ) ;
rct.right = _parnl( 3, 4 ) ;
GetObject( ( HGDIOBJ ) _parnl( 2 ), sizeof( BITMAP ), ( LPSTR ) &bmp ) ;
StretchBlt( hdc, rct.top, rct.left, rct.right-rct.left+1, rct.bottom-rct.top+1, hDcTemp, 0, 0, bmp.bmWidth, bmp.bmHeight, raster ) ;
DeleteObject( SelectObject(hDcTemp, hOld) ) ;
DeleteDC(hDcTemp) ;
}
Sin embargo, es curioso que el código FW no funciona en XP (o al menos en el mio) pero el escrito en C si funciona.
Nos Gusta Programar