FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour GRID ON RPREVIEW
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
GRID ON RPREVIEW
Posted: Thu Jan 14, 2010 09:42 AM
Dear Antonio,
I WANT insert A grid on metafile of rpreview as that is on Fadst Report you can see in this picture



I try with DrawGrid( ::hWnd, ::hDC,10, 10, 10 )



but it design a grid with point and not with rectangule as fastreport




I understood I must modify the dragrid function but How I can insert a rectangule instead setpixel function ?


Any Idea ?
Best Regards, Saludos



Falconi Silvio
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: GRID ON RPREVIEW
Posted: Thu Jan 14, 2010 04:30 PM

Silvio,

change setPixel by moveto(..) lineto(..) c function

regards

Marcelo

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: GRID ON RPREVIEW
Posted: Fri Jan 15, 2010 08:51 AM

it is not easy to do

Best Regards, Saludos



Falconi Silvio
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: GRID ON RPREVIEW
Posted: Fri Jan 15, 2010 03:58 PM
Hola,

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

FUNCTION main()
LOCAL oWnd

DEFINE window oWnd FROM 10,10 TO 30,30


ACTIVATE window oWnd ON PAINT DRAWGRID( oWnd:hWnd, oWnd:hdc, 1, 10, 10 )

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, 1, RGB( 200, 200, 200 ) );
   
   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, hOldPen );
   DeleteObject( hGray );

         //SetPixel( hDC, wCol, wRow, 0 );
}

//----------------------------------------------------------------------------//

#pragma ENDDUMP
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: GRID ON RPREVIEW
Posted: Fri Jan 15, 2010 06:43 PM


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

FUNCTION main()
LOCAL oWnd

DEFINE window oWnd FROM 10,10 TO 30,30


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( hGray 2);

         //SetPixel( hDC, wCol, wRow, 0 );
}

//----------------------------------------------------------------------------//

#pragma ENDDUMP
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: GRID ON RPREVIEW
Posted: Fri Jan 15, 2010 07:19 PM

you're a GREAT!!!!!!!!!!!!!!

I sent you an email !!!!

Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: GRID ON RPREVIEW
Posted: Fri Jan 15, 2010 07:38 PM
buT ON XHARBOUR MAKE ERRORS

Progetto: TEST, Ambiente: xFiveWin:
[1]:Harbour.Exe TEST.PRG /m /n /es2 /iC:\work\FWH\include /ic:\work\xHarbour\Include /iinclude;c:\work\fwh\include;c:\work\xHarbour\include /oObj\TEST.c
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)
Copyright 1999-2009, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'TEST.PRG'...
Lines 13, Functions/Procedures 1
Generating C source output to 'Obj\TEST.c'...
Done.
[1]:Bcc32.Exe -M -c -O2 -tW -v- -X -DHB_FM_STATISTICS_OFF -DHB_NO_DEFAULT_API_MACROS -DHB_NO_DEFAULT_STACK_MACROS -DHB_OS_WIN_32 -IC:\work\FWH\include -Ic:\work\BCC55\Include;c:\work\xHarbour\Include -nObj Obj\TEST.c
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
Obj\TEST.c:
Warning W8065 TEST.PRG 42: Call to function 'MoveTo' with no prototype in function HB_FUN_DRAWGRID
Warning W8065 TEST.PRG 48: Call to function 'MoveTo' with no prototype in function HB_FUN_DRAWGRID
Warning W8065 TEST.PRG 56: Call to function 'MoveTo' with no prototype in function HB_FUN_DRAWGRID
Warning W8065 TEST.PRG 62: Call to function 'MoveTo' with no prototype in function HB_FUN_DRAWGRID
Error E2121 TEST.PRG 68: Function call missing ) in function HB_FUN_DRAWGRID
Warning W8004 TEST.PRG 71: 'ps' is assigned a value that is never used in function HB_FUN_DRAWGRID
*** 1 errors in Compile ***
Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: GRID ON RPREVIEW
Posted: Fri Jan 15, 2010 07:43 PM
i FOUND THE ERROR
ON SOURCE DeleteObject( hGray2); INSTEAD OF DeleteObject( hGray 2);
Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: GRID ON RPREVIEW
Posted: Fri Jan 15, 2010 08:26 PM

Marcello,

if you try to insert an control it is not transparent , it not run ok why ?

sample

@ 2,1 say osay Prompt "test" of oWnd size 40,100 DESIGN TRANSPARENT

or

@ 2,1 say osay Prompt "test" of oWnd size 40,100 DESIGN
oSay:ltransparent:=.t.

I try to insert :

if ::lTransparent
SetWindowLong( ::hWnd, GWL_EXSTYLE, WS_EX_TRANSPARENT )
endif

it is trasparent but when I move the object it not erase the backgroud of the same object

you can try with Tgroup class to create a Box trasparent : it not run when I move the class group it not erase the background

Best Regards, Saludos



Falconi Silvio
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: GRID ON RPREVIEW
Posted: Fri Jan 15, 2010 08:34 PM

Silvio,

because you are trying to develog a visula report designer I think you need to develog your own canvas to paint the controls and the grid in the correct order

regards

Marcelo

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: GRID ON RPREVIEW
Posted: Fri Jan 15, 2010 08:49 PM

yes I use many own class to create the object

Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: GRID ON RPREVIEW
Posted: Fri Jan 15, 2010 08:51 PM

I sent you an sample now

Best Regards, Saludos



Falconi Silvio

Continue the discussion