FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TO ANTONIO TEST TRANPARENT NOT RUN OK
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
TO ANTONIO TEST TRANPARENT NOT RUN OK
Posted: Sat Jan 23, 2010 04:33 PM


WHY IT IS NOT TRANSPARENT ?


Code (fw): Select all Collapse
#include "fivewin.ch"

#define GRID_X    20
#define GRID_Y    20

static oWnd


function test()
Local cBitmap:="C:\FWH\bitmaps\32x32\star.bmp"
Local oSprite
DEFINE WINDOW oWnd TITLE "Transparent test + Grid"  from 1,1 to 600,600 pixel


      @ 40, 80 BITMAP oSprite;
              FILENAME cBitmap;
              PIXEL NOBORDER  of oWnd DESIGN TRANSPARENT   SIZE 64,64

                  oSprite:ltransparent:=.t.




ACTIVATE WINDOW oWnd ;
       ON PAINT DrawGrid( oWnd:hWnd, hDC, cPS, GRID_X, GRID_Y )

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 ENDDUMP
FWH .. BC582.. xharbour

Continue the discussion