trichview.com

trichview.support




Re: Error LeftMarginMM


Return to index


Author

Message

Sergey Tkachenko

Posted: 04/17/2002 17:02:16


Hm, are you sure about it?

I calculate values of margins in pixels taking into account physical

offsets.

(preview does not show physical offsets at all - it shows margins minus

physical offsets)


Below is the code for calculating margings in pixels (TmpLM - left margin,

TmpTM - right one, and so on)


  lpy := GetDeviceCaps(PHDC, LOGPIXELSY);

  lpx := GetDeviceCaps(PHDC, LOGPIXELSX);


  phoX := GetDeviceCaps(PHDC, PHYSICALOFFSETX);

  phoY := GetDeviceCaps(PHDC, PHYSICALOFFSETY);

  phW  := GetDeviceCaps(PHDC, PHYSICALWIDTH);

  phH  := GetDeviceCaps(PHDC, PHYSICALHEIGHT);


  if phW>phoX+GetPageWidth then

    phW := phoX+GetPageWidth;

  if phH>phoY+GetPageHeight then

    phH := phoY+GetPageHeight;


    TmpLM := MulDiv(FLeftMarginMM,   5*lpx, 127)- phoX;

    TmpTM := MulDiv(FTopMarginMM,    5*lpy, 127)- phoY;

    TmpRM := MulDiv(FRightMarginMM,  5*lpx, 127)- (phW-(phoX+GetPageWidth));

    TmpBM := MulDiv(FBottomMarginMM, 5*lpy, 127)-

(phH-(phoY+GetPageHeight));


GetPageWidth is GetDeviceCaps(PJDC, HorzRes),

GetPageHeight is GetDeviceCaps(PJDC, VertRes),



>

> I use the RichView Package 1.6.2 (Demo)

>

> When I print a RTF with TRVPrint, or when I preview with TRVPrintPreview,

> properties LeftMarginMM, TopMarginMM and LeftMarginMM are respected.

> But the right margin is not respected.

>

> The right margin is not equal to "RightMarginMM" but is equal to

> "RightMarginMM + distance from the right edge of the physical page to the

> right edge of the printable area"

>

> Is it normal ?

>





Powered by ABC Amber Outlook Express Converter