How to get a printout equal to what I see on the rich edit control? I'm using testrtf.prg/testrtf.rtf sample but the printed text gets a different formatting.
EMG
#define LOGPIXELSX 88
#define LOGPIXELSY 90
#define HORZRES 8
#define VERTRES 10
#define HORZSIZE 4
#define VERTSIZE 6
#define PHYSICALWIDTH 110
#define PHYSICALHEIGHT 111
#define PHYSICALOFFSETX 112
#define PHYSICALOFFSETY 113
STATIC FUNCTION ADJRTF( oRtf )
LOCAL hPrnDC := GETPRINTDEFAULT()
LOCAL hVidDC := GETDC( oRtf:hWnd )
LOCAL nHRatio := GETDEVICECAPS( hPrnDC, LOGPIXELSX ) / GETDEVICECAPS( hVidDC, LOGPIXELSX )
LOCAL nVRatio := GETDEVICECAPS( hPrnDC, LOGPIXELSY ) / GETDEVICECAPS( hVidDC, LOGPIXELSY )
LOCAL nHorzRes := GETDEVICECAPS( hPrnDC, HORZRES )
LOCAL nVertRes := GETDEVICECAPS( hPrnDC, VERTRES )
LOCAL nTMarg := PAGEGETMARGINS()[ 1 ] / 2540 * GETDEVICECAPS( hPrnDC, LOGPIXELSY )
LOCAL nLMarg := PAGEGETMARGINS()[ 2 ] / 2540 * GETDEVICECAPS( hPrnDC, LOGPIXELSX )
LOCAL nRMarg := PAGEGETMARGINS()[ 3 ] / 2540 * GETDEVICECAPS( hPrnDC, LOGPIXELSX )
LOCAL nBMarg := PAGEGETMARGINS()[ 4 ] / 2540 * GETDEVICECAPS( hPrnDC, LOGPIXELSY )
nHorzRes -= nLMarg + nRMarg
nVertRes -= nTMarg + nBMarg
ADJRTFRECT( oRtf:oWnd:hWnd, oRtf:hWnd, nHorzRes / nHRatio, nVertRes / nVRatio )
DELETEDC( hPrnDC )
RELEASEDC( hVidDC )
RETURN NIL
#pragma BEGINDUMP
#include <Windows.h>
#include <HbApi.h>
HB_FUNC( ADJRTFRECT )
{
RECT rct;
GetClientRect( ( HWND ) hb_parnl( 1 ), &rct );
rct.left += 5;
rct.top += 5;
rct.right = rct.left + hb_parnl( 3 );
rct.bottom = rct.top + hb_parnl( 4 );
SendMessage( ( HWND ) hb_parnl( 2 ), EM_SETRECT, 1, ( LPARAM ) &rct );
}
#pragma ENDDUMP
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 31 guests