@ 10,10 BITMAP filename "test.bmp" SIZE 64,64 DESIGN
i MUST MOVE THIS BITMAP ON A WINDOW WITH DRAWGRID FUNCTION
THIS BITMAP IS NOT TRANSPARENT AND WHEN i MOVE IT COPY THE BACKGROUND ON NEW POSITION
HOW i CAN TO MOVE THIS BITMAP ON MODE TRANSPARENT ON THIS WINDOW ?
THE SIMPLY CODE
- Code: Select all Expand view RUN
- #include "fivewin.ch"
FUNCTION main()
LOCAL oWnd ,oBmp
DEFINE window oWnd FROM 10,10 TO 80,80
@ 10,10 BITMAP oBmp filename "C:\FWH\bitmaps\32x32\plus.bmp" DESIGN SIZE 64,64
oBmp:ltransparent:=.t.
ACTIVATE window oWnd ON PAINT DRAWGRID( oWnd:hWnd, oWnd:hdc, 1, 30, 30 )
RETURN NIL
#pragma BEGINDUMP
#include <Windows.h>
#include <HbApi.h>
//----------------------------------------------------------------------------//
HB_FUNC( DRAWGRID ) // hWnd, hDC, @cPS, wGridX, wGridY
{
WORD wRow, wCol;
HDC hDC = ( HDC ) hb_parnl( 2 );
PAINTSTRUCT * ps = ( PAINTSTRUCT * ) hb_parc( 3 );
WORD wGridX = hb_parni( 4 );
WORD wGridY = hb_parni( 5 );
RECT rc;
WORD wWidth, wHeight;
HPEN hOldPen;
HPEN hGray = CreatePen( PS_SOLID, 0, RGB( 210, 210, 210 ) );
HPEN hGray2 = CreatePen( PS_SOLID, 0, RGB( 230, 230, 230 ) );
hOldPen = ( HPEN ) SelectObject( hDC, hGray );
GetWindowRect( ( HWND ) hb_parnl( 1 ), &rc );
wWidth = rc.right - rc.left + 1;
wHeight = rc.bottom - rc.top + 1;
for( wRow = 0; wRow <= wHeight; wRow += wGridX )
{
MoveTo( hDC, 0, wRow );
LineTo( hDC, wWidth, wRow ) ;
}
for( wCol = 0; wCol <= wWidth; wCol += wGridY )
{
MoveTo( hDC, wCol, 0 );
LineTo( hDC, wCol, wHeight ) ;
}
SelectObject( hDC, hGray2 );
for( wRow = wGridX/2; wRow <= wHeight; wRow += wGridX )
{
MoveTo( hDC, 0, wRow );
LineTo( hDC, wWidth, wRow ) ;
}
for( wCol = wGridY/2; wCol <= wWidth; wCol += wGridY )
{
MoveTo( hDC, wCol, 0 );
LineTo( hDC, wCol, wHeight ) ;
}
SelectObject( hDC, hOldPen );
DeleteObject( hGray );
DeleteObject( hGray2);
//SetPixel( hDC, wCol, wRow, 0 );
}
//----------------------------------------------------------------------------//
#pragma ENDDUM