GRID ON RPREVIEW

GRID ON RPREVIEW

Postby Silvio » Thu Jan 14, 2010 9: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

Image

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



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

Image


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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: GRID ON RPREVIEW

Postby Marcelo Via Giglio » Thu Jan 14, 2010 4:30 pm

Silvio,

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

regards

Marcelo
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: GRID ON RPREVIEW

Postby Silvio » Fri Jan 15, 2010 8:51 am

it is not easy to do
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: GRID ON RPREVIEW

Postby Marcelo Via Giglio » Fri Jan 15, 2010 3:58 pm

Hola,

Code: Select all  Expand view
#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
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: GRID ON RPREVIEW

Postby Marcelo Via Giglio » Fri Jan 15, 2010 6:43 pm

Image

Code: Select all  Expand view
#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
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: GRID ON RPREVIEW

Postby Silvio » Fri Jan 15, 2010 7:19 pm

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

I sent you an email !!!!
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: GRID ON RPREVIEW

Postby Silvio » Fri Jan 15, 2010 7: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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: GRID ON RPREVIEW

Postby Silvio » Fri Jan 15, 2010 7:43 pm

i FOUND THE ERROR
ON SOURCE DeleteObject( hGray2); INSTEAD OF DeleteObject( hGray 2);
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: GRID ON RPREVIEW

Postby Silvio » Fri Jan 15, 2010 8: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
Last edited by Silvio on Fri Jan 15, 2010 8:44 pm, edited 1 time in total.
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: GRID ON RPREVIEW

Postby Marcelo Via Giglio » Fri Jan 15, 2010 8: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
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: GRID ON RPREVIEW

Postby Silvio » Fri Jan 15, 2010 8:49 pm

yes I use many own class to create the object
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: GRID ON RPREVIEW

Postby Silvio » Fri Jan 15, 2010 8:51 pm

I sent you an sample now
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 90 guests